Prevent deep sleep during BMP280 communication
This commit is contained in:
parent
5c6497fb82
commit
1cbe0ce410
24
src/main.c
24
src/main.c
|
@ -369,19 +369,21 @@ int main(void)
|
|||
charge_control_update(timebase_ms, &meas_data);
|
||||
|
||||
// deep sleep control
|
||||
if(charge_control_is_idle()) {
|
||||
if(!charge_control_was_idle) {
|
||||
charge_control_was_idle = true;
|
||||
charge_control_idle_since = timebase_ms;
|
||||
} else {
|
||||
// charge control already idle
|
||||
if((timebase_ms - charge_control_idle_since) > FLASH_CONFIG_DEEPSLEEP_DELAY) {
|
||||
low_power_mode(FLASH_CONFIG_DEEPSLEEP_DURATION);
|
||||
charge_control_was_idle = false;
|
||||
if(bmp280_state != BMP280_MEASURING) { // general blockers
|
||||
if(charge_control_is_idle()) {
|
||||
if(!charge_control_was_idle) {
|
||||
charge_control_was_idle = true;
|
||||
charge_control_idle_since = timebase_ms;
|
||||
} else {
|
||||
// charge control already idle
|
||||
if((timebase_ms - charge_control_idle_since) > FLASH_CONFIG_DEEPSLEEP_DELAY) {
|
||||
low_power_mode(FLASH_CONFIG_DEEPSLEEP_DURATION);
|
||||
charge_control_was_idle = false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
charge_control_was_idle = false;
|
||||
}
|
||||
} else {
|
||||
charge_control_was_idle = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue