moved accel & vibration commands to the accelHandler function

pull/2623/head
Le~Kat 2023-02-25 12:48:47 -05:00
parent 47caa9cd79
commit b3cc27a391
3 changed files with 13 additions and 13 deletions

View File

@ -14,3 +14,4 @@
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
1.14: made the delay needlessly long to see if it even does anything
1.15: moved accel & vibration commands to the accelHandler function

View File

@ -35,9 +35,6 @@ function touchHandler (button, xy) {
return;
}
rollDice();
return;
if (xy.x <= 87) { // left
if (xy.y <= 43) {
@ -84,11 +81,22 @@ function touchHandler (button, xy) {
function accelHandler (xyz) {
Bangle.on ('accel', voidFn); // temporarily disable more acceleration events
if (xyz.diff >= 0.3) {
menu = false;
rollDice();
Bangle.buzz(50, 0.5).then (() => {
setTimeout (function() { // wait 50ms *after* the buzzing has stopped
Bangle.on ('accel', accelHandler);
}, 50);
});
}
Bangle.on ('accel', accelHandler); // re-enable acceleration events
}
function voidFn() {
@ -125,15 +133,6 @@ function rollDice() {
g.drawString ((" " + resultsArr [i]).slice (-3), 96, 10 + 40 * (i - 4));
}
}
Bangle.on ('accel', voidFn);
Bangle.buzz(50, 0.5).then (() => {
setTimeout (function() { // wait 50ms *after* the buzzing has stopped
Bangle.on ('accel', accelHandler);
}, 1000);
});
}
function random (max) {

View File

@ -1,7 +1,7 @@
{ "id": "multidice",
"name": "multiple dice roller",
"shortName":"multidice",
"version":"1.14",
"version":"1.15",
"description": "roll anywhere from 1-8 dice at the same time",
"icon": "app.png",
"tags": "tool,game",