Browse Source

Update 'firmware/firmware.ino'

Added undervoltage preventing deep sleep to setup function.
klaute 2 years ago
parent
commit
984dfc07dd
1 changed files with 8 additions and 0 deletions
  1. 8
    0
      firmware/firmware.ino

+ 8
- 0
firmware/firmware.ino View File

@@ -106,6 +106,14 @@ void setup() {
106 106
 
107 107
   digitalWrite(STATUS_LED_PIN, LOW);
108 108
 
109
+  if (currentSensorData[SENSOR_BAT_VOLTAGE] <= 3.4)
110
+  {
111
+#ifdef DEBUG
112
+    Serial.println("Low battery, going into deep sleep.");
113
+#endif
114
+    ESP.deepSleep(4294967295); // battery low, shutting down
115
+  }
116
+
109 117
   WiFi.mode(WIFI_OFF);
110 118
   WiFi.forceSleepBegin();
111 119
 

Loading…
Cancel
Save