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:
klaute 2018-07-13 08:02:50 +00:00
parent 1da7da3b64
commit e3a9ecc595

View file

@ -120,6 +120,14 @@ void setup() {
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
delay(50);
return;
@ -134,14 +142,6 @@ void loop() {
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_webserver_cnt++;
}
@ -183,4 +183,4 @@ void _loop() {
}
//*************************************************************************//