From 1963eea12c97b33d1a91c29e642b43f173e2dce4 Mon Sep 17 00:00:00 2001 From: deirdreobyrne Date: Thu, 22 Sep 2022 23:47:11 +0100 Subject: [PATCH] Bar across the middle of the screen colour The bar across the middle of the screen will now also indicate the battery state of charge. BUT NOTE that the "date_utils" library seems to be missing from my watch! --- apps/bigdclock/bigdclock.app.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/apps/bigdclock/bigdclock.app.js b/apps/bigdclock/bigdclock.app.js index a3691539b..b71a6b0a3 100644 --- a/apps/bigdclock/bigdclock.app.js +++ b/apps/bigdclock/bigdclock.app.js @@ -32,7 +32,7 @@ function draw() { // var dows = require("date_utils").dows(0,1); var dows = ["SU","MO","TU","WE","TH","FR","SA"]; - if (date.getTime() >= lastBattCheck + 15*60000) { + if ((date.getTime() >= lastBattCheck + 15*60000) || Bangle.isCharging()) { lastBattcheck = date.getTime(); width = E.getBattery(); width += width/2; @@ -74,7 +74,15 @@ function draw() { g.fillRect(12+width+1,162,162,168); } - g.setColor(0, 1, 0); + if (Bangle.isCharging()) { + g.setColor(1,1,0); + } else if (width <= 45) { + g.setColor(1,0,0); + } else if (width <= 60) { + g.setColor(1,1,0); + } else { + g.setColor(0, 1, 0); + } g.fillRect(0, 90, g.getWidth(), 94); // widget redraw