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:
parent
bd08440584
commit
e8dff1f017
|
@ -379,6 +379,9 @@ int main(void)
|
||||||
if((timebase_ms - charge_control_idle_since) > FLASH_CONFIG_DEEPSLEEP_DELAY) {
|
if((timebase_ms - charge_control_idle_since) > FLASH_CONFIG_DEEPSLEEP_DELAY) {
|
||||||
low_power_mode(FLASH_CONFIG_DEEPSLEEP_DURATION);
|
low_power_mode(FLASH_CONFIG_DEEPSLEEP_DURATION);
|
||||||
charge_control_was_idle = false;
|
charge_control_was_idle = false;
|
||||||
|
|
||||||
|
// correct the time base after deep sleep
|
||||||
|
timebase_ms += FLASH_CONFIG_DEEPSLEEP_DURATION * 1000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue