putting test in the HR calculationto stay compatible with the algo usage

This commit is contained in:
Pierre Bonneau
2024-03-23 14:37:08 +01:00
committed by GitHub
parent 19ebe73182
commit 8a15edd8fc

View File

@@ -104,10 +104,12 @@ public class SdAlgHr {
* Check heart rate value against simple thresholds
*/
boolean retVal = false;
if (mSimpleHrAlarmActive) {
if ((hrVal > mSimpleHrAlarmThreshMax)
|| (hrVal < mSimpleHrAlarmThreshMin)) {
retVal = true;
}
}
return (retVal);
}
@@ -145,6 +147,8 @@ public class SdAlgHr {
private boolean checkAdaptiveHr(double hrVal) {
boolean retVal;
retVal = false;
if (mAdaptiveHrAlarmActive) {
double hrThreshMin;
double hrThreshMax;
double avHr = getAdaptiveHrAverage();
@@ -159,12 +163,14 @@ public class SdAlgHr {
retVal = true;
}
Log.d(TAG, "checkAdaptiveHr() - hrVal=" + hrVal + ", avHr=" + avHr + ", thresholds=(" + hrThreshMin + ", " + hrThreshMax + "): Alarm=" + retVal);
}
return (retVal);
}
private boolean checkAverageHr(double hrVal) {
boolean retVal;
retVal = false;
if (mAverageHrAlarmActive) {
double avHr = getAverageHrAverage();
if (avHr < mAverageHrAlarmThreshMin) {
retVal = true;
@@ -173,6 +179,7 @@ public class SdAlgHr {
retVal = true;
}
Log.d(TAG, "checkAverageHr() - hrVal=" + hrVal + ", avHr=" + avHr + ", thresholds=(" + mAverageHrAlarmThreshMin + ", " + mAverageHrAlarmThreshMin + "): Alarm=" + retVal);
}
return (retVal);
}
@@ -189,15 +196,10 @@ public class SdAlgHr {
mAverageHrBuff.add(hrVal);
mHrHist.add(hrVal);
ArrayList<Boolean> retVal = new ArrayList<Boolean>();
if (mSimpleHrAlarmActive) {
retVal.add(checkSimpleHr(hrVal));
}
if (mAdaptiveHrAlarmActive) {
retVal.add(checkAdaptiveHr(hrVal));
}
if (mAverageHrAlarmActive) {
retVal.add(checkAverageHr(hrVal));
}
return (retVal);
}