Update 'firmware/firmware.ino'
Moved the deep sleep call in case of low battery to the top of the main loop.
This commit is contained in:
parent
1da7da3b64
commit
e3a9ecc595
1 changed files with 9 additions and 9 deletions
|
@ -120,6 +120,14 @@ void setup() {
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
|
|
||||||
|
if (currentSensorData[SENSOR_BAT_VOLTAGE] <= 3.4)
|
||||||
|
{
|
||||||
|
#ifdef DEBUG
|
||||||
|
Serial.println("Low battery, going into deep sleep.");
|
||||||
|
#endif
|
||||||
|
ESP.deepSleep(4294967295); // battery low, shutting down
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef POWERSAVING
|
#ifdef POWERSAVING
|
||||||
delay(50);
|
delay(50);
|
||||||
return;
|
return;
|
||||||
|
@ -134,14 +142,6 @@ void loop() {
|
||||||
|
|
||||||
delay(DELAY_LOOP_MS);
|
delay(DELAY_LOOP_MS);
|
||||||
|
|
||||||
if (currentSensorData[SENSOR_BAT_VOLTAGE] <= 3.4)
|
|
||||||
{
|
|
||||||
#ifdef DEBUG
|
|
||||||
Serial.println("Low battery, going into deep sleep.");
|
|
||||||
#endif
|
|
||||||
ESP.deepSleep(4294967295); // battery low, shutting down
|
|
||||||
}
|
|
||||||
|
|
||||||
update_sensor_cnt++;
|
update_sensor_cnt++;
|
||||||
update_webserver_cnt++;
|
update_webserver_cnt++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue