mirror of
https://github.com/xoseperez/espurna.git
synced 2026-03-06 16:27:12 +01:00
system: light and deep sleep api
see #2578 * deep sleep api without ESP class dependency * rf + cpu light sleep for cases when deep sleep cannot be used * generic time-based light sleep; nonos does not halt cpu, unlike the wakeup variant. timers also keep going, so this has to be used with extra care pending some 'deferred' variant and before and after sleep actions
This commit is contained in:
@@ -275,6 +275,7 @@ void ensure_opmode(uint8_t mode) {
|
||||
// since we should enforce mode changes to happen *only* through the configuration loop
|
||||
|
||||
if (!is_set()) {
|
||||
const auto current = wifi_get_opmode();
|
||||
wifi_set_opmode_current(mode);
|
||||
|
||||
espurna::time::blockingDelay(
|
||||
@@ -287,6 +288,10 @@ void ensure_opmode(uint8_t mode) {
|
||||
if (!is_set()) {
|
||||
abort();
|
||||
}
|
||||
|
||||
if (current == OpmodeNull) {
|
||||
wakeupModemForcedSleep();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user