Skip to content

Commit

Permalink
Added check of HRM measurement confidence before sending HRM data, ot…
Browse files Browse the repository at this point in the history
…herwise it sends the -1 fault value.
  • Loading branch information
jones139 committed Dec 17, 2023
1 parent ca633d4 commit 23b23da
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
15 changes: 15 additions & 0 deletions apps/openseizure/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,21 @@
E.showMenu(osdMenu);
}
},
'HR_CONF_THRESH': {
value: 0|settings.HR_CONF_THRESH, // 0| converts undefined to 0
min: 0,
max : 100,
step: 5,
format: x => {
return x + "%";
},
onchange: v => {
settings.HR_CONF_THRESH = v;
writeSettings();
E.showMenu(osdMenu);
}
},

};
E.showMenu(osdMenu);
}) //(load)
9 changes: 7 additions & 2 deletions apps/openseizure/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ const CHAR_HR_LOC = 0x2A38; // Official BLE Sensor Location UUID
function reload() {
settings = Object.assign({
ACC_FMT : 0,
TEST_MODE : false
TEST_MODE : false,
HR_CONF_THRESH : 60
}, require('Storage').readJSON('openseizure.json',1)||{});
saveSettings(settings);
}
Expand Down Expand Up @@ -209,7 +210,11 @@ function toByteArray(value, numberOfBytes, isSigned) {
// Initialise the HRM
Bangle.setHRMPower(1);
Bangle.on('HRM', function(hrm) {
hrVal = hrm['bpm'];
if (hrm.confidence > settings.HR_CONF_THRESH)
hrVal = hrm['bpm'];
else
hrVal = -1;
//hrVal = 100*hrm['confidence'] // FIXME - this is just for testing
});


Expand Down

0 comments on commit 23b23da

Please sign in to comment.