Move single-use to lambdas

This commit is contained in:
Scott Lahteine 2019-11-07 00:28:33 -06:00
parent 84ce3a6bea
commit 0be9fdb455
2 changed files with 18 additions and 28 deletions

View file

@ -42,16 +42,6 @@
#define MACHINE_CAN_STOP (EITHER(SDSUPPORT, HOST_PROMPT_SUPPORT) || defined(ACTION_ON_CANCEL))
#define MACHINE_CAN_PAUSE (ANY(SDSUPPORT, HOST_PROMPT_SUPPORT, PARK_HEAD_ON_PAUSE) || defined(ACTION_ON_PAUSE))
#if MACHINE_CAN_STOP
void menu_abort_confirm() {
MenuItem_confirm::select_screen(
GET_TEXT(MSG_BUTTON_STOP), GET_TEXT(MSG_BACK),
ui.abort_print, ui.goto_previous_screen,
GET_TEXT(MSG_STOP_PRINT), (PGM_P)nullptr, PSTR("?")
);
}
#endif // MACHINE_CAN_STOP
#if ENABLED(PRUSA_MMU2)
#include "../../lcd/menu/menu_mmu2.h"
#endif
@ -105,7 +95,13 @@ void menu_main() {
ACTION_ITEM(MSG_PAUSE_PRINT, ui.pause_print);
#endif
#if MACHINE_CAN_STOP
SUBMENU(MSG_STOP_PRINT, menu_abort_confirm);
SUBMENU(MSG_STOP_PRINT, []{
MenuItem_confirm::select_screen(
GET_TEXT(MSG_BUTTON_STOP), GET_TEXT(MSG_BACK),
ui.abort_print, ui.goto_previous_screen,
GET_TEXT(MSG_STOP_PRINT), (PGM_P)nullptr, PSTR("?")
);
});
#endif
SUBMENU(MSG_TUNE, menu_tune);
}