From ca54d67814dd552b20f4eb8d51501ad9ea0a4f26 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 21 Aug 2020 02:41:33 -0500 Subject: [PATCH] Fix Select Screen cancel destination --- Marlin/src/lcd/menu/menu.cpp | 5 ++++- Marlin/src/lcd/menu/menu.h | 1 + Marlin/src/lcd/menu/menu_advanced.cpp | 2 +- Marlin/src/lcd/menu/menu_configuration.cpp | 8 ++++---- Marlin/src/lcd/menu/menu_mixer.cpp | 2 +- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Marlin/src/lcd/menu/menu.cpp b/Marlin/src/lcd/menu/menu.cpp index 373051fd4e..3a3cd0934b 100644 --- a/Marlin/src/lcd/menu/menu.cpp +++ b/Marlin/src/lcd/menu/menu.cpp @@ -412,7 +412,10 @@ void MenuItem_confirm::select_screen( const bool ui_selection = ui.update_selection(), got_click = ui.use_click(); if (got_click || ui.should_draw()) { draw_select_screen(yes, no, ui_selection, pref, string, suff); - if (got_click) { ui_selection ? yesFunc() : noFunc(); } + if (got_click) { + selectFunc_t callFunc = ui_selection ? yesFunc : noFunc; + if (callFunc) callFunc(); else ui.goto_previous_screen(); + } ui.defer_status_screen(); } } diff --git a/Marlin/src/lcd/menu/menu.h b/Marlin/src/lcd/menu/menu.h index 7c3df79a19..3a29a87d5e 100644 --- a/Marlin/src/lcd/menu/menu.h +++ b/Marlin/src/lcd/menu/menu.h @@ -542,6 +542,7 @@ class MenuItem_bool : public MenuEditItemBase { #define _CONFIRM_ITEM_INNER_P(PLABEL, V...) do { \ if (encoderLine == _thisItemNr && ui.use_click()) { \ + ui.save_previous_screen(); \ ui.goto_screen([]{MenuItem_confirm::select_screen(V);}); \ return; \ } \ diff --git a/Marlin/src/lcd/menu/menu_advanced.cpp b/Marlin/src/lcd/menu/menu_advanced.cpp index e417861072..942fb67569 100644 --- a/Marlin/src/lcd/menu/menu_advanced.cpp +++ b/Marlin/src/lcd/menu/menu_advanced.cpp @@ -614,7 +614,7 @@ void menu_advanced_settings() { #if ENABLED(EEPROM_SETTINGS) && DISABLED(SLIM_LCD_MENUS) CONFIRM_ITEM(MSG_INIT_EEPROM, MSG_BUTTON_INIT, MSG_BUTTON_CANCEL, - ui.init_eeprom, ui.goto_previous_screen, + ui.init_eeprom, nullptr, GET_TEXT(MSG_INIT_EEPROM), (const char *)nullptr, PSTR("?") ); #endif diff --git a/Marlin/src/lcd/menu/menu_configuration.cpp b/Marlin/src/lcd/menu/menu_configuration.cpp index 26120fc5da..e834009f77 100644 --- a/Marlin/src/lcd/menu/menu_configuration.cpp +++ b/Marlin/src/lcd/menu/menu_configuration.cpp @@ -224,11 +224,11 @@ void menu_advanced_settings(); ACTION_ITEM(MSG_BLTOUCH_STOW, bltouch._stow); ACTION_ITEM(MSG_BLTOUCH_SW_MODE, bltouch._set_SW_mode); #if ENABLED(BLTOUCH_LCD_VOLTAGE_MENU) - CONFIRM_ITEM(MSG_BLTOUCH_5V_MODE, MSG_BLTOUCH_5V_MODE, MSG_BUTTON_CANCEL, bltouch._set_5V_mode, ui.goto_previous_screen, GET_TEXT(MSG_BLTOUCH_MODE_CHANGE)); - CONFIRM_ITEM(MSG_BLTOUCH_OD_MODE, MSG_BLTOUCH_OD_MODE, MSG_BUTTON_CANCEL, bltouch._set_OD_mode, ui.goto_previous_screen, GET_TEXT(MSG_BLTOUCH_MODE_CHANGE)); + CONFIRM_ITEM(MSG_BLTOUCH_5V_MODE, MSG_BLTOUCH_5V_MODE, MSG_BUTTON_CANCEL, bltouch._set_5V_mode, nullptr, GET_TEXT(MSG_BLTOUCH_MODE_CHANGE)); + CONFIRM_ITEM(MSG_BLTOUCH_OD_MODE, MSG_BLTOUCH_OD_MODE, MSG_BUTTON_CANCEL, bltouch._set_OD_mode, nullptr, GET_TEXT(MSG_BLTOUCH_MODE_CHANGE)); ACTION_ITEM(MSG_BLTOUCH_MODE_STORE, bltouch._mode_store); - CONFIRM_ITEM(MSG_BLTOUCH_MODE_STORE_5V, MSG_BLTOUCH_MODE_STORE_5V, MSG_BUTTON_CANCEL, bltouch.mode_conv_5V, ui.goto_previous_screen, GET_TEXT(MSG_BLTOUCH_MODE_CHANGE)); - CONFIRM_ITEM(MSG_BLTOUCH_MODE_STORE_OD, MSG_BLTOUCH_MODE_STORE_OD, MSG_BUTTON_CANCEL, bltouch.mode_conv_OD, ui.goto_previous_screen, GET_TEXT(MSG_BLTOUCH_MODE_CHANGE)); + CONFIRM_ITEM(MSG_BLTOUCH_MODE_STORE_5V, MSG_BLTOUCH_MODE_STORE_5V, MSG_BUTTON_CANCEL, bltouch.mode_conv_5V, nullptr, GET_TEXT(MSG_BLTOUCH_MODE_CHANGE)); + CONFIRM_ITEM(MSG_BLTOUCH_MODE_STORE_OD, MSG_BLTOUCH_MODE_STORE_OD, MSG_BUTTON_CANCEL, bltouch.mode_conv_OD, nullptr, GET_TEXT(MSG_BLTOUCH_MODE_CHANGE)); ACTION_ITEM(MSG_BLTOUCH_MODE_ECHO, bltouch_report); #endif END_MENU(); diff --git a/Marlin/src/lcd/menu/menu_mixer.cpp b/Marlin/src/lcd/menu/menu_mixer.cpp index 3f57d257ad..2bcde1c286 100644 --- a/Marlin/src/lcd/menu/menu_mixer.cpp +++ b/Marlin/src/lcd/menu/menu_mixer.cpp @@ -264,7 +264,7 @@ void menu_mixer() { LCD_MESSAGEPGM(MSG_VTOOLS_RESET); ui.return_to_status(); }, - ui.goto_previous_screen, + nullptr, GET_TEXT(MSG_RESET_VTOOLS), (const char *)nullptr, PSTR("?") );