Parametrize the activation of each HR algo

Algo are not added when they are not activated
This commit is contained in:
Pierre Bonneau
2024-03-23 14:31:50 +01:00
committed by GitHub
parent a106f59462
commit 19ebe73182

View File

@@ -104,11 +104,9 @@ public class SdAlgHr {
* Check heart rate value against simple thresholds * Check heart rate value against simple thresholds
*/ */
boolean retVal = false; boolean retVal = false;
if (mSimpleHrAlarmActive) { if ((hrVal > mSimpleHrAlarmThreshMax)
if ((hrVal > mSimpleHrAlarmThreshMax) || (hrVal < mSimpleHrAlarmThreshMin)) {
|| (hrVal < mSimpleHrAlarmThreshMin)) { retVal = true;
retVal = true;
}
} }
return (retVal); return (retVal);
} }
@@ -146,13 +144,14 @@ public class SdAlgHr {
private boolean checkAdaptiveHr(double hrVal) { private boolean checkAdaptiveHr(double hrVal) {
boolean retVal; boolean retVal;
retVal = false;
double hrThreshMin; double hrThreshMin;
double hrThreshMax; double hrThreshMax;
double avHr = getAdaptiveHrAverage(); double avHr = getAdaptiveHrAverage();
hrThreshMin = avHr - mAdaptiveHrAlarmThresh; hrThreshMin = avHr - mAdaptiveHrAlarmThresh;
hrThreshMax = avHr + mAdaptiveHrAlarmThresh; hrThreshMax = avHr + mAdaptiveHrAlarmThresh;
retVal = false;
if (hrVal < hrThreshMin) { if (hrVal < hrThreshMin) {
retVal = true; retVal = true;
} }
@@ -160,15 +159,13 @@ public class SdAlgHr {
retVal = true; retVal = true;
} }
Log.d(TAG, "checkAdaptiveHr() - hrVal=" + hrVal + ", avHr=" + avHr + ", thresholds=(" + hrThreshMin + ", " + hrThreshMax + "): Alarm=" + retVal); Log.d(TAG, "checkAdaptiveHr() - hrVal=" + hrVal + ", avHr=" + avHr + ", thresholds=(" + hrThreshMin + ", " + hrThreshMax + "): Alarm=" + retVal);
return (retVal); return (retVal);
} }
private boolean checkAverageHr(double hrVal) { private boolean checkAverageHr(double hrVal) {
boolean retVal; boolean retVal;
double avHr = getAverageHrAverage();
retVal = false; retVal = false;
double avHr = getAverageHrAverage();
if (avHr < mAverageHrAlarmThreshMin) { if (avHr < mAverageHrAlarmThreshMin) {
retVal = true; retVal = true;
} }
@@ -192,9 +189,15 @@ public class SdAlgHr {
mAverageHrBuff.add(hrVal); mAverageHrBuff.add(hrVal);
mHrHist.add(hrVal); mHrHist.add(hrVal);
ArrayList<Boolean> retVal = new ArrayList<Boolean>(); ArrayList<Boolean> retVal = new ArrayList<Boolean>();
retVal.add(checkSimpleHr(hrVal)); if (mSimpleHrAlarmActive) {
retVal.add(checkAdaptiveHr(hrVal)); retVal.add(checkSimpleHr(hrVal));
retVal.add(checkAverageHr(hrVal)); }
if (mAdaptiveHrAlarmActive) {
retVal.add(checkAdaptiveHr(hrVal));
}
if (mAverageHrAlarmActive) {
retVal.add(checkAverageHr(hrVal));
}
return (retVal); return (retVal);
} }