From a1e6bae39fd457fd526a3c0bfa3ee56503f14bf0 Mon Sep 17 00:00:00 2001 From: Spencer Churchill Date: Thu, 22 Sep 2022 15:29:59 -0700 Subject: [PATCH] only vibrate during work hours --- apps/widtwenties/widget.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/apps/widtwenties/widget.js b/apps/widtwenties/widget.js index 58bc622eb..745e50391 100644 --- a/apps/widtwenties/widget.js +++ b/apps/widtwenties/widget.js @@ -7,9 +7,13 @@ they don't interfere with currently-running apps */ const look = 20 * 1000; // 20 seconds buzz = _ => { - Bangle.buzz().then(_ => { - setTimeout(Bangle.buzz, look); - }); + const d = new Date(); + // run from 8 AM - 5 PM + if (d >= 8 && d <= 17) { + Bangle.buzz().then(_ => { + setTimeout(Bangle.buzz, look); + }); + } }; // add widget @@ -21,4 +25,4 @@ they don't interfere with currently-running apps */ setInterval(WIDGETS.twenties.buzz, move); // buzz to stand / sit })(); -// Bangle.drawWidgets(); // <-- for development only \ No newline at end of file +// Bangle.drawWidgets(); // <-- for development only