Update 'firmware/firmware.ino'

Added undervoltage preventing deep sleep to setup function.
This commit is contained in:
klaute 2018-07-13 08:21:59 +00:00
parent e3a9ecc595
commit 984dfc07dd

View file

@ -106,6 +106,14 @@ void setup() {
digitalWrite(STATUS_LED_PIN, LOW); digitalWrite(STATUS_LED_PIN, LOW);
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
}
WiFi.mode(WIFI_OFF); WiFi.mode(WIFI_OFF);
WiFi.forceSleepBegin(); WiFi.forceSleepBegin();