Fix draw define first

master^2
RKBoss6 2025-07-30 12:43:22 -04:00 committed by GitHub
parent 274b51853f
commit ffc8d201e3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 34 additions and 38 deletions

View File

@ -56,10 +56,7 @@
WIDGETS["widsmartbatt"] = { WIDGETS["widsmartbatt"] = {
area: "tr", area: "tr",
width: 30, width: 30,
draw: function() { draw: draw
// Call your drawing function
draw();
}
}; };
// Touch to temporarily show battery percent // Touch to temporarily show battery percent
@ -73,7 +70,6 @@
if (w.x - oversize <= x && x < w.x + width + oversize if (w.x - oversize <= x && x < w.x + width + oversize
&& w.y - oversize <= y && y < w.y + height + oversize) { && w.y - oversize <= y && y < w.y + height + oversize) {
E.stopEventPropagation && E.stopEventPropagation(); E.stopEventPropagation && E.stopEventPropagation();
Bangle.buzz(20);
showPercent = true; showPercent = true;
setTimeout(() => { setTimeout(() => {
showPercent = false; showPercent = false;
@ -87,7 +83,7 @@
Bangle.on('charging', function () { Bangle.on('charging', function () {
WIDGETS["widsmartbatt"].draw(); WIDGETS["widsmartbatt"].draw();
}); });
//draw once per minute...
var id = setInterval(() => WIDGETS["widsmartbatt"].draw(), 60000); var id = setInterval(() => WIDGETS["widsmartbatt"].draw(), 60000);