forked from FOSS/BangleApps
hwid batt: whitespace
parent
aabfb6b7db
commit
c765f38197
|
@ -21,30 +21,30 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
function draw() {
|
function draw() {
|
||||||
var s = width - 1;
|
var s = width - 1;
|
||||||
var x = this.x;
|
var x = this.x;
|
||||||
var y = this.y;
|
var y = this.y;
|
||||||
if (x !== undefined && y !== undefined) {
|
if (x !== undefined && y !== undefined) {
|
||||||
g.setBgColor(COLORS.white);
|
g.setBgColor(COLORS.white);
|
||||||
g.clearRect(old_x, old_y, old_x + width, old_y + height);
|
g.clearRect(old_x, old_y, old_x + width, old_y + height);
|
||||||
|
|
||||||
const l = E.getBattery(); // debug: Math.floor(Math.random() * 101);
|
const l = E.getBattery(); // debug: Math.floor(Math.random() * 101);
|
||||||
let xl = x+4+l*(s-12)/100;
|
let xl = x+4+l*(s-12)/100;
|
||||||
|
|
||||||
g.setColor(levelColor(l));
|
g.setColor(levelColor(l));
|
||||||
g.fillRect(x+4,y+14+3,xl,y+16+3); // charging bar
|
g.fillRect(x+4,y+14+3,xl,y+16+3); // charging bar
|
||||||
// Show percentage
|
// Show percentage
|
||||||
g.setColor(COLORS.black);
|
g.setColor(COLORS.black);
|
||||||
g.setFontAlign(0,0);
|
g.setFontAlign(0,0);
|
||||||
g.setFont('Vector',16);
|
g.setFont('Vector',16);
|
||||||
g.drawString(l, x + 14, y + 10);
|
g.drawString(l, x + 14, y + 10);
|
||||||
|
|
||||||
}
|
}
|
||||||
old_x = this.x;
|
old_x = this.x;
|
||||||
old_y = this.y;
|
old_y = this.y;
|
||||||
|
|
||||||
if (Bangle.isCharging()) changeInterval(id, intervalHigh);
|
if (Bangle.isCharging()) changeInterval(id, intervalHigh);
|
||||||
else changeInterval(id, intervalLow);
|
else changeInterval(id, intervalLow);
|
||||||
}
|
}
|
||||||
|
|
||||||
Bangle.on('charging',function(charging) { draw(); });
|
Bangle.on('charging',function(charging) { draw(); });
|
||||||
|
|
Loading…
Reference in New Issue