From 2bcbfa3b34f2abb0092e9a2567bd33d1fa208a88 Mon Sep 17 00:00:00 2001 From: thyttan <6uuxstm66@mozmail.com⁩> Date: Tue, 5 Nov 2024 20:35:55 +0100 Subject: [PATCH 1/2] smpltmr: adapt to new setui btn -> btnRelease as to not fire unintentionally when long pressing the button to reset the watch. --- apps/smpltmr/ChangeLog | 3 ++- apps/smpltmr/app.js | 2 +- apps/smpltmr/metadata.json | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/smpltmr/ChangeLog b/apps/smpltmr/ChangeLog index c3f069428d..55c5fc4f6b 100644 --- a/apps/smpltmr/ChangeLog +++ b/apps/smpltmr/ChangeLog @@ -7,4 +7,5 @@ 0.07: Update clock_info to avoid a redraw 0.08: Timer ClockInfo now updates once a minute 0.09: Timer ClockInfo resets to timer menu when blurred -0.10: Timer ClockInfo now uses +- icons, and changes timer from 'T-5 min' to just '5 min' to aid readability \ No newline at end of file +0.10: Timer ClockInfo now uses +- icons, and changes timer from 'T-5 min' to just '5 min' to aid readability +0.11: Fix to handle updated firmware on fw 2v25 (or cutting edge >2v24.164), btn -> btnRelease. The timer would fire on long press before the watch reset. diff --git a/apps/smpltmr/app.js b/apps/smpltmr/app.js index 4e95d3a30f..a158e5380c 100644 --- a/apps/smpltmr/app.js +++ b/apps/smpltmr/app.js @@ -177,7 +177,7 @@ Bangle.setUI({ mode : "custom", touch : function(n,e) {onTouch(n,e);}, drag : function(e) {onDrag(e);}, - btn : function(n) {onButton();}, + btnRelease : function(n) {onButton();}, }); g.clearRect(Bangle.appRect); diff --git a/apps/smpltmr/metadata.json b/apps/smpltmr/metadata.json index 2f33f07b92..93205e3dff 100644 --- a/apps/smpltmr/metadata.json +++ b/apps/smpltmr/metadata.json @@ -2,7 +2,7 @@ "id": "smpltmr", "name": "Simple Timer", "shortName": "Simple Timer", - "version": "0.10", + "version": "0.11", "description": "A very simple app to start a timer.", "icon": "app.png", "tags": "tool,alarm,timer,clkinfo", From a3ecbe065715867fd8f76a09579ac3e392571999 Mon Sep 17 00:00:00 2001 From: thyttan <6uuxstm66@mozmail.com⁩> Date: Tue, 5 Nov 2024 22:48:06 +0100 Subject: [PATCH 2/2] smpltmr: btn listener backwards compatibility --- apps/smpltmr/app.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/smpltmr/app.js b/apps/smpltmr/app.js index a158e5380c..0ffacd966e 100644 --- a/apps/smpltmr/app.js +++ b/apps/smpltmr/app.js @@ -173,12 +173,15 @@ function updateLayoutField(layout, field, value) { Bangle.loadWidgets(); Bangle.drawWidgets(); -Bangle.setUI({ +let uiOptions = { mode : "custom", touch : function(n,e) {onTouch(n,e);}, drag : function(e) {onDrag(e);}, - btnRelease : function(n) {onButton();}, -}); +}; +if (parseFloat(process.env.VERSION.replace("v","")) < 224.164) {uiOptions.btn = function(n) {onButton();};} +else {uiOptions.btnRelease = function(n) {onButton();};} + +Bangle.setUI(uiOptions); g.clearRect(Bangle.appRect); if (timerRunning()) {