forked from FOSS/BangleApps
moved accel & vibration commands to the accelHandler function
parent
47caa9cd79
commit
b3cc27a391
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Reference in New Issue