Skip to content

Commit

Permalink
Show charging
Browse files Browse the repository at this point in the history
  • Loading branch information
hiddewie committed May 11, 2022
1 parent 01a303b commit 5591228
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion source/Battery.mc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ class Battery extends Toybox.WatchUi.Drawable {
return;
}

var battery = System.getSystemStats().battery / 100.0;
var stats = System.getSystemStats();
var battery = stats.battery / 100.0;
var charging = stats.charging;

var color = Graphics.COLOR_GREEN;
if (battery <= lowBatteryLevel) {
Expand All @@ -37,6 +39,9 @@ class Battery extends Toybox.WatchUi.Drawable {
if (battery <= criticalBatteryLevel) {
color = Graphics.COLOR_RED;
}
if (charging) {
color = Graphics.COLOR_BLUE;
}

var drawWidth = 4 + battery * (width - 8);

Expand Down

0 comments on commit 5591228

Please # to comment.