From 607eb372802cc4b77bbb2516794e09452bce5715 Mon Sep 17 00:00:00 2001 From: deirdreobyrne Date: Tue, 2 Apr 2024 12:28:03 +0100 Subject: [PATCH] New bug in bigdclock.app.js The value of "width" was being reset somewhere. So "width" has been renamed to "batteryUsedWidth", which is better anyway. --- apps/bigdclock/bigdclock.app.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/apps/bigdclock/bigdclock.app.js b/apps/bigdclock/bigdclock.app.js index 3f8607495..0ebc33bed 100644 --- a/apps/bigdclock/bigdclock.app.js +++ b/apps/bigdclock/bigdclock.app.js @@ -12,7 +12,7 @@ Graphics.prototype.setFontOpenSans = function(scale) { var drawTimeout; var lastBattCheck = 0; -var width = 0; +var batteryUsedWidth = 0; function queueDraw(millis_now) { if (drawTimeout) clearTimeout(drawTimeout); @@ -32,8 +32,8 @@ function draw() { if ((date.getTime() >= lastBattCheck + 15*60000) || Bangle.isCharging()) { lastBattCheck = date.getTime(); - width = E.getBattery(); - width += width/2; + batteryUsedWidth = E.getBattery(); + batteryUsedWidth += batteryUsedWidth/2; } g.reset(); @@ -58,7 +58,7 @@ function draw() { g.fillRect(167,163,170,167); if (Bangle.isCharging()) { g.setColor(1,1,0); - g.fillRect(12,162,12+width,168); + g.fillRect(12,162,12+batteryUsedWidth,168); } else { g.setColor(1,0,0); g.fillRect(12,162,57,168); @@ -67,16 +67,16 @@ function draw() { g.setColor(0,1,0); g.fillRect(73,162,162,168); } - if (width < 150) { + if (batteryUsedWidth < 150) { g.setColor(g.theme.bg); - g.fillRect(12+width+1,162,162,168); + g.fillRect(12+batteryUsedWidth+1,162,162,168); } if (Bangle.isCharging()) { g.setColor(1,1,0); - } else if (width <= 45) { + } else if (batteryUsedWidth <= 45) { g.setColor(1,0,0); - } else if (width <= 60) { + } else if (batteryUsedWidth <= 60) { g.setColor(1,1,0); } else { g.setColor(0, 1, 0);