diff --git a/apps.json b/apps.json index d60d81dd1..1d2c2ccd7 100644 --- a/apps.json +++ b/apps.json @@ -1736,7 +1736,7 @@ "id": "simpletimer", "name": "Timer", "icon": "app.png", - "version": "0.06", + "version": "0.07", "description": "Simple timer, useful when playing board games or cooking", "tags": "timer", "readme": "README.md", diff --git a/apps/simpletimer/ChangeLog b/apps/simpletimer/ChangeLog index 0a0d47126..f1f3a1ec0 100644 --- a/apps/simpletimer/ChangeLog +++ b/apps/simpletimer/ChangeLog @@ -4,3 +4,4 @@ 0.04: Remember last set time 0.05: Fix buzz that doesn't stop (fix #521) 0.06: Fix buzz error, remove '+' when timer running and add 'back' text (fix #577) +0.07: Fix buzz regression from 0.06 diff --git a/apps/simpletimer/app.js b/apps/simpletimer/app.js index f6332a8b7..e99761810 100644 --- a/apps/simpletimer/app.js +++ b/apps/simpletimer/app.js @@ -1,15 +1,19 @@ let counter = 0; let setValue = 0; -let counterInterval, alarmInterval; +let counterInterval, alarmInterval, buzzInterval; let state; let saved = require("Storage").readJSON("simpletimer.json",true) || {}; const DEBOUNCE = 50; function buzzAndBeep() { + buzzInterval = -1; return Bangle.buzz(1000, 1) .then(() => Bangle.beep(200, 3000)) - .then(() => setTimeout(buzzAndBeep, 5000)); + .then(() => { + if (buzzInterval==-1) + buzzInterval = setTimeout(buzzAndBeep, 5000); + }); } function outOfTime() { @@ -58,8 +62,10 @@ function countDown() { function clearIntervals() { if (alarmInterval) clearInterval(alarmInterval); if (counterInterval) clearInterval(counterInterval); + if (buzzInterval>0) clearTimeout(buzzInterval); alarmInterval = undefined; counterInterval = undefined; + buzzInterval = undefined; } function set(delta) {