Clean up user-wait, SD completion (#17315)
This commit is contained in:
@@ -210,6 +210,24 @@ bool wait_for_heatup = true;
|
||||
// For M0/M1, this flag may be cleared (by M108) to exit the wait-for-user loop
|
||||
#if HAS_RESUME_CONTINUE
|
||||
bool wait_for_user; // = false;
|
||||
|
||||
void wait_for_user_response(millis_t ms/*=0*/, const bool no_sleep/*=false*/) {
|
||||
#if DISABLED(ADVANCED_PAUSE_FEATURE)
|
||||
UNUSED(no_sleep);
|
||||
#endif
|
||||
KEEPALIVE_STATE(PAUSED_FOR_USER);
|
||||
wait_for_user = true;
|
||||
if (ms) ms += millis(); // expire time
|
||||
while (wait_for_user && !(ms && ELAPSED(millis(), ms))) {
|
||||
idle(
|
||||
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||
no_sleep
|
||||
#endif
|
||||
);
|
||||
}
|
||||
wait_for_user = false;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// Inactivity shutdown
|
||||
@@ -418,53 +436,8 @@ void startOrResumeJob() {
|
||||
}
|
||||
|
||||
inline void finishSDPrinting() {
|
||||
|
||||
bool did_state = true;
|
||||
switch (card.sdprinting_done_state) {
|
||||
|
||||
case 1:
|
||||
if (print_job_timer.duration() > 60)
|
||||
did_state = queue.enqueue_one_P(PSTR("M31"));
|
||||
break;
|
||||
|
||||
case 2:
|
||||
did_state = queue.enqueue_one_P(PSTR("M77"));
|
||||
break;
|
||||
|
||||
case 3:
|
||||
#if ENABLED(LCD_SET_PROGRESS_MANUALLY)
|
||||
ui.set_progress_done();
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 4: // Display "Click to Continue..."
|
||||
#if HAS_LEDS_OFF_FLAG // 30 min timeout with LCD, 1 min without
|
||||
did_state = queue.enqueue_one_P(
|
||||
print_job_timer.duration() < 60 ? PSTR("M0Q1P1") : PSTR("M0Q1S" TERN(HAS_LCD_MENU, "1800", "60"))
|
||||
);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 5:
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
recovery.purge();
|
||||
#endif
|
||||
|
||||
#if ENABLED(SD_FINISHED_STEPPERRELEASE) && defined(SD_FINISHED_RELEASECOMMAND)
|
||||
planner.finish_and_disable();
|
||||
#endif
|
||||
|
||||
#if ENABLED(SD_REPRINT_LAST_SELECTED_FILE)
|
||||
ui.reselect_last_file();
|
||||
#endif
|
||||
|
||||
SERIAL_ECHOLNPGM(STR_FILE_PRINTED);
|
||||
|
||||
default:
|
||||
did_state = false;
|
||||
card.sdprinting_done_state = 0;
|
||||
}
|
||||
if (did_state) ++card.sdprinting_done_state;
|
||||
if (queue.enqueue_one_P(PSTR("M1001")))
|
||||
marlin_state = MF_RUNNING;
|
||||
}
|
||||
|
||||
#endif // SDSUPPORT
|
||||
@@ -1209,7 +1182,7 @@ void loop() {
|
||||
#if ENABLED(SDSUPPORT)
|
||||
card.checkautostart();
|
||||
if (card.flag.abort_sd_printing) abortSDPrinting();
|
||||
if (card.sdprinting_done_state) finishSDPrinting();
|
||||
if (marlin_state == MF_SD_COMPLETE) finishSDPrinting();
|
||||
#endif
|
||||
|
||||
queue.advance();
|
||||
|
||||
Reference in New Issue
Block a user