Index: firmware/App/Controllers/BalancingChamber.c =================================================================== diff -u -rb2e7c9194acd84783d2bbad64c5720410493e199 -r1077fee46974061e6e0038b6c0ce0e1471715b61 --- firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision b2e7c9194acd84783d2bbad64c5720410493e199) +++ firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision 1077fee46974061e6e0038b6c0ce0e1471715b61) @@ -132,7 +132,7 @@ balChamberValveClosePeriod = 0; isBalChamberFillInProgress = FALSE; currentBalChamberSwitchingCounter = 0; - isPressureStabilizedDuringFill = FALSE; + isPressureStalbilizedDuringFill = FALSE; lastTdDialysateFlowrate = 0.0F; balChamberDataPublicationTimerCounter = 0; balChamberFillPressureDropCounter = 0; @@ -434,7 +434,7 @@ currentBalChamberFillCounter = 0; balChamberFillTimeoutCount = 0; isBalChamberFillInProgress = FALSE; - isPressureStabilizedDuringFill = FALSE; + isPressureStalbilizedDuringFill = FALSE; isPressureDroppedDuringFill = FALSE; isSpentFillComplete = FALSE; @@ -554,12 +554,16 @@ // Check fresh dialysate pressure back in range to indicate fresh fill complete. if ( ( freshDialPressure >= FRESH_DIAL_PRESSURE_MIN_PSIG ) && ( freshDialPressure <= FRESH_DIAL_PRESSURE_MAX_PSIG ) ) { - if ( ++balChamberFillCompleteStablePressureCounter >= BAL_CHAMBER_FILL_COMPLETE_MS ) + if ( TRUE == isFreshDialysatePressureInRange && TRUE == isSpentDialysatePressureInRange ) { // stabilized pressure indicating fresh side fill is complete isPressureStabilizedDuringFill = TRUE; } } + else + { + isPressureStalbilizedDuringFill = FALSE; + } // Spent side of balancing chamber fill is complete or not checkSpentFillComplete( spentDialPressure ); @@ -655,7 +659,7 @@ BAL_CHAMBER_EXEC_STATE_T state = BAL_CHAMBER_STATE2_FILL_START; currentBalChamberSwitchingCounter = 0; isBalChamberFillInProgress = FALSE; - isPressureStabilizedDuringFill = FALSE; + isPressureStalbilizedDuringFill = FALSE; isPressureDroppedDuringFill = FALSE; balChamberSWState = BAL_CHAMBER_SW_STATE2; currentBalChamberFillCounter = 0; @@ -721,12 +725,16 @@ // Check fresh dialysate pressure back in range to indicate fill complete. if ( ( freshDialPressure >= FRESH_DIAL_PRESSURE_MIN_PSIG ) && ( freshDialPressure <= FRESH_DIAL_PRESSURE_MAX_PSIG ) ) { - if ( ++balChamberFillCompleteStablePressureCounter >= BAL_CHAMBER_FILL_COMPLETE_MS ) + if ( ( TRUE == isFreshDialysatePressureInRange ) && ( TRUE == isSpentDialysatePressureInRange ) ) { // stabilized pressure indicating fresh side fill is complete isPressureStabilizedDuringFill = TRUE; } } + else + { + isPressureStalbilizedDuringFill = FALSE; + } // If fill is taking too long, set an alarm for fill timeout if ( ( balChamberFillTimeoutCount > 0 ) && ( currentBalChamberFillCounter > balChamberFillTimeoutCount ) ) @@ -789,7 +797,7 @@ // When fill initiated, pressure is not dropped to the expected range, possible valve failures. SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DD_BC_STATE2_FILL_PRESSURE_DROP_OUT_OF_RANGE, freshDialPressure, spentDialPressure ); } - else if ( TRUE != isPressureStabilizedDuringFill ) + else if ( TRUE != isPressureStalbilizedDuringFill ) { // Alarm when switching time expired, but still pressure not in range which indicates fill is not completed. SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DD_BC_STATE2_FILL_END_PRESSURE_OUT_OF_RANGE, freshDialPressure, spentDialPressure );