Fix Select Screen cancel destination

This commit is contained in:
Scott Lahteine 2020-08-21 02:41:33 -05:00
parent 615af841f0
commit ca54d67814
5 changed files with 11 additions and 7 deletions

View File

@ -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();
}
}

View File

@ -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; \
} \

View File

@ -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

View File

@ -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();

View File

@ -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("?")
);