Add POWER_OFF_DELAY option (#19987)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
Hebezo
2020-11-09 01:37:41 +01:00
committed by GitHub
parent c753d2b7f4
commit 4ace02f4c2
7 changed files with 29 additions and 12 deletions

View File

@ -126,4 +126,12 @@ void Power::power_off() {
}
}
void Power::power_off_soon() {
#if POWER_OFF_DELAY
lastPowerOn = millis() - SEC_TO_MS(POWER_TIMEOUT) + SEC_TO_MS(POWER_OFF_DELAY);
#else
power_off();
#endif
}
#endif // AUTO_POWER_CONTROL

View File

@ -32,6 +32,7 @@ class Power {
static void check();
static void power_on();
static void power_off();
static void power_off_soon();
private:
static millis_t lastPowerOn;
static bool is_power_needed();