forked from FOSS/BangleApps
Merge pull request #2849 from bobrippling/chime-delay
chimer: sleep between buzzes, instead of duringmaster
commit
23c3ffc8f0
|
@ -1,3 +1,4 @@
|
||||||
0.01: Initial Creation
|
0.01: Initial Creation
|
||||||
0.02: Fixed some sleep bugs. Added a sleep mode toggle
|
0.02: Fixed some sleep bugs. Added a sleep mode toggle
|
||||||
0.03: Reduce busy-loop and code
|
0.03: Reduce busy-loop and code
|
||||||
|
0.04: Separate buzz-time and sleep-time
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "chimer",
|
"id": "chimer",
|
||||||
"name": "Chimer",
|
"name": "Chimer",
|
||||||
"version": "0.03",
|
"version": "0.04",
|
||||||
"description": "A fork of Hour Chime that adds extra features such as: \n - Buzz or beep on every 60, 30 or 15 minutes. \n - Repeat Chime up to 3 times \n - Set hours to disable chime",
|
"description": "A fork of Hour Chime that adds extra features such as: \n - Buzz or beep on every 60, 30 or 15 minutes. \n - Repeat Chime up to 3 times \n - Set hours to disable chime",
|
||||||
"icon": "widget.png",
|
"icon": "widget.png",
|
||||||
"type": "widget",
|
"type": "widget",
|
||||||
|
|
|
@ -20,15 +20,16 @@
|
||||||
let count = settings.repeat;
|
let count = settings.repeat;
|
||||||
|
|
||||||
const chime1 = () => {
|
const chime1 = () => {
|
||||||
|
let p;
|
||||||
if (settings.type === 1) {
|
if (settings.type === 1) {
|
||||||
Bangle.buzz(100);
|
p = Bangle.buzz(100);
|
||||||
} else if (settings.type === 2) {
|
} else if (settings.type === 2) {
|
||||||
Bangle.beep();
|
p = Bangle.beep();
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (--count > 0)
|
if (--count > 0)
|
||||||
setTimeout(chime1, 150);
|
p.then(() => setTimeout(chime1, 150));
|
||||||
};
|
};
|
||||||
|
|
||||||
chime1();
|
chime1();
|
||||||
|
|
Loading…
Reference in New Issue