Battery Widget: Show battery percentage as text
parent
2c84fbd3ae
commit
09fc1f7d3e
|
|
@ -326,7 +326,7 @@
|
||||||
{ "id": "widbat",
|
{ "id": "widbat",
|
||||||
"name": "Battery Level Widget",
|
"name": "Battery Level Widget",
|
||||||
"icon": "widget.png",
|
"icon": "widget.png",
|
||||||
"version":"0.05",
|
"version":"0.06",
|
||||||
"description": "Show the current battery level and charging status in the top right of the clock",
|
"description": "Show the current battery level and charging status in the top right of the clock",
|
||||||
"tags": "widget,battery",
|
"tags": "widget,battery",
|
||||||
"type":"widget",
|
"type":"widget",
|
||||||
|
|
|
||||||
|
|
@ -2,3 +2,4 @@
|
||||||
0.03: Tweaks for variable size widget system
|
0.03: Tweaks for variable size widget system
|
||||||
0.04: Ensure redrawing works with variable size widget system
|
0.04: Ensure redrawing works with variable size widget system
|
||||||
0.05: Change color depending on battery level
|
0.05: Change color depending on battery level
|
||||||
|
0.06: Show battery percentage as text
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,15 @@ function draw() {
|
||||||
g.fillRect(x+s-3,y+10,x+s,y+14);
|
g.fillRect(x+s-3,y+10,x+s,y+14);
|
||||||
g.setColor(c).fillRect(x+4,y+6,x+4+l*(s-12)/100,y+17);
|
g.setColor(c).fillRect(x+4,y+6,x+4+l*(s-12)/100,y+17);
|
||||||
g.setColor(-1);
|
g.setColor(-1);
|
||||||
|
g.setFontAlign(-1,-1);
|
||||||
|
if (l >= 100) {
|
||||||
|
g.setFont('4x6', 2);
|
||||||
|
g.drawString(l, x + 6, y + 7);
|
||||||
|
} else {
|
||||||
|
if (l < 10) x+=6;
|
||||||
|
g.setFont('6x8', 2);
|
||||||
|
g.drawString(l, x + 6, y + 4);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Bangle.on('charging',function(charging) {
|
Bangle.on('charging',function(charging) {
|
||||||
if(charging) Bangle.buzz();
|
if(charging) Bangle.buzz();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue