diff --git a/apps.json b/apps.json index 0c8c86191..a0af1f7a3 100644 --- a/apps.json +++ b/apps.json @@ -1695,7 +1695,7 @@ "id": "simpletimer", "name": "Timer", "icon": "app.png", - "version": "0.04", + "version": "0.05", "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 b9a839e7d..e548d90fa 100644 --- a/apps/simpletimer/ChangeLog +++ b/apps/simpletimer/ChangeLog @@ -1,4 +1,5 @@ 0.01: Initial version 0.02: Reset with gesture 0.03: BTN2 to open launcher -0.04: Remember last set time \ No newline at end of file +0.04: Remember last set time +0.05: Fix buzz that doesn't stop (fix #521) diff --git a/apps/simpletimer/app.js b/apps/simpletimer/app.js index 041535998..75c118980 100644 --- a/apps/simpletimer/app.js +++ b/apps/simpletimer/app.js @@ -84,10 +84,10 @@ const stateMap = { startTimer(); }, started: () => { - reset(setValue); + resetTimer(setValue); }, stopped: () => { - reset(setValue); + resetTimer(setValue); } }; @@ -105,8 +105,9 @@ function drawLabels() { g.drawString(`reset (re)start`, 230, 120); } -function reset(value) { +function resetTimer(value) { clearIntervals(); + VIBRATE.reset(); // turn off vibration (clearIntervals stops the buzz turning off) counter = value; setValue = value; drawLabels(); @@ -133,7 +134,7 @@ function addWatch() { ); setWatch( () => { - reset(0); + resetTimer(0); }, BTN3, { @@ -160,8 +161,8 @@ function addWatch() { }); } Bangle.on("aiGesture", gesture => { - if (gesture === "swipeleft" && state === "stopped") reset(0); + if (gesture === "swipeleft" && state === "stopped") resetTimer(0); }); -reset(saved.counter || 0); +resetTimer(saved.counter || 0); addWatch();