Index: firmware/App/Controllers/BalancingChamber.c =================================================================== diff -u -r13bfd2e759fbe5753ba8bcefc3227563c09ff055 -reaeff603027c54d0be5171d519710942672ef623 --- firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision 13bfd2e759fbe5753ba8bcefc3227563c09ff055) +++ firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision eaeff603027c54d0be5171d519710942672ef623) @@ -7,8 +7,8 @@ * * @file BalancingChamber.c * -* @author (last) Vinayakam Mani -* @date (last) 06-Apr-2026 +* @author (last) Jashwant Gantyada +* @date (last) 10-Apr-2026 * * @author (original) Vinayakam Mani * @date (original) 28-Jan-2025 @@ -95,13 +95,14 @@ 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 static BOOL isSpentFillComplete; ///< Flag indicating spent side fill complete. -static BOOL isBalChamberSwitchingActive; ///< Flag indicating balancing chamber switching is active or not. -static BOOL isBalChamberSwitchingOnRequested; ///< Flag indicating that a request was made to activate balancing chamber switching. -static BOOL isBalChamberSwitchingOffRequested; ///< Flag indicating that a request was made to deactivate balancing chamber switching. static F32 lastPrevSpentDialPressure; ///< Low-Qd slope: spent pressure last sample of dosing (tick before VALVES_CLOSE); then n-2 in VC. static F32 prevSpentDialPressure; ///< Spent pressure previous sample (n-1) during VALVES_CLOSE for low-Qd slope detection. static U32 spentFillRiseHitCount; ///< Low-Qd slope: counted rise hits (only incremented when in timing window). static U32 spentFillRiseMissCounter; ///< Missed samples after a rise hit before resetting hit count. +static BOOL isBalChamberSwitchingActive; ///< Flag indicating balancing chamber switching is active or not. +static BOOL isBalChamberSwitchingOnRequested; ///< Flag indicating that a request was made to activate balancing chamber switching. +static BOOL isBalChamberSwitchingOffRequested; ///< Flag indicating that a request was made to deactivate balancing chamber switching. + //TODO: remove later once level sensor working static U32 bicarbChamberPeriodicFillCounter; @@ -539,12 +540,12 @@ if ( TRUE == getTestConfigStatus( TEST_CONFIG_DD_FP_ENABLE_BETA_1_0_HW ) ) { //Set Trimmer heater Target temp every BC cycle to catch up fresh dialysate temp - setHeaterTargetTemperature( D45_HEAT, getD4AverageTemperature() ); + setHeaterTargetTemperature( D45_HEAT, getFilteredTemperatureValue( D4_TEMP ) ); } else { //Set Trimmer heater Target temp every BC cycle to catch up fresh dialysate temp - setHeaterTargetTemperature( D45_HEAT, getD99AverageTemperature() ); + setHeaterTargetTemperature( D45_HEAT, getFilteredTemperatureValue( D99_TEMP ) ); } // Check fresh dialysate pressure in range or BC switch only flag set or BC pressure alarms are disabled @@ -744,7 +745,6 @@ // Move to the idle state state = BAL_CHAMBER_STATE_IDLE; - } else { @@ -843,12 +843,12 @@ if ( TRUE == getTestConfigStatus( TEST_CONFIG_DD_FP_ENABLE_BETA_1_0_HW ) ) { //Set Trimmer heater Target temp every BC cycle to catch up fresh dialysate temp - setHeaterTargetTemperature( D45_HEAT, getD4AverageTemperature() ); + setHeaterTargetTemperature( D45_HEAT, getFilteredTemperatureValue( D4_TEMP ) ); } else { //Set Trimmer heater Target temp every BC cycle to catch up fresh dialysate temp - setHeaterTargetTemperature( D45_HEAT, getD99AverageTemperature() ); + setHeaterTargetTemperature( D45_HEAT, getFilteredTemperatureValue( D99_TEMP ) ); } // Check fresh dialysate pressure in range @@ -922,7 +922,6 @@ // Move to the idle state state = BAL_CHAMBER_STATE_IDLE; - } // Spent side of balancing chamber fill is complete or not @@ -1086,7 +1085,7 @@ } // Keep Clearing the off request flag in case an off request was made while we were already in the idle state - isBalChamberSwitchingOffRequested = FALSE; + isBalChamberSwitchingOffRequested = FALSE; // Clear flag to indicate that balancing chamber switching is inactive isBalChamberSwitchingActive = FALSE; @@ -1255,14 +1254,15 @@ d48SpeedPostRangeCheck = RANGE( spentDialPumpSpeed, minD48Speed, maxD48Speed ); - // Do not turn on the pump if the switching only is enabled in the standby mode. - if ( FALSE == getBalChamberSwitchingOnlyStatus() ) - { - // Update the D48 pump speed - setD48PumpSpeedForBCFill( d48SpeedPostRangeCheck ); + + // Do not turn on the pump if the switching only is enabled in the standby mode. + if ( FALSE == getBalChamberSwitchingOnlyStatus() ) + { + // Update the D48 pump speed + setD48PumpSpeedForBCFill( d48SpeedPostRangeCheck ); + } } } - } //Update spent fill is complete isSpentFillComplete = TRUE;