sleepphasealarm

replace setInterval with .on('accel')
master
Erik Andresen 2022-04-15 20:45:48 +02:00
parent 614d73adda
commit ca74fdf501
1 changed files with 3 additions and 3 deletions

View File

@ -125,9 +125,9 @@ if (nextAlarm !== undefined) {
// minimum alert 30 minutes early // minimum alert 30 minutes early
minAlarm.setTime(nextAlarm.getTime() - (30*60*1000)); minAlarm.setTime(nextAlarm.getTime() - (30*60*1000));
setInterval(function() { Bangle.on('accel', (accelData) => { // 12.5Hz
const now = new Date(); const now = new Date();
const acc = Bangle.getAccel().mag; const acc = accelData.mag;
const swest = calc_ess(acc); const swest = calc_ess(acc);
if (swest !== undefined) { if (swest !== undefined) {
@ -143,7 +143,7 @@ if (nextAlarm !== undefined) {
buzz(); buzz();
measure = false; measure = false;
} }
}, 80); // 12.5Hz });
drawApp(); drawApp();
} else { } else {
E.showMessage('No Alarm'); E.showMessage('No Alarm');