putting test in the HR calculationto stay compatible with the algo usage
This commit is contained in:
@@ -104,9 +104,11 @@ public class SdAlgHr {
|
|||||||
* Check heart rate value against simple thresholds
|
* Check heart rate value against simple thresholds
|
||||||
*/
|
*/
|
||||||
boolean retVal = false;
|
boolean retVal = false;
|
||||||
if ((hrVal > mSimpleHrAlarmThreshMax)
|
if (mSimpleHrAlarmActive) {
|
||||||
|| (hrVal < mSimpleHrAlarmThreshMin)) {
|
if ((hrVal > mSimpleHrAlarmThreshMax)
|
||||||
retVal = true;
|
|| (hrVal < mSimpleHrAlarmThreshMin)) {
|
||||||
|
retVal = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return (retVal);
|
return (retVal);
|
||||||
}
|
}
|
||||||
@@ -145,34 +147,39 @@ public class SdAlgHr {
|
|||||||
private boolean checkAdaptiveHr(double hrVal) {
|
private boolean checkAdaptiveHr(double hrVal) {
|
||||||
boolean retVal;
|
boolean retVal;
|
||||||
retVal = false;
|
retVal = false;
|
||||||
double hrThreshMin;
|
|
||||||
double hrThreshMax;
|
if (mAdaptiveHrAlarmActive) {
|
||||||
double avHr = getAdaptiveHrAverage();
|
double hrThreshMin;
|
||||||
hrThreshMin = avHr - mAdaptiveHrAlarmThresh;
|
double hrThreshMax;
|
||||||
hrThreshMax = avHr + mAdaptiveHrAlarmThresh;
|
double avHr = getAdaptiveHrAverage();
|
||||||
|
hrThreshMin = avHr - mAdaptiveHrAlarmThresh;
|
||||||
|
hrThreshMax = avHr + mAdaptiveHrAlarmThresh;
|
||||||
|
|
||||||
|
|
||||||
if (hrVal < hrThreshMin) {
|
if (hrVal < hrThreshMin) {
|
||||||
retVal = true;
|
retVal = true;
|
||||||
|
}
|
||||||
|
if (hrVal > hrThreshMax) {
|
||||||
|
retVal = true;
|
||||||
|
}
|
||||||
|
Log.d(TAG, "checkAdaptiveHr() - hrVal=" + hrVal + ", avHr=" + avHr + ", thresholds=(" + hrThreshMin + ", " + hrThreshMax + "): Alarm=" + retVal);
|
||||||
}
|
}
|
||||||
if (hrVal > hrThreshMax) {
|
|
||||||
retVal = true;
|
|
||||||
}
|
|
||||||
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;
|
||||||
retVal = false;
|
retVal = false;
|
||||||
double avHr = getAverageHrAverage();
|
if (mAverageHrAlarmActive) {
|
||||||
if (avHr < mAverageHrAlarmThreshMin) {
|
double avHr = getAverageHrAverage();
|
||||||
retVal = true;
|
if (avHr < mAverageHrAlarmThreshMin) {
|
||||||
|
retVal = true;
|
||||||
|
}
|
||||||
|
if (avHr > mAverageHrAlarmThreshMax) {
|
||||||
|
retVal = true;
|
||||||
|
}
|
||||||
|
Log.d(TAG, "checkAverageHr() - hrVal=" + hrVal + ", avHr=" + avHr + ", thresholds=(" + mAverageHrAlarmThreshMin + ", " + mAverageHrAlarmThreshMin + "): Alarm=" + retVal);
|
||||||
}
|
}
|
||||||
if (avHr > mAverageHrAlarmThreshMax) {
|
|
||||||
retVal = true;
|
|
||||||
}
|
|
||||||
Log.d(TAG, "checkAverageHr() - hrVal=" + hrVal + ", avHr=" + avHr + ", thresholds=(" + mAverageHrAlarmThreshMin + ", " + mAverageHrAlarmThreshMin + "): Alarm=" + retVal);
|
|
||||||
return (retVal);
|
return (retVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -189,15 +196,10 @@ 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>();
|
||||||
if (mSimpleHrAlarmActive) {
|
retVal.add(checkSimpleHr(hrVal));
|
||||||
retVal.add(checkSimpleHr(hrVal));
|
retVal.add(checkAdaptiveHr(hrVal));
|
||||||
}
|
retVal.add(checkAverageHr(hrVal));
|
||||||
if (mAdaptiveHrAlarmActive) {
|
|
||||||
retVal.add(checkAdaptiveHr(hrVal));
|
|
||||||
}
|
|
||||||
if (mAverageHrAlarmActive) {
|
|
||||||
retVal.add(checkAverageHr(hrVal));
|
|
||||||
}
|
|
||||||
return (retVal);
|
return (retVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user