Set BTN1 to enable heart monitor

master
Ephraim Amiel Yusi 2020-05-27 22:00:01 +10:00 committed by GitHub
parent c90fd28a56
commit 25b3dc7fa8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 4 deletions

View File

@ -113,14 +113,20 @@ Bangle.on('lcdPower',on=>{
// Show launcher when middle button pressed
setWatch(Bangle.showLauncher, BTN2, { repeat: false, edge: "falling" });
//HRM Controller.
Bangle.on('touch', function(button) {
if(button == 1 || button == 2){
if(!HRMstate){
Bangle.showLauncher();
}
});
//HRM Controller.
setWatch(function(){
if(!HRMstate){
console.log("Toggled HRM");
//Turn on.
Bangle.buzz();
Bangle.setHRMPower(1);
currentHRM = "CALC";
HRMstate = true;
} else if(HRMstate){
console.log("Toggled HRM");
@ -131,8 +137,7 @@ Bangle.on('touch', function(button) {
currentHRM = [];
}
drawBPM(HRMstate);
}
});
}, BTN1, { repeat: true, edge: "falling" });
Bangle.on('HRM', function(hrm) {
if(hrm.confidence > 90){
@ -143,6 +148,7 @@ Bangle.on('HRM', function(hrm) {
}
});
//Bangle.on('step', function(up) {
// console.log("Step");
//});