simpletimer: Fix buzz that doesn't stop (fix #521)
parent
9582c84708
commit
c4e62a3819
|
|
@ -1695,7 +1695,7 @@
|
||||||
"id": "simpletimer",
|
"id": "simpletimer",
|
||||||
"name": "Timer",
|
"name": "Timer",
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
"version": "0.04",
|
"version": "0.05",
|
||||||
"description": "Simple timer, useful when playing board games or cooking",
|
"description": "Simple timer, useful when playing board games or cooking",
|
||||||
"tags": "timer",
|
"tags": "timer",
|
||||||
"readme": "README.md",
|
"readme": "README.md",
|
||||||
|
|
|
||||||
|
|
@ -2,3 +2,4 @@
|
||||||
0.02: Reset with gesture
|
0.02: Reset with gesture
|
||||||
0.03: BTN2 to open launcher
|
0.03: BTN2 to open launcher
|
||||||
0.04: Remember last set time
|
0.04: Remember last set time
|
||||||
|
0.05: Fix buzz that doesn't stop (fix #521)
|
||||||
|
|
|
||||||
|
|
@ -84,10 +84,10 @@ const stateMap = {
|
||||||
startTimer();
|
startTimer();
|
||||||
},
|
},
|
||||||
started: () => {
|
started: () => {
|
||||||
reset(setValue);
|
resetTimer(setValue);
|
||||||
},
|
},
|
||||||
stopped: () => {
|
stopped: () => {
|
||||||
reset(setValue);
|
resetTimer(setValue);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -105,8 +105,9 @@ function drawLabels() {
|
||||||
g.drawString(`reset (re)start`, 230, 120);
|
g.drawString(`reset (re)start`, 230, 120);
|
||||||
}
|
}
|
||||||
|
|
||||||
function reset(value) {
|
function resetTimer(value) {
|
||||||
clearIntervals();
|
clearIntervals();
|
||||||
|
VIBRATE.reset(); // turn off vibration (clearIntervals stops the buzz turning off)
|
||||||
counter = value;
|
counter = value;
|
||||||
setValue = value;
|
setValue = value;
|
||||||
drawLabels();
|
drawLabels();
|
||||||
|
|
@ -133,7 +134,7 @@ function addWatch() {
|
||||||
);
|
);
|
||||||
setWatch(
|
setWatch(
|
||||||
() => {
|
() => {
|
||||||
reset(0);
|
resetTimer(0);
|
||||||
},
|
},
|
||||||
BTN3,
|
BTN3,
|
||||||
{
|
{
|
||||||
|
|
@ -160,8 +161,8 @@ function addWatch() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Bangle.on("aiGesture", gesture => {
|
Bangle.on("aiGesture", gesture => {
|
||||||
if (gesture === "swipeleft" && state === "stopped") reset(0);
|
if (gesture === "swipeleft" && state === "stopped") resetTimer(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
reset(saved.counter || 0);
|
resetTimer(saved.counter || 0);
|
||||||
addWatch();
|
addWatch();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue