Index: firmware/App/Controllers/BalancingChamber.c =================================================================== diff -u -r9e2f3b1c47e1f97c9bad76071f8620082957aded -r62995983a0117ced0f5eb766e06f381ab3f78018 --- firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision 9e2f3b1c47e1f97c9bad76071f8620082957aded) +++ firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision 62995983a0117ced0f5eb766e06f381ab3f78018) @@ -50,7 +50,6 @@ #define QD_THRESHOLD_LOW_MLPM 200.0F ///< Qd threshold (mL/min) below which low pressure limit applies. #define QD_THRESHOLD_HIGH_MLPM 400.0F ///< Qd threshold (mL/min) below which mid pressure limit applies. #define SPENT_DIFF_COUNT_ZERO 0 ///< Zero count difference for spent side fill comparing target count -#define SPENT_DIFF_COUNT_DEADBAND 1 ///< Stop changing D48 pump speed when fill difference reaches close to target count #define D48_SPEED_ADJUST_FACTOR 0.5F ///< D48 speed adjustment factor ( 50% of speed adjustment = 0.5) #define D48_SPEED_RANGE_LIMIT 0.25F ///< D48 speed adjustment range check limit ( D48 speed can vary +/-25% of initial calculated speed) #define BICARB_CHAMBER_PERIODIC_FILL_TIME ( 1 * SEC_PER_MIN * ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ) ///< Periodic bicarb chamber fill request 60 sec x 20 = 1200 @@ -85,8 +84,6 @@ static F32 lastTdDialysateFlowrate; ///< Previous TD dialysate flow rate static F32 freshDialPressure; ///< Fresh side dialysate pressure static F32 spentDialPressure; ///< Spent side dialysate pressure -static F32 prevSpentDialPressure; ///< Previous spent side dialysate pressure -static F32 lastPrevSpentDialPressure; ///< Last previous spent side dialysate pressure static U32 currentBalChamberFillCounter; ///< Counter (in task interval) to monitor the timing spent for the spent side fill operation. static U32 balChamberFillTimeoutCount; ///< Timeout count (in task interval) to detect BC fill timeout. static S32 diffSpentFillCompleteCount; ///< Difference between spent target fill to actual fill count @@ -148,8 +145,6 @@ isPressureDroppedDuringFill = FALSE; freshDialPressure = 0.0F; spentDialPressure = 0.0F; - prevSpentDialPressure = 0.0F; - lastPrevSpentDialPressure = 0.0F; currentBalChamberFillCounter = 0; balChamberFillTimeoutCount = 0; diffSpentFillCompleteCount = 0; @@ -461,8 +456,6 @@ isPressureStabilizedDuringFill = FALSE; isPressureDroppedDuringFill = FALSE; isSpentFillComplete = FALSE; - lastPrevSpentDialPressure = 0.0F; - prevSpentDialPressure = 0.0F; F32 acidVolume = getF32OverrideValue( &acidDoseVolume ); F32 bicarbVolume = getF32OverrideValue( &bicarbDoseVolume ); @@ -540,9 +533,6 @@ ( TRUE == isConcentratePumpDosingCompleted( D10_PUMP ) ) ) || ( TRUE == getBalChamberSwitchingOnlyStatus() ) ) { - //Collect first sample of spent pressure - lastPrevSpentDialPressure = prevSpentDialPressure; - prevSpentDialPressure = spentDialPressure; if ( BAL_CHAMBER_SW_STATE1 == balChamberSWState ) { @@ -696,8 +686,6 @@ currentBalChamberFillCounter = 0; balChamberFillTimeoutCount = 0; isSpentFillComplete = FALSE; - lastPrevSpentDialPressure = 0.0F; - prevSpentDialPressure = 0.0F; F32 acidVolume = getF32OverrideValue( &acidDoseVolume ); F32 bicarbVolume = getF32OverrideValue( &bicarbDoseVolume ); @@ -875,7 +863,6 @@ *************************************************************************/ static void checkSpentFillComplete( F32 spentDialPressure ) { - F32 diffInSpentPressure = 0.0F; U32 absDiffSpentFillCount = 0; U32 adjustedSpeed = 0; U32 spentDialPumpSpeed = getD48PumpSpeedForBCFill(); @@ -908,12 +895,6 @@ } } - // Collect the next sample of spent pressure - lastPrevSpentDialPressure = prevSpentDialPressure; - prevSpentDialPressure = spentDialPressure; - // find the pressure difference for pressure spike detection - diffInSpentPressure = fabs(spentDialPressure - lastPrevSpentDialPressure); - if ( ( spentDialPressure >= spentFillCompletePresPsig ) && ( isSpentFillComplete != TRUE ) ) { // Check spent fill time against the balancing chamber closing period @@ -923,7 +904,7 @@ result = ( ( diffSpentFillCompleteCount <= 0 ) && ( diffSpentFillCompleteCount >= -2 ) ) ? TRUE : FALSE; //Not adjust the D48 pump speed if the fill counter is just 50ms difference from the closing period (considering only positive DEADBAND as negative deadband might indicate under fill of BC). - if ( 0 == result ) + if ( FALSE == result ) { if ( diffSpentFillCompleteCount < SPENT_DIFF_COUNT_ZERO ) {