added a delay after the buzzer stops to prevent multi-rolling

pull/2623/head
Le~Kat 2023-02-25 12:27:24 -05:00
parent f9c338d90d
commit a89f6cb4df
3 changed files with 10 additions and 11 deletions

View File

@ -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

View File

@ -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);

View File

@ -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",