forked from FOSS/BangleApps
moved accel & vibration commands to the accelHandler function
parent
f85c17814c
commit
e6e2d622fb
|
@ -14,3 +14,4 @@
|
||||||
1.12: issue with app calling roll function too many times at startup
|
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.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.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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
rollDice();
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (xy.x <= 87) { // left
|
if (xy.x <= 87) { // left
|
||||||
|
|
||||||
if (xy.y <= 43) {
|
if (xy.y <= 43) {
|
||||||
|
@ -84,11 +81,22 @@ function touchHandler (button, xy) {
|
||||||
|
|
||||||
function accelHandler (xyz) {
|
function accelHandler (xyz) {
|
||||||
|
|
||||||
|
Bangle.on ('accel', voidFn); // temporarily disable more acceleration events
|
||||||
if (xyz.diff >= 0.3) {
|
if (xyz.diff >= 0.3) {
|
||||||
|
|
||||||
menu = false;
|
menu = false;
|
||||||
rollDice();
|
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() {
|
function voidFn() {
|
||||||
|
@ -125,15 +133,6 @@ function rollDice() {
|
||||||
g.drawString ((" " + resultsArr [i]).slice (-3), 96, 10 + 40 * (i - 4));
|
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) {
|
function random (max) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{ "id": "multidice",
|
{ "id": "multidice",
|
||||||
"name": "multiple dice roller",
|
"name": "multiple dice roller",
|
||||||
"shortName":"multidice",
|
"shortName":"multidice",
|
||||||
"version":"1.14",
|
"version":"1.15",
|
||||||
"description": "roll anywhere from 1-8 dice at the same time",
|
"description": "roll anywhere from 1-8 dice at the same time",
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
"tags": "tool,game",
|
"tags": "tool,game",
|
||||||
|
|
Loading…
Reference in New Issue