From ab321e5e86130519e10189a2bcf0d18bde1a0ca0 Mon Sep 17 00:00:00 2001 From: Bzly Date: Mon, 4 May 2020 20:31:12 +0100 Subject: [PATCH 1/4] Remove display flash every interval Add variable to remember previous value of hidx, and check to see if it has changed before we redraw the watchface --- apps/impwclock/clock-impword.js | 51 ++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/apps/impwclock/clock-impword.js b/apps/impwclock/clock-impword.js index c54fa7976..ff4e24e2c 100644 --- a/apps/impwclock/clock-impword.js +++ b/apps/impwclock/clock-impword.js @@ -46,6 +46,8 @@ const passivColor = 0x3186 /*grey*/ ; const activeColorNight = 0xF800 /*red*/ ; const activeColorDay = 0xFFFF /* white */; +var hidxPrev; + function drawWordClock() { @@ -65,19 +67,6 @@ function drawWordClock() { g.setColor(passivColor); g.setFontAlign(0, -1, 0); - // draw allWords - var c; - var y = ys; - var x = xs; - allWords.forEach((line) => { - x = xs; - for (c in line) { - g.drawString(line[c], x, y); - x += dx; - } - y += dy; - }); - // Switch case isn't good for this in Js apparently so... if(h < 3){ @@ -125,24 +114,40 @@ function drawWordClock() { hidx = 10; } - // write hour in active color - g.setColor(activeColor); - timeOfDay[hidx][0].split('').forEach((c, pos) => { - x = xs + (timeOfDay[hidx][pos + 1] / 10 | 0) * dx; - y = ys + (timeOfDay[hidx][pos + 1] % 10) * dy; - g.drawString(c, x, y); - }); + // check whether we need to redraw the watchface + if (hidx !== hidxPrev) { + // draw allWords + var c; + var y = ys; + var x = xs; + allWords.forEach((line) => { + x = xs; + for (c in line) { + g.drawString(line[c], x, y); + x += dx; + } + y += dy; + }); + // write hour in active color + g.setColor(activeColor); + timeOfDay[hidx][0].split('').forEach((c, pos) => { + x = xs + (timeOfDay[hidx][pos + 1] / 10 | 0) * dx; + y = ys + (timeOfDay[hidx][pos + 1] % 10) * dy; + g.drawString(c, x, y); + }); + hidxPrev = hidx; + } // Display digital time while button 1 is pressed + g.clearRect(0, 215, 240, 240); if (BTN1.read()){ g.setColor(activeColor); - g.clearRect(0, 215, 240, 240); g.drawString(time, 120, 215); - } else { g.clearRect(0, 215, 240, 240); } - + } } + Bangle.on('lcdPower', function(on) { if (on) drawWordClock(); }); From c72bb4eb7477a10f0e86e65711de0274f3a203af Mon Sep 17 00:00:00 2001 From: Bzly Date: Mon, 4 May 2020 20:38:13 +0100 Subject: [PATCH 2/4] Create ChangeLog --- apps/impwclock/ChangeLog | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 apps/impwclock/ChangeLog diff --git a/apps/impwclock/ChangeLog b/apps/impwclock/ChangeLog new file mode 100644 index 000000000..7e099cad5 --- /dev/null +++ b/apps/impwclock/ChangeLog @@ -0,0 +1,2 @@ +0.01: New App! +0.02: Fixed watchface refresh every interval, even when no change From 7c7e995e5c3e5147a3e9d5ce251094244043b6f8 Mon Sep 17 00:00:00 2001 From: Bzly Date: Mon, 4 May 2020 20:42:20 +0100 Subject: [PATCH 3/4] Increment impwclock version number --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index b7eb41042..e36341b69 100644 --- a/apps.json +++ b/apps.json @@ -167,7 +167,7 @@ { "id": "impwclock", "name": "Imprecise Word Clock", "icon": "clock-impword.png", - "version":"0.01", + "version":"0.02", "description": "Imprecise word clock for vacations, weekends, and those who never need accurate time.", "tags": "clock", "type":"clock", From 3e29d6c5d9fcce4bb912c2fcf6b42642b7c7d086 Mon Sep 17 00:00:00 2001 From: Bzly Date: Mon, 4 May 2020 20:46:24 +0100 Subject: [PATCH 4/4] Clearer changelog message --- apps/impwclock/ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/impwclock/ChangeLog b/apps/impwclock/ChangeLog index 7e099cad5..c6974d37c 100644 --- a/apps/impwclock/ChangeLog +++ b/apps/impwclock/ChangeLog @@ -1,2 +1,2 @@ 0.01: New App! -0.02: Fixed watchface refresh every interval, even when no change +0.02: Stopped watchface from flashing every interval