From 6d965dd016e19fb56e06d3db0c99bc07067962e5 Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Tue, 10 Mar 2026 16:22:18 -0600 Subject: [PATCH] feat: Add timed buzzing alerts to stopwatches Co-authored-by: aider (gemini/gemini-2.5-pro) --- antonclk/antonclk.app.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/antonclk/antonclk.app.js b/antonclk/antonclk.app.js index 4415e42..4da3f41 100644 --- a/antonclk/antonclk.app.js +++ b/antonclk/antonclk.app.js @@ -11,7 +11,7 @@ let watchState = STATE_IDLE; - let stopWatch = require("Storage").readJSON("mystopwatch.json", true) || {start1: null, elapsed1: null, start2: null, elapsed2: null}; + let stopWatch = require("Storage").readJSON("mystopwatch.json", true) || {start1: null, elapsed1: null, buzz1: null, start2: null, elapsed2: null, buzzed2: null}; let saveStopWatch = function() { require("Storage").writeJSON("mystopwatch.json", stopWatch); } @@ -37,6 +37,14 @@ let Tt1 = (stopWatch.elapsed1 || 0); if (stopWatch.start1) { Tt1 += Date.now() - stopWatch.start1; + + const fifteenMinutes = 15 * 60 * 1000; + let intervals = Math.floor(Tt1 / fifteenMinutes); + if (intervals > (stopWatch.buzz1 || 0)) { + stopWatch.buzz1 = intervals; + Bangle.buzz(); + saveStopWatch(); + } } let Ttxt1 = timeToText(Tt1); @@ -49,6 +57,13 @@ let Tt2 = (stopWatch.elapsed2 || 0); if (stopWatch.start2) { Tt2 += Date.now() - stopWatch.start2; + + const oneMinute = 60 * 1000; + if (!stopWatch.buzzed2 && Tt2 >= oneMinute) { + stopWatch.buzzed2 = true; + Bangle.buzz(); + saveStopWatch(); + } } let Ttxt2 = timeToText(Tt2); @@ -233,6 +248,7 @@ let stopSW1 = function() { stopWatch.start1 = null; stopWatch.elapsed1 = null; + stopWatch.buzz1 = null; saveStopWatch(); if (!stopWatch.start2) { @@ -260,6 +276,7 @@ let stopSW2 = function() { stopWatch.start2 = null; stopWatch.elapsed2 = null; + stopWatch.buzzed2 = null; saveStopWatch(); if (!stopWatch.start1) {