simpletimer: Fix buzz regression from 0.06
parent
b8fdb2e5ef
commit
991cd17f00
|
|
@ -1736,7 +1736,7 @@
|
||||||
"id": "simpletimer",
|
"id": "simpletimer",
|
||||||
"name": "Timer",
|
"name": "Timer",
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
"version": "0.06",
|
"version": "0.07",
|
||||||
"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",
|
||||||
|
|
|
||||||
|
|
@ -4,3 +4,4 @@
|
||||||
0.04: Remember last set time
|
0.04: Remember last set time
|
||||||
0.05: Fix buzz that doesn't stop (fix #521)
|
0.05: Fix buzz that doesn't stop (fix #521)
|
||||||
0.06: Fix buzz error, remove '+' when timer running and add 'back' text (fix #577)
|
0.06: Fix buzz error, remove '+' when timer running and add 'back' text (fix #577)
|
||||||
|
0.07: Fix buzz regression from 0.06
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,19 @@
|
||||||
let counter = 0;
|
let counter = 0;
|
||||||
let setValue = 0;
|
let setValue = 0;
|
||||||
let counterInterval, alarmInterval;
|
let counterInterval, alarmInterval, buzzInterval;
|
||||||
let state;
|
let state;
|
||||||
let saved = require("Storage").readJSON("simpletimer.json",true) || {};
|
let saved = require("Storage").readJSON("simpletimer.json",true) || {};
|
||||||
|
|
||||||
const DEBOUNCE = 50;
|
const DEBOUNCE = 50;
|
||||||
|
|
||||||
function buzzAndBeep() {
|
function buzzAndBeep() {
|
||||||
|
buzzInterval = -1;
|
||||||
return Bangle.buzz(1000, 1)
|
return Bangle.buzz(1000, 1)
|
||||||
.then(() => Bangle.beep(200, 3000))
|
.then(() => Bangle.beep(200, 3000))
|
||||||
.then(() => setTimeout(buzzAndBeep, 5000));
|
.then(() => {
|
||||||
|
if (buzzInterval==-1)
|
||||||
|
buzzInterval = setTimeout(buzzAndBeep, 5000);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function outOfTime() {
|
function outOfTime() {
|
||||||
|
|
@ -58,8 +62,10 @@ function countDown() {
|
||||||
function clearIntervals() {
|
function clearIntervals() {
|
||||||
if (alarmInterval) clearInterval(alarmInterval);
|
if (alarmInterval) clearInterval(alarmInterval);
|
||||||
if (counterInterval) clearInterval(counterInterval);
|
if (counterInterval) clearInterval(counterInterval);
|
||||||
|
if (buzzInterval>0) clearTimeout(buzzInterval);
|
||||||
alarmInterval = undefined;
|
alarmInterval = undefined;
|
||||||
counterInterval = undefined;
|
counterInterval = undefined;
|
||||||
|
buzzInterval = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
function set(delta) {
|
function set(delta) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue