Turn on HRM when screen is on and unlocked

pull/1045/head
Marco H 2021-12-09 14:53:51 +01:00 committed by GitHub
parent 7b09fd9b4f
commit 5903aed3e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 1 deletions

View File

@ -104,9 +104,11 @@ function drawInfo(now) {
}
function drawHeartRate(i) {
writeLineTopic("HRTM", i);
if (hrtValue != undefined) {
writeLineTopic("HRTM", i);
writeLine(hrtValue,i);
} else {
writeLine("-",i);
}
lastHeartRateRowIndex = i;
}
@ -129,6 +131,15 @@ function writeLine(str,line){
}
// turn on HRM when the LCD is unlocked
Bangle.on('lock', function(isLocked) {
if (!isLocked) {
Bangle.setHRMPower(1,"clicompleteclk");
hrtValue = undefined;
} else {
Bangle.setHRMPower(0,"clicompleteclk");
}
});
Bangle.on('HRM', function(hrm) {
//if(hrm.confidence > 90){
hrtValue = hrm.bpm + " bpm";
@ -173,6 +184,7 @@ Bangle.setUI("clock");
Bangle.loadWidgets();
Bangle.drawWidgets();
drawAll(true);
Bangle.on('lcdPower',function(on) {
if (on) {
drawAll(true);