0
0
Fork 0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2025-01-31 22:20:56 +00:00

Allow disable of POWER_TIMEOUT (#21771)

Co-authored-by: Scott Lahteine <github@thinkyhead.com>
This commit is contained in:
Elton Law 2021-05-02 03:06:55 -04:00 committed by GitHub
parent 257ae51275
commit 661395a3b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -99,6 +99,10 @@ bool Power::is_power_needed() {
return false;
}
#ifndef POWER_TIMEOUT
#define POWER_TIMEOUT 0
#endif
void Power::check() {
static millis_t nextPowerCheck = 0;
millis_t ms = millis();
@ -106,7 +110,7 @@ void Power::check() {
nextPowerCheck = ms + 2500UL;
if (is_power_needed())
power_on();
else if (!lastPowerOn || ELAPSED(ms, lastPowerOn + SEC_TO_MS(POWER_TIMEOUT)))
else if (!lastPowerOn || (POWER_TIMEOUT > 0 && ELAPSED(ms, lastPowerOn + SEC_TO_MS(POWER_TIMEOUT))))
power_off();
}
}