Apply TERN to compact code (#17619)
This commit is contained in:
@ -72,14 +72,10 @@ void GcodeSuite::M1001() {
|
||||
gcode.process_subcommands_now_P(PSTR("M77"));
|
||||
|
||||
// Set the progress bar "done" state
|
||||
#if ENABLED(LCD_SET_PROGRESS_MANUALLY)
|
||||
ui.set_progress_done();
|
||||
#endif
|
||||
TERN_(LCD_SET_PROGRESS_MANUALLY, ui.set_progress_done());
|
||||
|
||||
// Purge the recovery file
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
recovery.purge();
|
||||
#endif
|
||||
TERN_(POWER_LOSS_RECOVERY, recovery.purge());
|
||||
|
||||
// Announce SD file completion
|
||||
SERIAL_ECHOLNPGM(STR_FILE_PRINTED);
|
||||
@ -88,12 +84,8 @@ void GcodeSuite::M1001() {
|
||||
#if HAS_LEDS_OFF_FLAG
|
||||
if (long_print) {
|
||||
printerEventLEDs.onPrintCompleted();
|
||||
#if ENABLED(EXTENSIBLE_UI)
|
||||
ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_PRINT_DONE));
|
||||
#endif
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT(MSG_PRINT_DONE), CONTINUE_STR);
|
||||
#endif
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_PRINT_DONE)));
|
||||
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT(MSG_PRINT_DONE), CONTINUE_STR));
|
||||
wait_for_user_response(1000UL * TERN(HAS_LCD_MENU, PE_LEDS_COMPLETED_TIME, 30));
|
||||
printerEventLEDs.onResumeAfterWait();
|
||||
}
|
||||
@ -105,9 +97,7 @@ void GcodeSuite::M1001() {
|
||||
#endif
|
||||
|
||||
// Re-select the last printed file in the UI
|
||||
#if ENABLED(SD_REPRINT_LAST_SELECTED_FILE)
|
||||
ui.reselect_last_file();
|
||||
#endif
|
||||
TERN_(SD_REPRINT_LAST_SELECTED_FILE, ui.reselect_last_file());
|
||||
}
|
||||
|
||||
#endif // SDSUPPORT
|
||||
|
@ -38,9 +38,7 @@ void GcodeSuite::M23() {
|
||||
for (char *fn = parser.string_arg; *fn; ++fn) if (*fn == ' ') *fn = '\0';
|
||||
card.openFileRead(parser.string_arg);
|
||||
|
||||
#if ENABLED(LCD_SET_PROGRESS_MANUALLY)
|
||||
ui.set_progress(0);
|
||||
#endif
|
||||
TERN_(LCD_SET_PROGRESS_MANUALLY, ui.set_progress(0));
|
||||
}
|
||||
|
||||
#endif // SDSUPPORT
|
||||
|
@ -64,18 +64,14 @@ void GcodeSuite::M24() {
|
||||
if (card.isFileOpen()) {
|
||||
card.startFileprint(); // SD card will now be read for commands
|
||||
startOrResumeJob(); // Start (or resume) the print job timer
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
recovery.prepare();
|
||||
#endif
|
||||
TERN_(POWER_LOSS_RECOVERY, recovery.prepare());
|
||||
}
|
||||
|
||||
#if ENABLED(HOST_ACTION_COMMANDS)
|
||||
#ifdef ACTION_ON_RESUME
|
||||
host_action_resume();
|
||||
#endif
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
host_prompt_open(PROMPT_INFO, PSTR("Resuming SD"), DISMISS_STR);
|
||||
#endif
|
||||
TERN_(HOST_PROMPT_SUPPORT, host_prompt_open(PROMPT_INFO, PSTR("Resuming SD"), DISMISS_STR));
|
||||
#endif
|
||||
|
||||
ui.reset_status();
|
||||
@ -105,9 +101,7 @@ void GcodeSuite::M25() {
|
||||
ui.reset_status();
|
||||
|
||||
#if ENABLED(HOST_ACTION_COMMANDS)
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
host_prompt_open(PROMPT_PAUSE_RESUME, PSTR("Pause SD"), PSTR("Resume"));
|
||||
#endif
|
||||
TERN_(HOST_PROMPT_SUPPORT, host_prompt_open(PROMPT_PAUSE_RESUME, PSTR("Pause SD"), PSTR("Resume")));
|
||||
#ifdef ACTION_ON_PAUSE
|
||||
host_action_pause();
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user