formatting

pull/3071/head
James Steinberg 2023-11-02 03:33:11 -04:00
parent 660653858a
commit 43f9ccdca0
1 changed files with 22 additions and 18 deletions

View File

@ -61,6 +61,25 @@ function showPrompt(msg, buzzCount, alarm) {
}); });
} }
function buzz() {
Bangle.buzz(500).then(()=>{
setTimeout(()=>{
Bangle.buzz(500).then(function() {
setTimeout(()=>{
Bangle.buzz(2000).then(function() {
if (buzzCount--)
setTimeout(buzz, 2000);
else if(alarm.as) { // auto-snooze
buzzCount = 20;
setTimeout(buzz, 600000); // 10 minutes
}
});
},100);
});
},100);
});
}
function showAlarm(alarm) { function showAlarm(alarm) {
if ((require('Storage').readJSON('setting.json',1)||{}).quiet>1) return; // total silence if ((require('Storage').readJSON('setting.json',1)||{}).quiet>1) return; // total silence
var msg = formatTime(alarm.hr); var msg = formatTime(alarm.hr);
@ -96,27 +115,12 @@ function showAlarm(alarm) {
} }
}, BTN, {repeat: true, edge: 'rising'}); }, BTN, {repeat: true, edge: 'rising'});
function buzz() {
Bangle.buzz(500).then(()=>{
setTimeout(()=>{
Bangle.buzz(500).then(function() {
setTimeout(()=>{
Bangle.buzz(2000).then(function() {
if (buzzCount--)
setTimeout(buzz, 2000);
else if(alarm.as) { // auto-snooze
buzzCount = 20;
setTimeout(buzz, 600000); // 10 minutes
}
});
},100);
});
},100);
});
}
buzz(); buzz();
} }
// Check for alarms // Check for alarms
var day = (new Date()).getDate(); var day = (new Date()).getDate();
var hr = getCurrentHr()+10000; // get current time - 10s in future to ensure we alarm if we've started the app a tad early var hr = getCurrentHr()+10000; // get current time - 10s in future to ensure we alarm if we've started the app a tad early