Correct timebase_ms after deep sleep

During deep sleep, the millisecond counter is stopped. To ensure correct delay
times, we add the sleep duration to the counter after wakeup.
This commit is contained in:
Thomas Kolb 2023-06-18 16:18:44 +02:00
parent bd08440584
commit e8dff1f017
1 changed files with 3 additions and 0 deletions

View File

@ -379,6 +379,9 @@ int main(void)
if((timebase_ms - charge_control_idle_since) > FLASH_CONFIG_DEEPSLEEP_DELAY) {
low_power_mode(FLASH_CONFIG_DEEPSLEEP_DURATION);
charge_control_was_idle = false;
// correct the time base after deep sleep
timebase_ms += FLASH_CONFIG_DEEPSLEEP_DURATION * 1000;
}
}
} else {