Index: firmware/App/Controllers/BalancingChamber.c =================================================================== diff -u -r62995983a0117ced0f5eb766e06f381ab3f78018 -r87d9c9a4403037ecfcb0c9bfa57b95c935fc782c --- firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision 62995983a0117ced0f5eb766e06f381ab3f78018) +++ firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision 87d9c9a4403037ecfcb0c9bfa57b95c935fc782c) @@ -193,6 +193,9 @@ //Update last td dialysate flow rate lastTdDialysateFlowrate = tdDialysateFlowrate; + // Update fill timeout count based on the switching period (e.g. 150% of period) + balChamberFillTimeoutCount = (U32)( (F32)balChamberSwitchingPeriod * BAL_CHAMBER_FILL_TIMEOUT_FACTOR ); + //Reset the BC switching flag for new Qd. isFirstCycleBCSwitchingCompleted = FALSE; @@ -590,12 +593,6 @@ if ( TRUE == isFillCompleteOrFirstCycle ) { - // On successful completion, learn timeout as 150% of the observed fill count (once per cycle). - if ( balChamberFillTimeoutCount == 0U ) - { - balChamberFillTimeoutCount = currentBalChamberFillCounter * BAL_CHAMBER_FILL_TIMEOUT_FACTOR; - } - // close the state 1 opened valves valveControlForBCState1FillEnd(); isBalChamberFillInProgress = FALSE; @@ -769,12 +766,6 @@ if ( TRUE == isFillCompleteOrFirstCycle ) { - // On successful completion, learn timeout as 150% of the observed fill count (once per cycle). - if ( balChamberFillTimeoutCount == 0U ) - { - balChamberFillTimeoutCount = currentBalChamberFillCounter * BAL_CHAMBER_FILL_TIMEOUT_FACTOR; - } - // close the valves valveControlForBCState2FillEnd(); isBalChamberFillInProgress = FALSE;