Skip to content

Commit 6a2195e

Browse files
committed
Allow Postcard to exit power down state if charging is detected.
1 parent ddd54d5 commit 6a2195e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Firmware/RTK_Everywhere/Buttons.ino

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,17 @@ void powerDown(bool displayInfo)
6666

6767
while (1)
6868
{
69-
// We should never get here but good to know if we do
69+
// Platforms with power control won't get here
70+
// Postcard will get here if the battery is too low
71+
7072
systemPrintln("Device powered down");
7173
delay(5000);
74+
75+
checkBatteryLevels(); // Force check so you see battery level immediately at power on
76+
77+
// Restart if charging has gotten us high enough
78+
if (batteryLevelPercent > 5 && batteryChargingPercentPerHour > 0.5)
79+
ESP.restart();
7280
}
7381
}
7482

0 commit comments

Comments
 (0)