Merge pull request #5313 from thinkyhead/rc_fix_menu_actions

Keep drawing menu unless screen changes
master
Scott Lahteine 8 years ago committed by GitHub
commit a69b1ee691

@ -258,6 +258,7 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
#define START_MENU() \ #define START_MENU() \
START_SCREEN_OR_MENU(1); \ START_SCREEN_OR_MENU(1); \
screen_changed = false; \
NOMORE(encoderTopLine, encoderLine); \ NOMORE(encoderTopLine, encoderLine); \
if (encoderLine >= encoderTopLine + LCD_HEIGHT - TALL_FONT_CORRECTION) { \ if (encoderLine >= encoderTopLine + LCD_HEIGHT - TALL_FONT_CORRECTION) { \
encoderTopLine = encoderLine - (LCD_HEIGHT - TALL_FONT_CORRECTION - 1); \ 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
#define _MENU_ITEM_PART_2(TYPE, ...) \ #define _MENU_ITEM_PART_2(TYPE, ...) \
menu_action_ ## TYPE(__VA_ARGS__); \ menu_action_ ## TYPE(__VA_ARGS__); \
return; \ if (screen_changed) return; \
} \ } \
} \ } \
++_thisItemNr ++_thisItemNr
@ -383,6 +384,7 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
menuPosition screen_history[10]; menuPosition screen_history[10];
uint8_t screen_history_depth = 0; uint8_t screen_history_depth = 0;
bool screen_changed;
// LCD and menu clicks // LCD and menu clicks
bool lcd_clicked, wait_for_unclick, defer_return_to_status; 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
lcd_set_custom_characters(screen == lcd_status_screen); lcd_set_custom_characters(screen == lcd_status_screen);
#endif #endif
lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT; lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
screen_changed = true;
} }
} }
void lcd_return_to_status() { lcd_goto_screen(lcd_status_screen); } void lcd_return_to_status() { lcd_goto_screen(lcd_status_screen); }
inline void lcd_save_previous_menu() { void lcd_save_previous_screen() {
if (screen_history_depth < COUNT(screen_history)) { if (screen_history_depth < COUNT(screen_history)) {
screen_history[screen_history_depth].menu_function = currentScreen; screen_history[screen_history_depth].menu_function = currentScreen;
screen_history[screen_history_depth].encoder_position = encoderPosition; screen_history[screen_history_depth].encoder_position = encoderPosition;
@ -2354,7 +2357,7 @@ void kill_screen(const char* lcd_msg) {
void menu_edit_ ## _name () { _menu_edit_ ## _name(); } \ void menu_edit_ ## _name () { _menu_edit_ ## _name(); } \
void menu_edit_callback_ ## _name () { if (_menu_edit_ ## _name ()) (*callbackFunc)(); } \ void menu_edit_callback_ ## _name () { if (_menu_edit_ ## _name ()) (*callbackFunc)(); } \
void _menu_action_setting_edit_ ## _name (const char* pstr, _type* ptr, _type minValue, _type maxValue) { \ void _menu_action_setting_edit_ ## _name (const char* pstr, _type* ptr, _type minValue, _type maxValue) { \
lcd_save_previous_menu(); \ lcd_save_previous_screen(); \
\ \
lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; \ lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; \
\ \
@ -2445,7 +2448,7 @@ void kill_screen(const char* lcd_msg) {
* *
*/ */
void _menu_action_back() { lcd_goto_previous_menu(); } void _menu_action_back() { lcd_goto_previous_menu(); }
void menu_action_submenu(screenFunc_t func) { lcd_save_previous_menu(); lcd_goto_screen(func); } void menu_action_submenu(screenFunc_t func) { lcd_save_previous_screen(); lcd_goto_screen(func); }
void menu_action_gcode(const char* pgcode) { enqueue_and_echo_commands_P(pgcode); } void menu_action_gcode(const char* pgcode) { enqueue_and_echo_commands_P(pgcode); }
void menu_action_function(screenFunc_t func) { (*func)(); } void menu_action_function(screenFunc_t func) { (*func)(); }

Loading…
Cancel
Save