From e76535fece1bad8660c986c228f663f1faff0817 Mon Sep 17 00:00:00 2001 From: Brendan Hubble Date: Wed, 23 Mar 2022 18:44:01 +1100 Subject: [PATCH] touchtimer: ADD 5 second count down buzzer - This is a configurable option (Default is off) for the timer to buzz each second when there are 5 seconds left. --- apps/touchtimer/ChangeLog | 1 + apps/touchtimer/app.js | 8 ++++++++ apps/touchtimer/metadata.json | 2 +- apps/touchtimer/settings.js | 8 ++++++++ 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/apps/touchtimer/ChangeLog b/apps/touchtimer/ChangeLog index fbabe6cb7..0969a3da4 100644 --- a/apps/touchtimer/ChangeLog +++ b/apps/touchtimer/ChangeLog @@ -1,3 +1,4 @@ 0.01: Initial creation of the touch timer app 0.02: Add settings menu 0.03: Add ability to repeat last timer +0.04: Add 5 second count down buzzer diff --git a/apps/touchtimer/app.js b/apps/touchtimer/app.js index 61d3a08fd..c2f2fb5e9 100644 --- a/apps/touchtimer/app.js +++ b/apps/touchtimer/app.js @@ -126,6 +126,14 @@ var main = () => { timerIntervalId = setInterval(() => { timerCountDown.draw(); + // Buzz lightly when there are less then 5 seconds left + if (settings.countDownBuzz) { + var remainingSeconds = timerCountDown.getAdjustedTime().seconds; + if (remainingSeconds <= 5 && remainingSeconds > 0) { + Bangle.buzz(); + } + } + if (timerCountDown.isFinished()) { buttonStartPause.value = "FINISHED!"; buttonStartPause.draw(); diff --git a/apps/touchtimer/metadata.json b/apps/touchtimer/metadata.json index 50c5f03dd..0f2b9f491 100644 --- a/apps/touchtimer/metadata.json +++ b/apps/touchtimer/metadata.json @@ -2,7 +2,7 @@ "id": "touchtimer", "name": "Touch Timer", "shortName": "Touch Timer", - "version": "0.03", + "version": "0.04", "description": "Quickly and easily create a timer with touch-only input. The time can be easily set with a number pad.", "icon": "app.png", "tags": "tools", diff --git a/apps/touchtimer/settings.js b/apps/touchtimer/settings.js index 885670f57..79424f250 100644 --- a/apps/touchtimer/settings.js +++ b/apps/touchtimer/settings.js @@ -31,6 +31,14 @@ writeSettings(settings); }, }, + "CountDown Buzz": { + value: !!settings.countDownBuzz, + format: value => value?"On":"Off", + onchange: (value) => { + settings.countDownBuzz = value; + writeSettings(settings); + }, + }, "Pause Between": { value: settings.pauseBetween, min: 1,