Add TURBO_BACK_MENU_ITEM option (#14991)

This commit is contained in:
Scott Lahteine
2019-08-20 19:37:03 -05:00
committed by GitHub
parent 0cc524b84f
commit 5e777601f3
102 changed files with 323 additions and 4 deletions

View File

@ -88,10 +88,21 @@ void MarlinUI::save_previous_screen() {
screen_history[screen_history_depth++] = { currentScreen, encoderPosition, encoderTopLine, screen_items };
}
void MarlinUI::goto_previous_screen() {
void MarlinUI::goto_previous_screen(
#if ENABLED(TURBO_BACK_MENU_ITEM)
const bool is_back/*=false*/
#endif
) {
#if DISABLED(TURBO_BACK_MENU_ITEM)
constexpr bool is_back = false;
#endif
if (screen_history_depth > 0) {
menuPosition &sh = screen_history[--screen_history_depth];
goto_screen(sh.menu_function, sh.encoder_position, sh.top_line, sh.items);
goto_screen(sh.menu_function,
is_back ? 0 : sh.encoder_position,
is_back ? 0 : sh.top_line,
sh.items
);
}
else
return_to_status();

View File

@ -144,7 +144,13 @@ DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(long5_25); // 12345 right-justif
class MenuItem_back {
public:
static inline void action() { ui.goto_previous_screen(); }
static inline void action() {
ui.goto_previous_screen(
#if ENABLED(TURBO_BACK_MENU_ITEM)
true
#endif
);
}
};
class MenuItem_submenu {