M81 D / S - Power-off Delay (#23396)

This commit is contained in:
John Lagonikas
2022-01-03 18:11:39 +02:00
committed by GitHub
parent b8a376a28a
commit 9a194826e3
9 changed files with 130 additions and 42 deletions

View File

@@ -79,13 +79,31 @@ void GcodeSuite::M81() {
print_job_timer.stop();
#if HAS_FAN
#if ENABLED(PROBING_FANS_OFF)
thermalManager.fans_paused = false;
ZERO(thermalManager.saved_fan_speed);
#endif
#if BOTH(HAS_FAN, PROBING_FANS_OFF)
thermalManager.fans_paused = false;
ZERO(thermalManager.saved_fan_speed);
#endif
LCD_MESSAGE_F(MACHINE_NAME " " STR_OFF ".");
bool delayed_power_off = false;
#if ENABLED(POWER_OFF_TIMER)
if (parser.seenval('D')) {
delayed_power_off = true;
powerManager.setPowerOffTimer(SEC_TO_MS(parser.value_ushort()));
}
#endif
#if ENABLED(POWER_OFF_WAIT_FOR_COOLDOWN)
if (parser.boolval('S')) {
delayed_power_off = true;
powerManager.setPowerOffOnCooldown(true);
}
#endif
if (delayed_power_off) return;
safe_delay(1000); // Wait 1 second before switching off
#if HAS_SUICIDE
@@ -93,6 +111,4 @@ void GcodeSuite::M81() {
#elif ENABLED(PSU_CONTROL)
powerManager.power_off_soon();
#endif
LCD_MESSAGE_F(MACHINE_NAME " " STR_OFF ".");
}