Skip to content

Commit

Permalink
Added logging of data time to raw HRM data logging so we can see if t…
Browse files Browse the repository at this point in the history
…he rate is varying
  • Loading branch information
jones139 committed Dec 23, 2023
1 parent 3c6d28b commit 187044f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
1 change: 1 addition & 0 deletions apps/hrrawexp/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
0.02: Fixes
0.03: updated to work with new API and additional features added such as longer recording time and additional filtered data
0.04: added support for bangle.js 2
0.05: Added time to output file, reallocated BTN1 to start timer.
21 changes: 11 additions & 10 deletions apps/hrrawexp/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function update_timer() {
g.flip();
}

function btn2Pressed() {
function increaseTimeValue() {
if (!logging_started) {
if (counter < 120)
counter += 15;
Expand All @@ -56,7 +56,7 @@ function btn2Pressed() {
}
}

function btn3Pressed() {
function decreaseTimeValue() {
if (!logging_started) {
if (counter > 15)
counter -= 15;
Expand All @@ -66,7 +66,7 @@ function btn3Pressed() {
}
}

function btn1Pressed() {
function startTimer() {
if (!logging_started) {
var filename = "";
var fileset = false;
Expand Down Expand Up @@ -127,31 +127,32 @@ var HRConfidence = 0;

update_timer();

setWatch(btn1Pressed, BTN1, { repeat: true });
setWatch(startTimer, BTN1, { repeat: true });
//setWatch(btn2Pressed, BTN2, { repeat: true });
//setWatch(btn3Pressed, BTN3, { repeat: true });

Bangle.on("swipe",function(directionLR, directionUD){
if (1==directionLR){
btn1Pressed();
increaseTimeValue();
}
else if (-1==directionUD || directionUD==1){
btn2Pressed();
startTimer();
}
else if(directionLR == -1){
btn3Pressed();
decreaseTimeValue();
}
});

Bangle.on('HRM-raw', function (hrm) {
value = hrm.raw;
filt = hrm.filt;
//var dataArray = [value,filt,HRVal,HRConfidence];
file.write(value + "," + filt + "\n");
file.write(getTime() + "," + value + "," + filt
+ "," + HRVal + "," + HRConfidence + "\n");
});
/*

Bangle.on('HRM', function (hrmB) {
HRVal = hrmB.bpm;
HRConfidence = hrmB.confidence;
});
*/

2 changes: 1 addition & 1 deletion apps/hrrawexp/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "hrrawexp",
"name": "HRM Data Exporter",
"shortName": "HRM Data Exporter",
"version": "0.04",
"version": "0.05",
"description": "export raw hrm signal data to a csv file",
"icon": "app-icon.png",
"tags": "",
Expand Down

0 comments on commit 187044f

Please sign in to comment.