Ver código fonte

Merge pull request #3116 from thinkyhead/rc_fix_value_edit_bug

Fix value edit click bug
Scott Lahteine 8 anos atrás
pai
commit
f4a3efd35e
1 arquivos alterados com 11 adições e 8 exclusões
  1. 11
    8
      Marlin/ultralcd.cpp

+ 11
- 8
Marlin/ultralcd.cpp Ver arquivo

@@ -268,6 +268,10 @@ static void lcd_goto_menu(menuFunc_t menu, const bool feedback = false, const ui
268 268
   }
269 269
 }
270 270
 
271
+inline void lcd_save_previous_menu() { prevMenu = currentMenu; prevEncoderPosition = encoderPosition; }
272
+
273
+static void lcd_goto_previous_menu() { lcd_goto_menu(prevMenu, true, prevEncoderPosition); }
274
+
271 275
 /**
272 276
  *
273 277
  * "Info Screen"
@@ -466,7 +470,7 @@ void lcd_set_home_offsets() {
466 470
       lcdDrawUpdate = 1;
467 471
     }
468 472
     if (lcdDrawUpdate) lcd_implementation_drawedit(msg, "");
469
-    if (LCD_CLICKED) lcd_goto_menu(lcd_tune_menu);
473
+    if (LCD_CLICKED) lcd_goto_previous_menu();
470 474
   }
471 475
   static void lcd_babystep_x() { _lcd_babystep(X_AXIS, PSTR(MSG_BABYSTEPPING_X)); }
472 476
   static void lcd_babystep_y() { _lcd_babystep(Y_AXIS, PSTR(MSG_BABYSTEPPING_Y)); }
@@ -837,7 +841,7 @@ static void _lcd_move(const char* name, AxisEnum axis, int min, int max) {
837 841
   if (lcdDrawUpdate) lcd_implementation_drawedit(name, ftostr31(current_position[axis]));
838 842
   if (LCD_CLICKED) {
839 843
       line_to_current(axis);
840
-      lcd_goto_menu(lcd_move_menu_axis);
844
+      lcd_goto_previous_menu();
841 845
   }
842 846
 }
843 847
 #if ENABLED(DELTA)
@@ -883,7 +887,7 @@ static void lcd_move_e(
883 887
     #endif //EXTRUDERS > 1
884 888
     lcd_implementation_drawedit(pos_label, ftostr31(current_position[E_AXIS]));
885 889
   }
886
-  if (LCD_CLICKED) lcd_goto_menu(lcd_move_menu_axis);
890
+  if (LCD_CLICKED) lcd_goto_previous_menu();
887 891
   #if EXTRUDERS > 1
888 892
     active_extruder = original_active_extruder;
889 893
   #endif
@@ -1282,7 +1286,7 @@ static void lcd_control_volumetric_menu() {
1282 1286
         lcd_implementation_drawedit(PSTR(MSG_CONTRAST), itostr2(lcd_contrast));
1283 1287
       #endif
1284 1288
     }
1285
-    if (LCD_CLICKED) lcd_goto_menu(lcd_control_menu);
1289
+    if (LCD_CLICKED) lcd_goto_previous_menu();
1286 1290
   }
1287 1291
 #endif // HAS_LCD_CONTRAST
1288 1292
 
@@ -1381,15 +1385,14 @@ static void lcd_control_volumetric_menu() {
1381 1385
       lcd_implementation_drawedit(editLabel, _strFunc(((_type)((int32_t)encoderPosition + minEditValue)) / scale)); \
1382 1386
     if (isClicked) { \
1383 1387
       *((_type*)editValue) = ((_type)((int32_t)encoderPosition + minEditValue)) / scale; \
1384
-      lcd_goto_menu(prevMenu, prevEncoderPosition); \
1388
+      lcd_goto_previous_menu(); \
1385 1389
     } \
1386 1390
     return isClicked; \
1387 1391
   } \
1388 1392
   void menu_edit_ ## _name () { _menu_edit_ ## _name(); } \
1389 1393
   void menu_edit_callback_ ## _name () { if (_menu_edit_ ## _name ()) (*callbackFunc)(); } \
1390 1394
   static void _menu_action_setting_edit_ ## _name (const char* pstr, _type* ptr, _type minValue, _type maxValue) { \
1391
-    prevMenu = currentMenu; \
1392
-    prevEncoderPosition = encoderPosition; \
1395
+    lcd_save_previous_menu(); \
1393 1396
     \
1394 1397
     lcdDrawUpdate = 2; \
1395 1398
     currentMenu = menu_edit_ ## _name; \
@@ -1506,7 +1509,7 @@ void lcd_quick_feedback() {
1506 1509
  *
1507 1510
  */
1508 1511
 static void menu_action_back(menuFunc_t func) { lcd_goto_menu(func); }
1509
-static void menu_action_submenu(menuFunc_t func) { lcd_goto_menu(func); }
1512
+static void menu_action_submenu(menuFunc_t func) { lcd_save_previous_menu(); lcd_goto_menu(func); }
1510 1513
 static void menu_action_gcode(const char* pgcode) { enqueuecommands_P(pgcode); }
1511 1514
 static void menu_action_function(menuFunc_t func) { (*func)(); }
1512 1515
 

Carregando…
Cancelar
Salvar