Index: firmware/App/Controllers/BloodLeak.c =================================================================== diff -u -rfae38745527912b9b64e618096556ae7ff263cb8 -r100c3f3ae29e9956c399dfec2479fcffc2a330ec --- firmware/App/Controllers/BloodLeak.c (.../BloodLeak.c) (revision fae38745527912b9b64e618096556ae7ff263cb8) +++ firmware/App/Controllers/BloodLeak.c (.../BloodLeak.c) (revision 100c3f3ae29e9956c399dfec2479fcffc2a330ec) @@ -1852,6 +1852,14 @@ *************************************************************************/ static BOOL isLowerRangeIntensityDriftZeroingNeeded( void ) { + /* + * Nominal intensity = 930 + * Set point is queried from the blood leak detector + * Min drift from top = 930 - (setpoint * 40%) + * Max drift from top = 930 - (setpoint * 35%) + * If Min drift from top ≤ moving average intensity ≤ Max drift from top then the debounce timer is set + * If the debounce time has been elapsed the signal to zero the BLD is set + */ BOOL status = FALSE; BOOL isZeroingNeeded = TRUE; U32 setPoint = bloodLeakEmbModeCmd[ D_EMB_MODE_CMD ].commandResp; @@ -1866,11 +1874,13 @@ if ( FALSE == isZeroingNeeded ) { + // Intensity drift is not in range so reset the debounce timer bloodLeakZeroingStatus.driftInRangeStartTimeMS = getMSTimerCount(); } if ( ( TRUE == isZeroingAllowed ) && ( TRUE == didTimeout( bloodLeakZeroingStatus.driftInRangeStartTimeMS, BLD_ZERO_IN_RANGE_DRIFT_TIMEOUT_MS ) ) ) { + // If the moving average intensity is set and then the debounce time has elapsed the signal to zero is set to true. status = TRUE; }