1
0
Fork 0

Bar across the middle of the screen colour

The bar across the middle of the screen will now also indicate the battery state of charge. BUT NOTE that the "date_utils" library seems to be missing from my watch!
master
deirdreobyrne 2022-09-22 23:47:11 +01:00
parent 91cfd487a3
commit 1963eea12c
1 changed files with 10 additions and 2 deletions

View File

@ -32,7 +32,7 @@ function draw() {
// var dows = require("date_utils").dows(0,1); // var dows = require("date_utils").dows(0,1);
var dows = ["SU","MO","TU","WE","TH","FR","SA"]; var dows = ["SU","MO","TU","WE","TH","FR","SA"];
if (date.getTime() >= lastBattCheck + 15*60000) { if ((date.getTime() >= lastBattCheck + 15*60000) || Bangle.isCharging()) {
lastBattcheck = date.getTime(); lastBattcheck = date.getTime();
width = E.getBattery(); width = E.getBattery();
width += width/2; width += width/2;
@ -74,7 +74,15 @@ function draw() {
g.fillRect(12+width+1,162,162,168); g.fillRect(12+width+1,162,162,168);
} }
g.setColor(0, 1, 0); if (Bangle.isCharging()) {
g.setColor(1,1,0);
} else if (width <= 45) {
g.setColor(1,0,0);
} else if (width <= 60) {
g.setColor(1,1,0);
} else {
g.setColor(0, 1, 0);
}
g.fillRect(0, 90, g.getWidth(), 94); g.fillRect(0, 90, g.getWidth(), 94);
// widget redraw // widget redraw