mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-11-28 22:35:21 +00:00
🩹 Fix M80, 1s delay (#23455)
This commit is contained in:
parent
c55b66bece
commit
1fe07bf365
@ -153,6 +153,7 @@ void Power::power_off() {
|
||||
}
|
||||
|
||||
void Power::checkAutoPowerOff() {
|
||||
if (TERN1(POWER_OFF_TIMER, !power_off_time) && TERN1(POWER_OFF_WAIT_FOR_COOLDOWN, !power_off_on_cooldown)) return;
|
||||
if (TERN0(POWER_OFF_WAIT_FOR_COOLDOWN, power_off_on_cooldown && is_cooling_needed())) return;
|
||||
if (TERN0(POWER_OFF_TIMER, power_off_time && PENDING(millis(), power_off_time))) return;
|
||||
power_off();
|
||||
|
@ -84,14 +84,19 @@ void GcodeSuite::M81() {
|
||||
ZERO(thermalManager.saved_fan_speed);
|
||||
#endif
|
||||
|
||||
safe_delay(1000); // Wait 1 second before switching off
|
||||
|
||||
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()));
|
||||
uint16_t delay = parser.value_ushort();
|
||||
if (delay > 1) { // skip already observed 1s delay
|
||||
delayed_power_off = true;
|
||||
powerManager.setPowerOffTimer(SEC_TO_MS(delay - 1));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -104,8 +109,6 @@ void GcodeSuite::M81() {
|
||||
|
||||
if (delayed_power_off) return;
|
||||
|
||||
safe_delay(1000); // Wait 1 second before switching off
|
||||
|
||||
#if HAS_SUICIDE
|
||||
suicide();
|
||||
#elif ENABLED(PSU_CONTROL)
|
||||
|
Loading…
Reference in New Issue
Block a user