✨ M81 D / S - Power-off Delay (#23396)
This commit is contained in:
@@ -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 ".");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user