Index: firmware/App/Controllers/BalancingChamber.c =================================================================== diff -u -rcb32846b50cb04e0a68133048325fe81bdc2a3cc -rd056502f61fbd230415ead33a52f6eeb0ace9b6b --- firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision cb32846b50cb04e0a68133048325fe81bdc2a3cc) +++ firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision d056502f61fbd230415ead33a52f6eeb0ace9b6b) @@ -49,7 +49,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 BAL_CHAMBER_FILL_TIMEOUT_FACTOR 1.5 ///< Balancing Chamber fill timeout factor (150% of observed fill count) @@ -83,8 +82,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 @@ -144,8 +141,6 @@ isPressureDroppedDuringFill = FALSE; freshDialPressure = 0.0F; spentDialPressure = 0.0F; - prevSpentDialPressure = 0.0F; - lastPrevSpentDialPressure = 0.0F; currentBalChamberFillCounter = 0; balChamberFillTimeoutCount = 0; diffSpentFillCompleteCount = 0; @@ -439,8 +434,6 @@ isPressureStabilizedDuringFill = FALSE; isPressureDroppedDuringFill = FALSE; isSpentFillComplete = FALSE; - lastPrevSpentDialPressure = 0.0F; - prevSpentDialPressure = 0.0F; F32 acidVolume = getF32OverrideValue( &acidDoseVolume ); F32 bicarbVolume = getF32OverrideValue( &bicarbDoseVolume ); @@ -518,9 +511,6 @@ ( TRUE == isConcentratePumpDosingCompleted( D10_PUMP ) ) ) || ( TRUE == getBalChamberSwitchingOnlyStatus() ) ) { - //Collect first sample of spent pressure - lastPrevSpentDialPressure = prevSpentDialPressure; - prevSpentDialPressure = spentDialPressure; if ( BAL_CHAMBER_SW_STATE1 == balChamberSWState ) { @@ -674,8 +664,6 @@ currentBalChamberFillCounter = 0; balChamberFillTimeoutCount = 0; isSpentFillComplete = FALSE; - lastPrevSpentDialPressure = 0.0F; - prevSpentDialPressure = 0.0F; F32 acidVolume = getF32OverrideValue( &acidDoseVolume ); F32 bicarbVolume = getF32OverrideValue( &bicarbDoseVolume ); @@ -853,7 +841,6 @@ *************************************************************************/ static void checkSpentFillComplete( F32 spentDialPressure ) { - F32 diffInSpentPressure = 0.0F; U32 absDiffSpentFillCount = 0; U32 adjustedSpeed = 0; U32 spentDialPumpSpeed = getD48PumpSpeedForBCFill(); @@ -886,12 +873,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 @@ -901,7 +882,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 ) {