From a89f6cb4df1e74aa77fcc454ea69b923d6941c70 Mon Sep 17 00:00:00 2001 From: Le~Kat Date: Sat, 25 Feb 2023 12:27:24 -0500 Subject: [PATCH] added a delay after the buzzer stops to prevent multi-rolling --- apps/multidice/ChangeLog | 1 + apps/multidice/app.js | 18 ++++++++---------- apps/multidice/metadata.json | 2 +- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/apps/multidice/ChangeLog b/apps/multidice/ChangeLog index 29da3bf24..7eb5f605c 100644 --- a/apps/multidice/ChangeLog +++ b/apps/multidice/ChangeLog @@ -12,3 +12,4 @@ 1.10: not having web bluetooth to debug is a PAIN 1.11: decreased vibration time, decreased accel requirement 1.12: issue with app calling roll function too many times at startup +1.13: added a delay after the buzzer stops to prevent multi-rolling diff --git a/apps/multidice/app.js b/apps/multidice/app.js index 6295c7a9b..0d4b57a6c 100644 --- a/apps/multidice/app.js +++ b/apps/multidice/app.js @@ -126,7 +126,14 @@ function rollDice() { } } - vibrate(); + Bangle.on ('accel', voidFn); + Bangle.buzz(50, 0.5).then (() => { + + setTimeout (function() { // wait 50ms *after* the buzzing has stopped + + Bangle.on ('accel', accelHandler); + }, 50); + }); } function random (max) { @@ -134,15 +141,6 @@ function random (max) { return Math.round (Math.random() * (max - 1) + 1); } -function vibrate() { - - Bangle.on ('accel', voidFn); - Bangle.buzz(50, 0.5).then ((value) => { - - Bangle.on ('accel', accelHandler); - }); -} - drawMenu(); Bangle.on ('touch', touchHandler); Bangle.on ('accel', accelHandler); diff --git a/apps/multidice/metadata.json b/apps/multidice/metadata.json index 177b8a32a..a6cbf46b9 100644 --- a/apps/multidice/metadata.json +++ b/apps/multidice/metadata.json @@ -1,7 +1,7 @@ { "id": "multidice", "name": "multiple dice roller", "shortName":"multidice", - "version":"1.12", + "version":"1.13", "description": "roll anywhere from 1-8 dice at the same time", "icon": "app.png", "tags": "tool,game",