forked from FOSS/BangleApps
made changes to when accelHandler gets overwritten, temporarily disabled button usage
parent
ef8b26c490
commit
64bff4303f
|
@ -16,3 +16,4 @@
|
|||
1.14: made the delay needlessly long to see if it even does anything
|
||||
1.15: moved accel & vibration commands to the accelHandler function
|
||||
1.16: enabled button usage & temporarily disabled acceleration
|
||||
1.17: made changes to when accelHandler gets overwritten, temporarily disabled button usage
|
||||
|
|
|
@ -81,22 +81,16 @@ 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.on ('accel', voidFn); // temporarily disable more acceleration events
|
||||
|
||||
Bangle.buzz(50, 0.5).then (() => {
|
||||
menu = false;
|
||||
rollDice (function() {
|
||||
|
||||
setTimeout (function() { // wait 50ms *after* the buzzing has stopped
|
||||
|
||||
Bangle.on ('accel', accelHandler);
|
||||
}, 50);
|
||||
Bangle.on ('accel', accelHandler); // re-enable acceleration events
|
||||
});
|
||||
}
|
||||
|
||||
Bangle.on ('accel', accelHandler); // re-enable acceleration events
|
||||
}
|
||||
|
||||
function voidFn() {
|
||||
|
@ -104,7 +98,7 @@ function voidFn() {
|
|||
return;
|
||||
}
|
||||
|
||||
function rollDice() {
|
||||
function rollDice (timeoutFunctionRef) {
|
||||
|
||||
resultsArr = new Uint8Array (8);
|
||||
for (i = 0; i < 8; i++) {
|
||||
|
@ -133,6 +127,16 @@ function rollDice() {
|
|||
g.drawString ((" " + resultsArr [i]).slice (-3), 96, 10 + 40 * (i - 4));
|
||||
}
|
||||
}
|
||||
|
||||
vibrate (timeoutFunctionRef);
|
||||
}
|
||||
|
||||
function vibrate (timeoutFunctionRef) {
|
||||
|
||||
Bangle.buzz(50, 0.5).then (() => {
|
||||
|
||||
setTimeout (timeoutFunctionRef, 50);
|
||||
});
|
||||
}
|
||||
|
||||
function random (max) {
|
||||
|
@ -142,17 +146,10 @@ function random (max) {
|
|||
|
||||
drawMenu();
|
||||
Bangle.on ('touch', touchHandler);
|
||||
//Bangle.on ('accel', accelHandler);
|
||||
setWatch (function() {
|
||||
Bangle.on ('accel', accelHandler);
|
||||
/*setWatch (function() {
|
||||
|
||||
menu = false;
|
||||
rollDice();
|
||||
|
||||
Bangle.buzz(50, 0.5).then (() => {
|
||||
|
||||
setTimeout (function() { // wait 50ms *after* the buzzing has stopped
|
||||
|
||||
//Bangle.on ('accel', accelHandler);
|
||||
}, 50);
|
||||
});
|
||||
}, BTN, {repeat: true, edge: "falling", debounce: 10});
|
||||
}, BTN, {repeat: true, edge: "falling", debounce: 10});*/
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{ "id": "multidice",
|
||||
"name": "multiple dice roller",
|
||||
"shortName":"multidice",
|
||||
"version":"1.16",
|
||||
"version":"1.17",
|
||||
"description": "roll anywhere from 1-8 dice at the same time",
|
||||
"icon": "app.png",
|
||||
"tags": "tool,game",
|
||||
|
|
Loading…
Reference in New Issue