mirror of https://github.com/espruino/BangleApps
Widbata: battery level status using clocks colour theme
parent
b595e60333
commit
34f73b85da
|
@ -0,0 +1 @@
|
||||||
|
0.01: Created
|
|
@ -0,0 +1,13 @@
|
||||||
|
# Battery Level Widget (Again)
|
||||||
|
|
||||||
|
Show the current battery level status in the top right using the clocks colour theme
|
||||||
|
|
||||||
|
* Works with Bangle 2
|
||||||
|
* Simple design, no settings
|
||||||
|
* 27 pixels wide
|
||||||
|
|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|
|
||||||
|
Written by: [Hugh Barney](https://github.com/hughbarney) For support and discussion please post in the [Bangle JS Forum](http://forum.espruino.com/microcosms/1424/)
|
Binary file not shown.
After Width: | Height: | Size: 2.4 KiB |
Binary file not shown.
After Width: | Height: | Size: 5.8 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.4 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
|
@ -0,0 +1,16 @@
|
||||||
|
setInterval(()=>WIDGETS["bat"].draw(), 60000);
|
||||||
|
Bangle.on('lcdPower', function(on) {
|
||||||
|
if (on) WIDGETS["bat"].draw();
|
||||||
|
});
|
||||||
|
WIDGETS["bat"]={area:"tr",width:27,draw:function() {
|
||||||
|
var s = 26;
|
||||||
|
var t = 13; // thickness
|
||||||
|
var x = this.x, y = this.y;
|
||||||
|
g.reset();
|
||||||
|
g.setColor(g.theme.fg);
|
||||||
|
g.fillRect(x,y+2,x+s-4,y+2+t); // outer
|
||||||
|
g.clearRect(x+2,y+2+2,x+s-4-2,y+2+t-2); // centre
|
||||||
|
g.setColor(g.theme.fg);
|
||||||
|
g.fillRect(x+s-3,y+2+(((t - 1)/2)-1),x+s-2,y+2+(((t - 1)/2)-1)+4); // contact
|
||||||
|
g.fillRect(x+3, y+5, x +4 + E.getBattery()*(s-12)/100, y+t-1); // the level
|
||||||
|
}};
|
Loading…
Reference in New Issue