From 020269a83c00bb398fbdc0aab06bab1f0ccf8fd3 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Tue, 6 Mar 2018 21:26:14 +0100 Subject: [PATCH] Fix unable to go back from main menu to status screen. --- Firmware/MenuStack.h | 3 ++- Firmware/ultralcd.cpp | 7 +++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Firmware/MenuStack.h b/Firmware/MenuStack.h index 55c83690..04754449 100644 --- a/Firmware/MenuStack.h +++ b/Firmware/MenuStack.h @@ -24,8 +24,9 @@ public: MenuStack():m_stack(),m_index(0) {} void push(menuFunc_t menu, uint8_t position); Record pop(); + void reset(){m_index = 0;} private: - static const int max_depth = 3; + static const int max_depth = 4; Record m_stack[max_depth]; uint8_t m_index; }; diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index e80d8046..a3a08bcc 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -106,7 +106,7 @@ union Data byte b[2]; int value; }; - +static MenuStack menuStack; int8_t ReInitLCD = 0; int8_t SDscrool = 0; @@ -527,8 +527,8 @@ static void lcd_status_screen() if (current_click && (lcd_commands_type != LCD_COMMAND_STOP_PRINT)) //click is aborted unless stop print finishes { - - lcd_goto_menu(lcd_main_menu); + menuStack.reset(); + menu_action_submenu(lcd_main_menu); lcd_implementation_init( // to maybe revive the LCD if static electricity killed it. #if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT) currentMenu == lcd_status_screen @@ -6663,7 +6663,6 @@ static void lcd_quick_feedback() } /** Menu action functions **/ -static MenuStack menuStack; /** * @brief Go up in menu structure