|
28 | 28 | // -------------------- User Settable Variables --------------------
|
29 | 29 | int8_t hrpin = 0; //Whatever analog pin the sensor is hooked up to
|
30 | 30 | int8_t Verbose = 1; //Whether to report measures + description (1) or just measures (0); See docs.
|
31 |
| -int8_t report_hr = 1; //if 1, reports raw heart rate and peak threshold data as well, else set to 0 (default 0) |
| 31 | +int8_t report_hr = 0; //if 1, reports raw heart rate and peak threshold data as well, else set to 0 (default 0) |
32 | 32 | int8_t thresholding = 1; //Whether to use thresholding, can cause incorrect rejections in conditions of high variability
|
33 | 33 | float max_bpm = 180; //The max BPM to be expected, used in error detection (default 180)
|
34 | 34 | float min_bpm = 45; //The min BPM to be expected, used in error detection (default 45)
|
@@ -323,7 +323,7 @@ void validatePeak(struct workingDataContainer &workingData)
|
323 | 323 | {
|
324 | 324 | if(workingData.curRR < workingData.upper_threshold &&
|
325 | 325 | workingData.curRR > workingData.lower_threshold &&
|
326 |
| - abs(workingData.curRR - workingData.lastRR) < 500) |
| 326 | + abs(workingData.curRR - workingData.lastRR) < 600) |
327 | 327 | {
|
328 | 328 | updatePeak(workingData);
|
329 | 329 | } else {
|
@@ -368,7 +368,13 @@ void calcRRMeasures(struct workingDataContainer &workingData)
|
368 | 368 | //function to calculate RR differences and squared differences
|
369 | 369 | for(int i = 0; i < 19; i++)
|
370 | 370 | {
|
371 |
| - rrDiff = abs(workingData.recent_RR[i+1] - workingData.recent_RR[i]); |
| 371 | + int8_t pointer = workingData.RR_pos + i; |
| 372 | + int8_t pointerNext = workingData.RR_pos + i + 1; |
| 373 | + |
| 374 | + if(pointer >= 20) pointer = pointer - 20; |
| 375 | + if(pointerNext >= 20) pointerNext = pointerNext - 20; |
| 376 | + |
| 377 | + rrDiff = abs(workingData.recent_RR[pointerNext] - workingData.recent_RR[pointer]); |
372 | 378 | workingData.RRDiff[i] = rrDiff;
|
373 | 379 | workingData.RRSqDiff[i] = rrDiff * rrDiff;
|
374 | 380 | }
|
|
0 commit comments