Index: firmware/App/Controllers/BalancingChamber.c =================================================================== diff -u -r78dc7a98fb2a3d28bbdeb4eade1bba03641433d3 -r2ef132047d9438cb0e452e31b046546e2350e0bb --- firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision 78dc7a98fb2a3d28bbdeb4eade1bba03641433d3) +++ firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision 2ef132047d9438cb0e452e31b046546e2350e0bb) @@ -7,8 +7,8 @@ * * @file BalancingChamber.c * -* @author (last) Vinayakam Mani -* @date (last) 01-Jun-2026 +* @author (last) Sameer Kalliadan Poyil +* @date (last) 24-Jun-2026 * * @author (original) Vinayakam Mani * @date (original) 28-Jan-2025 @@ -23,6 +23,7 @@ #include "FpgaDD.h" #include "Heaters.h" #include "Level.h" +#include "MixingControl.h" #include "ModeGenDialysate.h" #include "ModeStandby.h" #include "Messaging.h" @@ -61,6 +62,7 @@ #define BAL_CHAMBER_FILL_TIMEOUT_FACTOR 3.0F ///< Balancing Chamber fill timeout factor (300% of observed fill count) #define COMP_SLOPE -0.000376F ///< Balancing chamber temperature compensation slope factor #define COMP_INTERCEPT 1.007269F ///< Balancing chamber temperature compensation intercept factor + /// Payload record structure for balancing chamber switch only request typedef struct { @@ -106,7 +108,7 @@ static F32 pendingTdDialysateFlowrate; ///< Pending TD dialysate flow rate; applied at FillEnd after a BC switch completes. static BOOL isBalChamberSwitchingPeriodUpdatePending; ///< BC switching period update pending apply at fill end. static U32 bcSwitchingBasedOnClosedPeriodCounter; ///< Valve-close segments remaining before first-cycle relaxations clear after Qd timing apply. -static F32 balancingError; ///< balancing error that has been calculated during balancing chamber switching. +static F32 balancingError; ///< Balancing error that has been calculated during balancing chamber switching. //TODO: remove later once level sensor working static U32 bicarbChamberPeriodicFillCounter; @@ -244,6 +246,34 @@ /*********************************************************************//** * @brief + * The getBicarbDoseVol function gets the bicarb dose volume + * @details \b Inputs: bicarbDoseVolume + * @details \b Outputs: none + * @return TRUE if successful, FALSE if not. + *************************************************************************/ +F32 getBicarbDoseVol( void ) +{ + F32 result = getF32OverrideValue( &bicarbDoseVolume ); + + return result; +} + +/*********************************************************************//** + * @brief + * The getAcidDoseVol function gets acid mix volume + * @details \b Inputs: acidDoseVolume + * @details \b Outputs: none + * @return TRUE if successful, FALSE if not. + *************************************************************************/ +F32 getAcidDoseVol( void ) +{ + F32 result = getF32OverrideValue( &acidDoseVolume ); + + return result; +} + +/*********************************************************************//** + * @brief * The applyBalChamberSwitchingPeriod function applies the active balancing * chamber switching time based on the provided dialysis flow rate. * @details \b Inputs: Dialysis flow rate. @@ -345,14 +375,8 @@ currentBalChamberSwitchingCounter += 1; currentBalChamberFillCounter += 1; - //Calculate balancing error to be used to adjust UF rate - if ( balChamberExecState > BAL_CHAMBER_STATE_IDLE ) + if ( ( FALSE == getTestConfigStatus( TEST_CONFIG_DD_DISABLE_DRY_BICARB ) ) && ( balChamberExecState > BAL_CHAMBER_STATE_IDLE ) ) { - calculateBalancingChamberError(); - } - - if ( ( getTestConfigStatus( TEST_CONFIG_DD_ENABLE_DRY_BICARB ) == TRUE ) && ( balChamberExecState > BAL_CHAMBER_STATE_IDLE ) ) - { #ifdef CONDUCTIVE_LEVEL_SENSOR_ENABLED if ( LVL_STATE_LOW == bicarbChamberLevel ) { @@ -627,7 +651,7 @@ spentFillRiseMissCounter = 0; isSpentFillComplete = FALSE; - if ( getTestConfigStatus( TEST_CONFIG_DD_ENABLE_DRY_BICARB ) == TRUE ) + if ( FALSE == getTestConfigStatus( TEST_CONFIG_DD_DISABLE_DRY_BICARB ) ) { bicarbVolume = getBicarbMixVol(); acidVolume = getAcidMixVol(); @@ -773,7 +797,7 @@ } // If the dry bicarbonate is enabled then we ignore looking at d18 pressure to be in range. - if ( ( TRUE == getTestConfigStatus( TEST_CONFIG_DD_ENABLE_DRY_BICARB ) ) && ( TRUE == getBicarbChamberFillRequested() ) ) + if ( ( FALSE == getTestConfigStatus( TEST_CONFIG_DD_DISABLE_DRY_BICARB ) ) && ( TRUE == getBicarbChamberFillRequested() ) ) { isPressureStabilizedDuringFill = TRUE; } @@ -945,7 +969,7 @@ spentFillRiseMissCounter = 0; isSpentFillComplete = FALSE; - if ( getTestConfigStatus( TEST_CONFIG_DD_ENABLE_DRY_BICARB ) == TRUE ) + if ( FALSE == getTestConfigStatus( TEST_CONFIG_DD_DISABLE_DRY_BICARB ) ) { bicarbVolume = getBicarbMixVol(); acidVolume = getAcidMixVol(); @@ -1025,7 +1049,7 @@ spentDialPressure = getFilteredPressure( D51_PRES ); // If the dry bicarbonate is enabled then we ignore looking at d18 pressure to be in range. - if ( ( TRUE == getTestConfigStatus( TEST_CONFIG_DD_ENABLE_DRY_BICARB ) ) && ( TRUE == getBicarbChamberFillRequested() ) ) + if ( ( FALSE == getTestConfigStatus( TEST_CONFIG_DD_DISABLE_DRY_BICARB ) ) && ( TRUE == getBicarbChamberFillRequested() ) ) { isPressureStabilizedDuringFill = TRUE; } Index: firmware/App/Controllers/BalancingChamber.h =================================================================== diff -u -r78dc7a98fb2a3d28bbdeb4eade1bba03641433d3 -r2ef132047d9438cb0e452e31b046546e2350e0bb --- firmware/App/Controllers/BalancingChamber.h (.../BalancingChamber.h) (revision 78dc7a98fb2a3d28bbdeb4eade1bba03641433d3) +++ firmware/App/Controllers/BalancingChamber.h (.../BalancingChamber.h) (revision 2ef132047d9438cb0e452e31b046546e2350e0bb) @@ -7,8 +7,8 @@ * * @file BalancingChamber.h * -* @author (last) Jashwant Gantyada -* @date (last) 21-May-2026 +* @author (last) Sameer Kalliadan Poyil +* @date (last) 24-Jun-2026 * * @author (original) Vinayakam Mani * @date (original) 28-Jan-2025 @@ -73,6 +73,8 @@ void setBalChamberSwitchingOnlyStatus( BOOL OnOff ); // Set balancing chamber switching only status U32 getBalChamberSwitchingPeriod( void ); // Get balancing chamber switching period F32 getBalancingChamberError( void ); // Get balancing chamber error to adjust UF rate. +F32 getBicarbDoseVol( void ); // Get liquid bicarb dose volume +F32 getAcidDoseVol( void ); // Get acid dose volume BOOL testDDBalChamberDataPublishIntervalOverride( MESSAGE_T *message ); // To override the balancing chamber data publish interval BOOL testBalChamberSwFreqOverride( MESSAGE_T *message ); // To override the balancing chamber switching frequency Index: firmware/App/Controllers/Ultrafiltration.h =================================================================== diff -u -r830213bc6dcc1a684610caf78c79d55f2cb41e93 -r2ef132047d9438cb0e452e31b046546e2350e0bb --- firmware/App/Controllers/Ultrafiltration.h (.../Ultrafiltration.h) (revision 830213bc6dcc1a684610caf78c79d55f2cb41e93) +++ firmware/App/Controllers/Ultrafiltration.h (.../Ultrafiltration.h) (revision 2ef132047d9438cb0e452e31b046546e2350e0bb) @@ -34,7 +34,6 @@ /// ultrafiltration data structure typedef struct { - U32 ufExecState; ///< Ultrafiltration execution state F32 ufRate; ///< Ultrafiltration rate from TD F32 compUFrate; ///< Compensated UF rate U32 isUFRequested; ///< Ultrafiltration run or puase request @@ -44,8 +43,7 @@ void initUltrafiltration( void ); // Initialize ultrafiltration unit void transitionToUltrafiltration( void ); // Prepares for transition to ultrafiltration execution -U32 execUFControl( void ); // Execute the ultrafiltration state machine -UF_EXEC_STATE_T getCurrentUFExecState( void ); // Get the current state of the balancing chamber execution +void handleUFControl( void ); // Handle ultrafiltration control void signalUFRateUpdate( void ); // Update UF rate when there is a change in rate BOOL testDDUFDataPublishIntervalOverride( MESSAGE_T *message ); // To override the UF data publish interval Index: firmware/App/Modes/ModeGenDialysate.c =================================================================== diff -u -r78dc7a98fb2a3d28bbdeb4eade1bba03641433d3 -r2ef132047d9438cb0e452e31b046546e2350e0bb --- firmware/App/Modes/ModeGenDialysate.c (.../ModeGenDialysate.c) (revision 78dc7a98fb2a3d28bbdeb4eade1bba03641433d3) +++ firmware/App/Modes/ModeGenDialysate.c (.../ModeGenDialysate.c) (revision 2ef132047d9438cb0e452e31b046546e2350e0bb) @@ -7,8 +7,8 @@ * * @file ModeGenDialysate.c * -* @author (last) Vinayakam Mani -* @date (last) 28-May-2026 +* @author (last) Sameer Kalliadan Poyil +* @date (last) 15-Jun-2026 * * @author (original) Vinayakam Mani * @date (original) 06-Nov-2024 @@ -257,7 +257,7 @@ setValveState( D85_VALV, VALVE_STATE_CLOSED ); setValveState( D31_VALV, VALVE_STATE_CLOSED ); - if ( getTestConfigStatus( TEST_CONFIG_DD_ENABLE_DRY_BICARB ) == FALSE ) + if ( TRUE == getTestConfigStatus( TEST_CONFIG_DD_DISABLE_DRY_BICARB ) ) { setValveState( D80_VALV, VALVE_STATE_OPEN ); // Bicarb valve setValveState( D64_VALV, VALVE_STATE_CLOSED ); @@ -342,7 +342,7 @@ setValveState( D35_VALV, VALVE_STATE_OPEN ); // VDI setValveState( D40_VALV, VALVE_STATE_OPEN ); // VDO - if ( getTestConfigStatus( TEST_CONFIG_DD_ENABLE_DRY_BICARB ) == FALSE ) + if ( TRUE == getTestConfigStatus( TEST_CONFIG_DD_DISABLE_DRY_BICARB ) ) { setValveState( D80_VALV, VALVE_STATE_OPEN ); // Bicarb valve setValveState( D64_VALV, VALVE_STATE_CLOSED ); @@ -365,7 +365,7 @@ setValveState( D53_VALV, VALVE_STATE_OPEN ); // Drain valve setValveState( D34_VALV, VALVE_STATE_OPEN ); // Bypass valve - if ( getTestConfigStatus( TEST_CONFIG_DD_ENABLE_DRY_BICARB ) == FALSE ) + if ( TRUE == getTestConfigStatus( TEST_CONFIG_DD_DISABLE_DRY_BICARB ) ) { setValveState( D80_VALV, VALVE_STATE_OPEN ); // Bicarb valve setValveState( D64_VALV, VALVE_STATE_CLOSED ); @@ -412,7 +412,7 @@ setValveState( D53_VALV, VALVE_STATE_OPEN ); // Drain valve setValveState( D34_VALV, VALVE_STATE_OPEN ); // Bypass valve - if ( getTestConfigStatus( TEST_CONFIG_DD_ENABLE_DRY_BICARB ) == FALSE ) + if ( TRUE == getTestConfigStatus( TEST_CONFIG_DD_DISABLE_DRY_BICARB ) ) { setValveState( D80_VALV, VALVE_STATE_OPEN ); // Bicarb valve setValveState( D64_VALV, VALVE_STATE_OPEN ); // Bicarb chamber purge valve @@ -470,7 +470,7 @@ setValveState( D34_VALV, VALVE_STATE_OPEN ); setValveState( D53_VALV, VALVE_STATE_OPEN ); - if ( getTestConfigStatus( TEST_CONFIG_DD_ENABLE_DRY_BICARB ) == FALSE ) + if ( TRUE == getTestConfigStatus( TEST_CONFIG_DD_DISABLE_DRY_BICARB ) ) { setValveState( D80_VALV, VALVE_STATE_OPEN ); setValveState( D64_VALV, VALVE_STATE_CLOSED ); Index: firmware/App/Services/AlarmMgmtSWFaults.h =================================================================== diff -u -r78dc7a98fb2a3d28bbdeb4eade1bba03641433d3 -r2ef132047d9438cb0e452e31b046546e2350e0bb --- firmware/App/Services/AlarmMgmtSWFaults.h (.../AlarmMgmtSWFaults.h) (revision 78dc7a98fb2a3d28bbdeb4eade1bba03641433d3) +++ firmware/App/Services/AlarmMgmtSWFaults.h (.../AlarmMgmtSWFaults.h) (revision 2ef132047d9438cb0e452e31b046546e2350e0bb) @@ -7,8 +7,8 @@ * * @file AlarmMgmtSWFaults.h * -* @author (last) Dara Navaei -* @date (last) 03-May-2026 +* @author (last) Sameer Kalliadan Poyil +* @date (last) 24-Jun-2026 * * @author (original) Vinayakam Mani * @date (original) 07-Aug-2024 @@ -158,6 +158,9 @@ SW_FAULT_ID_INVALID_TEMPERATURE_SENSOR_SELECTED3 = 127, SW_FAULT_ID_DIALYSATE_MIX_EXEC_INVALID_STATE = 128, SW_FAULT_ID_MODE_UPDATE_INVALID_STATE = 129, + SW_FAULT_ID_SUBSTITUTION_PUMP_INVALID_ID = 130, + SW_FAULT_ID_SUBSTITUTION_PUMP_EXEC_INVALID_STATE = 131, + SW_FAULT_ID_DRY_BICART_DEPRESURIZE_INVALID_EXEC_STATE = 132, NUM_OF_SW_FAULT_IDS } DD_SW_FAULT_ID_T;