Browse Source

Merge pull request #5313 from thinkyhead/rc_fix_menu_actions

Keep drawing menu unless screen changes
Scott Lahteine 7 years ago
parent
commit
a69b1ee691
1 changed files with 7 additions and 4 deletions
  1. 7
    4
      Marlin/ultralcd.cpp

+ 7
- 4
Marlin/ultralcd.cpp View File

@@ -258,6 +258,7 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
258 258
 
259 259
   #define START_MENU() \
260 260
     START_SCREEN_OR_MENU(1); \
261
+    screen_changed = false; \
261 262
     NOMORE(encoderTopLine, encoderLine); \
262 263
     if (encoderLine >= encoderTopLine + LCD_HEIGHT - TALL_FONT_CORRECTION) { \
263 264
       encoderTopLine = encoderLine - (LCD_HEIGHT - TALL_FONT_CORRECTION - 1); \
@@ -296,7 +297,7 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
296 297
 
297 298
   #define _MENU_ITEM_PART_2(TYPE, ...) \
298 299
         menu_action_ ## TYPE(__VA_ARGS__); \
299
-        return; \
300
+        if (screen_changed) return; \
300 301
       } \
301 302
     } \
302 303
     ++_thisItemNr
@@ -383,6 +384,7 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
383 384
 
384 385
   menuPosition screen_history[10];
385 386
   uint8_t screen_history_depth = 0;
387
+  bool screen_changed;
386 388
 
387 389
   // LCD and menu clicks
388 390
   bool lcd_clicked, wait_for_unclick, defer_return_to_status;
@@ -410,12 +412,13 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
410 412
         lcd_set_custom_characters(screen == lcd_status_screen);
411 413
       #endif
412 414
       lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
415
+      screen_changed = true;
413 416
     }
414 417
   }
415 418
 
416 419
   void lcd_return_to_status() { lcd_goto_screen(lcd_status_screen); }
417 420
 
418
-  inline void lcd_save_previous_menu() {
421
+  void lcd_save_previous_screen() {
419 422
     if (screen_history_depth < COUNT(screen_history)) {
420 423
       screen_history[screen_history_depth].menu_function = currentScreen;
421 424
       screen_history[screen_history_depth].encoder_position = encoderPosition;
@@ -2354,7 +2357,7 @@ void kill_screen(const char* lcd_msg) {
2354 2357
     void menu_edit_ ## _name () { _menu_edit_ ## _name(); } \
2355 2358
     void menu_edit_callback_ ## _name () { if (_menu_edit_ ## _name ()) (*callbackFunc)(); } \
2356 2359
     void _menu_action_setting_edit_ ## _name (const char* pstr, _type* ptr, _type minValue, _type maxValue) { \
2357
-      lcd_save_previous_menu(); \
2360
+      lcd_save_previous_screen(); \
2358 2361
       \
2359 2362
       lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; \
2360 2363
       \
@@ -2445,7 +2448,7 @@ void kill_screen(const char* lcd_msg) {
2445 2448
    *
2446 2449
    */
2447 2450
   void _menu_action_back() { lcd_goto_previous_menu(); }
2448
-  void menu_action_submenu(screenFunc_t func) { lcd_save_previous_menu(); lcd_goto_screen(func); }
2451
+  void menu_action_submenu(screenFunc_t func) { lcd_save_previous_screen(); lcd_goto_screen(func); }
2449 2452
   void menu_action_gcode(const char* pgcode) { enqueue_and_echo_commands_P(pgcode); }
2450 2453
   void menu_action_function(screenFunc_t func) { (*func)(); }
2451 2454
 

Loading…
Cancel
Save