mirror of https://github.com/espruino/BangleApps
Optimized Battery display
parent
3d6cba0925
commit
0da99ce3ff
|
@ -73,6 +73,10 @@ function drawBattery() {
|
||||||
g.setColor(c).fillRect(46, 58 + 80 + yOffset + 37, xl, height - 5);
|
g.setColor(c).fillRect(46, 58 + 80 + yOffset + 37, xl, height - 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateCounter() {
|
||||||
|
drawBattery();
|
||||||
|
drawCounterText();
|
||||||
|
}
|
||||||
|
|
||||||
function drawClock() {
|
function drawClock() {
|
||||||
// main frame
|
// main frame
|
||||||
|
@ -89,7 +93,7 @@ function drawClock() {
|
||||||
Arwes.drawFrameNoCorners(44, 58 + 80 + yOffset + 35, 196, height - 3);
|
Arwes.drawFrameNoCorners(44, 58 + 80 + yOffset + 35, 196, height - 3);
|
||||||
|
|
||||||
|
|
||||||
drawBattery();
|
updateCounter()
|
||||||
updateClock();
|
updateClock();
|
||||||
|
|
||||||
// const img = makeImg();
|
// const img = makeImg();
|
||||||
|
@ -101,7 +105,7 @@ function updateClock() {
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
drawTimeText(date);
|
drawTimeText(date);
|
||||||
drawDateText(date);
|
drawDateText(date);
|
||||||
drawCounterText();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -131,6 +135,6 @@ setWatch(Bangle.showLauncher, BTN2, {repeat: false, edge: "falling"});
|
||||||
|
|
||||||
// refesh every 100 milliseconds
|
// refesh every 100 milliseconds
|
||||||
setInterval(updateClock, 500);
|
setInterval(updateClock, 500);
|
||||||
setInterval(drawBattery, 1000);
|
setInterval(updateCounter, 1000);
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue