Browse Source

Merge pull request #3116 from thinkyhead/rc_fix_value_edit_bug

Fix value edit click bug
Scott Lahteine 8 years ago
parent
commit
f4a3efd35e
1 changed files with 11 additions and 8 deletions
  1. 11
    8
      Marlin/ultralcd.cpp

+ 11
- 8
Marlin/ultralcd.cpp View File

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
  * "Info Screen"
277
  * "Info Screen"
466
       lcdDrawUpdate = 1;
470
       lcdDrawUpdate = 1;
467
     }
471
     }
468
     if (lcdDrawUpdate) lcd_implementation_drawedit(msg, "");
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
   static void lcd_babystep_x() { _lcd_babystep(X_AXIS, PSTR(MSG_BABYSTEPPING_X)); }
475
   static void lcd_babystep_x() { _lcd_babystep(X_AXIS, PSTR(MSG_BABYSTEPPING_X)); }
472
   static void lcd_babystep_y() { _lcd_babystep(Y_AXIS, PSTR(MSG_BABYSTEPPING_Y)); }
476
   static void lcd_babystep_y() { _lcd_babystep(Y_AXIS, PSTR(MSG_BABYSTEPPING_Y)); }
837
   if (lcdDrawUpdate) lcd_implementation_drawedit(name, ftostr31(current_position[axis]));
841
   if (lcdDrawUpdate) lcd_implementation_drawedit(name, ftostr31(current_position[axis]));
838
   if (LCD_CLICKED) {
842
   if (LCD_CLICKED) {
839
       line_to_current(axis);
843
       line_to_current(axis);
840
-      lcd_goto_menu(lcd_move_menu_axis);
844
+      lcd_goto_previous_menu();
841
   }
845
   }
842
 }
846
 }
843
 #if ENABLED(DELTA)
847
 #if ENABLED(DELTA)
883
     #endif //EXTRUDERS > 1
887
     #endif //EXTRUDERS > 1
884
     lcd_implementation_drawedit(pos_label, ftostr31(current_position[E_AXIS]));
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
   #if EXTRUDERS > 1
891
   #if EXTRUDERS > 1
888
     active_extruder = original_active_extruder;
892
     active_extruder = original_active_extruder;
889
   #endif
893
   #endif
1282
         lcd_implementation_drawedit(PSTR(MSG_CONTRAST), itostr2(lcd_contrast));
1286
         lcd_implementation_drawedit(PSTR(MSG_CONTRAST), itostr2(lcd_contrast));
1283
       #endif
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
 #endif // HAS_LCD_CONTRAST
1291
 #endif // HAS_LCD_CONTRAST
1288
 
1292
 
1381
       lcd_implementation_drawedit(editLabel, _strFunc(((_type)((int32_t)encoderPosition + minEditValue)) / scale)); \
1385
       lcd_implementation_drawedit(editLabel, _strFunc(((_type)((int32_t)encoderPosition + minEditValue)) / scale)); \
1382
     if (isClicked) { \
1386
     if (isClicked) { \
1383
       *((_type*)editValue) = ((_type)((int32_t)encoderPosition + minEditValue)) / scale; \
1387
       *((_type*)editValue) = ((_type)((int32_t)encoderPosition + minEditValue)) / scale; \
1384
-      lcd_goto_menu(prevMenu, prevEncoderPosition); \
1388
+      lcd_goto_previous_menu(); \
1385
     } \
1389
     } \
1386
     return isClicked; \
1390
     return isClicked; \
1387
   } \
1391
   } \
1388
   void menu_edit_ ## _name () { _menu_edit_ ## _name(); } \
1392
   void menu_edit_ ## _name () { _menu_edit_ ## _name(); } \
1389
   void menu_edit_callback_ ## _name () { if (_menu_edit_ ## _name ()) (*callbackFunc)(); } \
1393
   void menu_edit_callback_ ## _name () { if (_menu_edit_ ## _name ()) (*callbackFunc)(); } \
1390
   static void _menu_action_setting_edit_ ## _name (const char* pstr, _type* ptr, _type minValue, _type maxValue) { \
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
     lcdDrawUpdate = 2; \
1397
     lcdDrawUpdate = 2; \
1395
     currentMenu = menu_edit_ ## _name; \
1398
     currentMenu = menu_edit_ ## _name; \
1506
  *
1509
  *
1507
  */
1510
  */
1508
 static void menu_action_back(menuFunc_t func) { lcd_goto_menu(func); }
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
 static void menu_action_gcode(const char* pgcode) { enqueuecommands_P(pgcode); }
1513
 static void menu_action_gcode(const char* pgcode) { enqueuecommands_P(pgcode); }
1511
 static void menu_action_function(menuFunc_t func) { (*func)(); }
1514
 static void menu_action_function(menuFunc_t func) { (*func)(); }
1512
 
1515
 

Loading…
Cancel
Save