Fix some logic in the health app

pull/2691/head
Kendell R 2023-04-13 09:02:29 -04:00 committed by GitHub
parent e9bfe885e7
commit cdb441d40f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 23 additions and 23 deletions

View File

@ -6,23 +6,23 @@
Bangle.setHRMPower(1, "health");
setTimeout(() => Bangle.setHRMPower(0, "health"), hrm * 60000); // give it 1 minute detection time for 3 min setting and 2 minutes for 10 min setting
if (hrm == 1) {
for (var i = 1; i <= 2; i++){
setTimeout(()=>{
function startMeasurement() {
Bangle.setHRMPower(1, "health");
setTimeout(() => {
Bangle.setHRMPower(0, "health");
}, 60000);
}, (i * 200000));
}
setTimeout(startMeasurement, 200000);
setTimeout(startMeasurement, 400000);
}
}
Bangle.on("health", onHealth);
Bangle.on('HRM', h => {
if (h.confidence>80) Bangle.setHRMPower(0, "health");
Bangle.on("HRM", (h) => {
if (h.confidence > 80 && Bangle.getHealthStatus().bpm == h.bpm) Bangle.setHRMPower(0, "health");
});
if (Bangle.getHealthStatus().bpmConfidence) return;
if (Bangle.getHealthStatus().bpmConfidence > 80) return;
onHealth();
} else Bangle.setHRMPower(hrm!=0, "health");
} else Bangle.setHRMPower(!!hrm, "health");
})();
Bangle.on("health", health => {