Browse Source

Merge pull request #5313 from thinkyhead/rc_fix_menu_actions

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

Loading…
Cancel
Save