From 6c61c17d2b614c56cc20692484a498fc73b24a30 Mon Sep 17 00:00:00 2001 From: Amos Blanton Date: Sat, 11 Dec 2021 11:14:45 +0100 Subject: [PATCH 1/6] Copy offset and font size changes from wclock to handle Bangle.js 2 --- apps/impwclock/clock-impword.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/apps/impwclock/clock-impword.js b/apps/impwclock/clock-impword.js index 5492eac15..c9a7bfae3 100644 --- a/apps/impwclock/clock-impword.js +++ b/apps/impwclock/clock-impword.js @@ -34,14 +34,16 @@ const timeOfDay = { }; -// offsets and increments -const xs = 35; -const ys = 31; -const dy = 22; -const dx = 25; +var big = g.getWidth()>200; +// offsets and incerments +const xs = big ? 35 : 20; +const ys = big ? 31 : 28; +const dx = big ? 25 : 20; +const dy = big ? 22 : 16; + // font size and color -const fontSize = 3; // "6x8" +const fontSize = big ? 3 : 2; // "6x8" const passivColor = 0x3186 /*grey*/ ; const activeColorNight = 0xF800 /*red*/ ; const activeColorDay = 0xFFFF /* white */; From f4dbe714a43f06cf71e9ac71dd70ecda0e211b12 Mon Sep 17 00:00:00 2001 From: Amos Blanton Date: Sat, 11 Dec 2021 11:24:46 +0100 Subject: [PATCH 2/6] Impwclock support for Bangle.js2 --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index fd2e14e60..f88715659 100644 --- a/apps.json +++ b/apps.json @@ -538,7 +538,7 @@ "icon": "clock-impword.png", "type": "clock", "tags": "clock", - "supports": ["BANGLEJS"], + "supports": ["BANGLEJS","BANGLEJS2"], "screenshots": [{"url":"bangle1-impercise-word-clock-screenshot.png"}], "allow_emulator": true, "storage": [ From 3df8f688af48d9d137ccfb34fe949146d18c5873 Mon Sep 17 00:00:00 2001 From: Amos Blanton Date: Sat, 11 Dec 2021 11:30:36 +0100 Subject: [PATCH 3/6] Changes for BangleJs2 --- apps/impwclock/ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/impwclock/ChangeLog b/apps/impwclock/ChangeLog index 0592d4d04..7bc119426 100644 --- a/apps/impwclock/ChangeLog +++ b/apps/impwclock/ChangeLog @@ -1,3 +1,4 @@ 0.01: New App! 0.02: Stopped watchface from flashing every interval 0.03: Move to Bangle.setUI to launcher support +0.04: Tweaks for compatibility with BangleJS2 From 4862219a2fe9a600632d2de942423af26fa2542b Mon Sep 17 00:00:00 2001 From: Amos Blanton Date: Sat, 11 Dec 2021 12:53:55 +0100 Subject: [PATCH 4/6] Toggle digital time when BangleJS2 screen touched. --- apps/impwclock/clock-impword.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/apps/impwclock/clock-impword.js b/apps/impwclock/clock-impword.js index c9a7bfae3..111728891 100644 --- a/apps/impwclock/clock-impword.js +++ b/apps/impwclock/clock-impword.js @@ -2,7 +2,7 @@ A remix of word clock by Gordon Williams https://github.com/gfwilliams - Changes the representation of time to be more general -- Shows accurate digital time when button 1 is pressed +- Shows accurate digital time when button 1 is pressed or */ /* jshint esversion: 6 */ @@ -35,7 +35,7 @@ const timeOfDay = { var big = g.getWidth()>200; -// offsets and incerments +// offsets and increments const xs = big ? 35 : 20; const ys = big ? 31 : 28; const dx = big ? 25 : 20; @@ -140,15 +140,14 @@ function drawWordClock() { hidxPrev = hidx; } - // Display digital time while button 1 is pressed - g.clearRect(0, 215, 240, 240); + // Display digital time when button is pressed or screen touched + g.clearRect(0, big ? 215 : 160, big ? 240 : 176, big ? 240 : 176); if (showDigitalTime){ g.setColor(activeColor); - g.drawString(time, 120, 215); + g.drawString(time, big ? 120 : 90, big ? 215 : 160); } } - Bangle.on('lcdPower', function(on) { if (on) drawWordClock(); }); @@ -166,10 +165,13 @@ if (global.BTN3) setWatch(function() { }, BTN1, {repeat:true,edge:"both"}); // If LCD pressed (on Bangle.js 2) draw digital time -Bangle.on('drag',e=>{ +Bangle.on('touch',e=>{ var pressed = e.b!=0; - if (pressed!=showDigitalTime) { - showDigitalTime = pressed; + if (showDigitalTime){ + showDigitalTime = false; + drawWordClock(); + } else { + showDigitalTime = true; drawWordClock(); } }); From dc84156055b81be1c403e9cea6e7f49d8efaa1ad Mon Sep 17 00:00:00 2001 From: Amos Blanton Date: Sat, 11 Dec 2021 13:03:21 +0100 Subject: [PATCH 5/6] Change to handling of digital time display Remove code for BangleJS physical button. Replace with code to toggle display of accurate time based on screen touch that works for both BangleJS and BangleJS2 Stop displaying accurate digital time when new imprecise era begins. --- apps/impwclock/clock-impword.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/apps/impwclock/clock-impword.js b/apps/impwclock/clock-impword.js index 111728891..8bb5da6ba 100644 --- a/apps/impwclock/clock-impword.js +++ b/apps/impwclock/clock-impword.js @@ -2,7 +2,7 @@ A remix of word clock by Gordon Williams https://github.com/gfwilliams - Changes the representation of time to be more general -- Shows accurate digital time when button 1 is pressed or +- Toggles showing of accurate digital time when screen touched. */ /* jshint esversion: 6 */ @@ -117,6 +117,8 @@ function drawWordClock() { // check whether we need to redraw the watchface if (hidx !== hidxPrev) { + // Turn off showDigitalTime + showDigitalTime = false; // draw allWords var c; var y = ys; @@ -158,15 +160,9 @@ Bangle.drawWidgets(); setInterval(drawWordClock, 1E4); drawWordClock(); -// Show digital time while top button is pressed (if we have physical buttons) -if (global.BTN3) setWatch(function() { - showDigitalTime = BTN1.read(); - drawWordClock(); -}, BTN1, {repeat:true,edge:"both"}); -// If LCD pressed (on Bangle.js 2) draw digital time +// If LCD pressed, toggle drawing digital time Bangle.on('touch',e=>{ - var pressed = e.b!=0; if (showDigitalTime){ showDigitalTime = false; drawWordClock(); From 159ba0cece7d3b3504b5ca3fefdcb8d776562881 Mon Sep 17 00:00:00 2001 From: Amos Blanton Date: Sat, 11 Dec 2021 21:03:22 +0100 Subject: [PATCH 6/6] Touch screen instead of button. --- apps/impwclock/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/impwclock/README.md b/apps/impwclock/README.md index 30e42c95e..ac1341097 100644 --- a/apps/impwclock/README.md +++ b/apps/impwclock/README.md @@ -1,4 +1,4 @@ # Imprecise Word Clock -This clock tells time in very rough approximation, as in "Late morning" or "Early afternoon." Good for vacations and weekends. Press button 1 to see the time in accurate, digital form. But do you really need to know the exact time? +This clock tells time in very rough approximation, as in "Late morning" or "Early afternoon." Good for vacations and weekends. Touch the screen to see the time in accurate, digital form. But do you really need to know the exact time?