File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,7 @@ void showBatteryState();
6868void breathLEDAnimation ();
6969float getBatteryVoltage ();
7070int getBatteryPercentage ();
71+ void showLowBatteryWarning ();
7172void checkBattery ();
7273
7374void setup () {
@@ -271,6 +272,10 @@ void showBatteryState() {
271272 Serial.println (result);
272273 u8g2.sendBuffer ();
273274
275+ if (batteryPercentage < 20 ) {
276+ showLowBatteryWarning ();
277+ }
278+
274279 delay (100 );
275280}
276281
@@ -382,6 +387,16 @@ void checkBattery() {
382387 }
383388}
384389
390+ /* *
391+ * Blink LED to indicate that battery is low
392+ *
393+ */
394+ void showLowBatteryWarning () {
395+ tp.DotStar_SetPower (true );
396+ tp.DotStar_SetBrightness (5 );
397+ tp.DotStar_SetPixelColor (255 , 0 , 0 );
398+ }
399+
385400/* *
386401 * Update previousMillis' value to reset idle timer
387402 *
You can’t perform that action at this time.
0 commit comments