/************************************************************************** * * Copyright (c) 2025-2026 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * @file DryBiCart.c * * @author (last) Jashwant Gantyada * @date (last) 29-Jul-2026 * * @author (original) Vinayakam Mani * @date (original) 19-Nov-2025 * ***************************************************************************/ #include "BalancingChamber.h" #include "Common.h" #include "ConcentratePumps.h" #include "Conductivity.h" #include "DialysatePumps.h" #include "DDDefs.h" #include "DryBiCart.h" #include "Level.h" #include "Messaging.h" #include "MessageSupport.h" #include "MixingControl.h" #include "ModeGenDialysate.h" #include "OperationModes.h" #include "PressureSensor.h" #include "PersistentAlarm.h" #include "Pressure.h" #include "TaskGeneral.h" #include "TemperatureSensors.h" #include "Timers.h" #include "Valves.h" /** * @addtogroup DryBiCart * @{ */ // ********** private definitions ********** #define DRY_BICART_DATA_PUBLISH_INTERVAL ( 250 / TASK_GENERAL_INTERVAL ) ///< Interval (ms/task time) at which the drybicart data published. #define WCDI2_PRESSURE_OFFSET_PSI 7.0F ///< The difference between the actual pressure measured at bicart assembly using Alicat and the measured D66 pressure sensor for WCID2 #define WCID1_PRESSURE_OFFSET_PSI 1.0F ///< The difference between the actual pressure measured at bicart assembly using Alicat and the measured D66 pressure sensor for WCID1 #define DRY_BICART_PERSISTENCE_DURATION_MS 200 ///< Fill persistence duration to overcome the pressure overshoot/ drop for beta 1.9 and above. #define DRY_BICART_SUPPLY_PERSISTENCE_DURATION_MS 500 ///< Supply Fill persistence duration to overcome the pressure overshoot/ drop for beta 1.9 and above. // Dry Bicart Fill #define DRY_BICART_FILL_COMPLETE_TIME_MS ( 1 * MS_PER_SECOND ) ///< Wait time to reset the request flag after fill complete #define DRY_BICART_WCID2_FILL_COMPLETE_PRESSURE_PSI ( 10.0F + WCDI2_PRESSURE_OFFSET_PSI ) ///< The maximum pressure has been reached, indicating that the dry bicart fill for WCID2 is complete #define DRY_BICART_WCID1_FILL_COMPLETE_PRESSURE_PSI ( 10.0F + WCID1_PRESSURE_OFFSET_PSI ) ///< The maximum pressure has been reached, indicating that the dry bicart fill for WCID1 is complete #define DRY_BICART_WCID2_SUPPLY_COMPLETE_PRESSURE_PSI ( 10.0F ) ///< The maximum pressure has been reached, indicating that the dry bicart supply fill for WCID2 is complete #define DRY_BICART_WCID1_SUPPLY_COMPLETE_PRESSURE_PSI ( 6.0F ) ///< The maximum pressure has been reached, indicating that the dry bicart Supply fill for WCID1 is complete #define GET_FILL_COMPLETE_PRESSURE_PSI (getTestConfigStatus( TEST_CONFIG_DD_ENABLE_WCID_1 ) != TRUE ? \ DRY_BICART_WCID2_FILL_COMPLETE_PRESSURE_PSI : DRY_BICART_WCID1_FILL_COMPLETE_PRESSURE_PSI ) ///< Get fill complete pressure based on the WCID configuration #define GET_SUPPLY_FILL_COMPLETE_PRESSURE_PSI (getTestConfigStatus( TEST_CONFIG_DD_ENABLE_WCID_1 ) != TRUE ? \ DRY_BICART_WCID2_SUPPLY_COMPLETE_PRESSURE_PSI : DRY_BICART_WCID1_SUPPLY_COMPLETE_PRESSURE_PSI ) ///< Get supply fill complete pressure based on the WCID configuration #define DRY_BICART_FILL_INITIATE_PRESSURE_PSI 1.5F ///< Minimum pressure required to initiate the dry bicart fill process. #define DRY_BICART_FILL_COMPLETE_SUPPLY_PRESSURE_PSI 10.0F ///< Maximum pressure allowed at bicart fill during supply process/state #define DRY_BICART_FILL_INITIATE_SUPPLY_PRESSURE_PSI 4.0F ///< Minimum pressure required to initiate the dry bicart fill during supply process/state #define DRY_BICART_MAX_FILL_CYCLE_CNT 10 ///< Max fill cycle allowed (by override) for dry bicart fill/mix with water. #define DRY_BICART_MINIMUM_FILL_CYCLE_CNT 3 ///< Minimum fill cycle count for filling dry bicart // Dry Bicart Fill Vent #define DRY_BICART_FILL_VENT_TIME_MS ( 1 * MS_PER_SECOND ) ///< Wait time to vent dry bicart gas before actuating Bicarb chamber(F) venting. #define DRY_BICART_FILL_VENT_MAX_TIME_MS ( 3 * MS_PER_SECOND ) ///< Max time to vent both dry bicart and Chamber F. #define DRY_BICART_DEPRESSURIZE_VENT_MAX_TIME_MS ( 30 * MS_PER_SECOND ) ///< Max vent time out for dry bicart to depressurize #define DRY_BICART_FILL_VENT_COMPLETE_PRESSURE_PSI 1.5F ///< Minimum Pressure to indicate the dry bicart venting being completed. // Bicarb chamber Supply/Vent #ifdef CONDUCTIVE_LEVEL_SENSOR_ENABLED #define DRY_BICART_SUPPLY_VALVE_D80_OPEN_TIME_MS ( 60 * MS_PER_SECOND ) ///< Max time allowed for supply (opening D80 valve) during bicarb chamber (F) fill using level sensor #else #define DRY_BICART_SUPPLY_VALVE_D80_OPEN_TIME_MS ( 3 * MS_PER_SECOND ) ///< Max time allowed for supply (opening D80 valve) during bicarb chamber (F) fill time based fill #endif #define DRY_BICART_SUPPLY_VENT_TIME_MS ( 1 * MS_PER_SECOND ) ///< Wait time to vent dry bicart gas before actuating Bicarb chamber(F) venting. #define DRY_BICART_SUPPLY_VENT_MAX_TIME_MS ( 1 * MS_PER_SECOND ) ///< Max time to vent both dry bicart and Chamber F. #define DRY_BICART_SUPPLY_COMPLETE_TIME_MS ( 2 * MS_PER_SECOND ) ///< Wait time to close the D80 valve after D65 is closed #define DRY_BICART_SUPPLY_DECAY_COMPLETE_PRESSURE_PSI 4.0F ///< Minimum decay pressure needed to end the supply process. #define DRY_BICART_SUPPLY_VENT_CYCLE_TIME_MS ( 15 * SEC_PER_MIN * MS_PER_SECOND ) ///< Vent cycle time to initiate D85 opening. // Dry Bicart Drain #define LARGE_DRY_BICART_MAX_DRAIN_TIME_MS ( 8 * SEC_PER_MIN * MS_PER_SECOND ) ///< Max drain time for large dry bicart in ms. #define SMALL_DRY_BICART_MAX_DRAIN_TIME_MS ( 4 * SEC_PER_MIN * MS_PER_SECOND ) ///< Max drain time for small dry bicart in ms. #define DRY_BICART_DRAIN_FLUID_PHASE_TIME_MS ( 3 * MS_PER_SECOND ) ///< Time to stay in fluid drain per cycle #define DRY_BICART_DRAIN_VENT_PHASE_TIME_MS ( 8 * MS_PER_SECOND ) ///< Time to keep D64 open per vent cycle #define DRY_BICART_DRAIN_D18_PRESSURE_PSI 5 #define DIAL_PUMP_DRAIN_D48_RPM 2500 ///< Nominal RPM target for dialysate pump D48 to drain the dry bicart. #define DIAL_PUMP_DRAIN_D12_RPM 1600 ///< Nominal RPM target for dialysate pump D12 to drain the dry bicart. #define INLET_PRES_OUT_OF_RANGE_TIMEOUT_MS ( 3 * MS_PER_SECOND ) ///< Persistence period for d66 pressure out of range error in milliseconds. #define INLET_PRES_OUT_OF_RANGE_CLEAR_MS ( 3 * MS_PER_SECOND ) ///< Persistence period for d66 pressure out of range clear in milliseconds. /// Payload record structure for dry bicart fill request typedef struct { U32 startStop; ///< Dry bicart fill request start:1 and stop: 0 } DRY_BICART_FILL_START_CMD_PAYLOAD_T; /// Enumeration of dry bicart top level state machine operation typedef enum DryBicart_StateMachines { DRY_BICART_IDLE = 0, ///< Dry bicart Idle DRY_BICART_INITIAL_FILL, ///< Dry bicart initial fill DRY_BICART_SUPPLY, ///< Dry bicart chamber fill DRY_BICART_DRAIN, ///< Dry bicart drain DRY_BICART_DEPRESSURIZE, ///< Dry bicart depressurize NUM_OF_DRY_BICART_OPERATION ///< Number of dry bicart operation } DRY_BICART_OPERATION_T; // ********** private data ********** // publish static OVERRIDE_U32_T dryBiCartDataPublishInterval; ///< Dry bicart data publish interval. static U32 dryBiCartDataPublicationTimerCounter; ///< Used to schedule drybicart data publication to CAN bus. static DRY_BICART_FILL_EXEC_STATE_T dryBiCartFillExecState; ///< Current state of dry bicart fill executive state machine. static BICARB_CHAMBER_FILL_EXEC_STATE_T bicarbChamberFillExecState; ///< Current state of bicarb chamber fill executive state machine. static DRY_BICART_DRAIN_EXEC_STATE_T dryBiCartDrainExecState; ///< Current state of dry bicart drain executive state machine static DRY_BICART_DEPRESSURIZE_EXEC_STATE_T dryBiCartDepressurizeExecState; ///< Current state of dry bicart depressurize executive state machine // fill static U32 dryBiCartFillStartTime; ///< Dry bicart fill start time. static U32 dryBiCarbFillVentStartTime; ///< Bicarb fill vent start time. static U32 biCartFillCycleCounter; ///< Number of drybicart fill cycle static U32 lastFillDurationInMS; ///< Previous time duration to fill the bicart fill. static U32 currentFillDurationInMS; ///< Current time duration to fill the bicart fill. static OVERRIDE_U32_T biCartMaxFillCycleCount; ///< Maximum number of drybicart fill cycle ( overrideable) static BOOL dryBiCartFillVentTimeOut; ///< Vent time out flag // initiate the fill/supply/drain static OVERRIDE_U32_T dryBiCartFillRequested; ///< Start/stop dry bicart fill. static OVERRIDE_U32_T bicarbChamberFillRequested; ///< Start/stop bicarb chamber fill. static OVERRIDE_U32_T dryBiCartDrainRequested; ///< Start/stop dry bicart drain. static OVERRIDE_U32_T dryBiCartDepressurizeRequested; ///< Start/stop dry bicart depressurize // supply static U32 dryBiCarbSupplyStartTime; ///< Bicarb supply start time from bicart to Chamber F. static U32 dryBiCarbSypplyVentStartTime; ///< Bicarb supply vent start time for both bicart & Chamber F. static OVERRIDE_F32_T dryBiCartUpperCartPressure; ///< Upper cart pressure static OVERRIDE_F32_T dryBiCartLowerCartPressure; ///< Lower cart pressure // drain // cart selection for draining static OVERRIDE_U32_T dryBiCartType; ///< Dry bicart size(small/large) static U32 dryBiCartDrainStartTime; ///< Drain overall start time (for max timeout) static U32 dryBiCartPumpStartStopStartTime ; ///< Pump start time (for delaying after valves are open) static U32 dryBiCartDrainTimePeriod; ///< Dry bicart drain time period. static BOOL dryBiCartPressureDecayStartTimeFlag; ///< Dry bicart d66 pressure decay to 4 PSI start timer flag static BOOL dryBiCartVentCycleWaitTimeStartedFlag; ///< Flag indicating venting cycle timer started for opening D85. static U32 dryBiCartFillPersistenceStartTime; ///< Dry bicart fill Persistence time. static U32 dryBiCartFillVentPersistenceStartTime; ///< Dry bicart Vent Persistence time. static U32 dryBiCartSupplyFillPersistenceStartTime; ///< Dry bicart supply fill Persistence time. static U32 dryBiCartSupplyVentPersistenceStartTime; ///< Dry bicart supply fill Persistence time. static U32 dryBiCartDepressurizePersistenceStartTime; ///< Dry bicart depressurize Persistence time. static U32 drybicartLowercartPressurePersistenceStartTime; ///< Dry bicart Persistence on lower cart pressure start time. static U32 drybicartUppercartPressurePersistenceStartTime; ///< Dry bicart Persistence on upper cart pressure start time. static U32 dryBiCartVentCycleStartTime; ///< Dry bicart Vent cycle start time. // depressurize static U32 dryBiCartDepressurizeStartTime; ///< Drain overall start time (for max timeout) static DRY_BICART_OPERATION_T dryBicartStartRequest; ///< Dry bicart operation, fill or supply or drain request static DRY_BICART_OPERATION_T prevDryBicartState; ///< Dry BiCart State Change Tracker // ********** private function prototypes ********** static void updateDrybicartOperation(void); // Fill & Vent static void startDryBicartVent( void ); static void resetDryBicartFillRequest( void ); static DRY_BICART_FILL_EXEC_STATE_T handleDryBicartFillIdleState( void ); static DRY_BICART_FILL_EXEC_STATE_T handleDryBicartFillWaterState( void ); static DRY_BICART_FILL_EXEC_STATE_T handleDryBicartVentState( void ); static DRY_BICART_FILL_EXEC_STATE_T handleDryBicartFillDurationCheckState( void ); // Supply & Vent static void startBicarbChamberCartridgeFillWaterSequence( void ); static void startBicarbChamberSupply( void ); static F32 getDryBicartLowerCartPressure( void ); static F32 getDryBicartUpperCartPressure( void ); static BOOL isDryBicartChamberFillWindowOpen( void ); static void updateValvesOnBalChamberSwitch( void ); static void resetBicarbChamberFillRequest( void ); static BICARB_CHAMBER_FILL_EXEC_STATE_T handleBicarbChamberSupplyIdleState( void ); static BICARB_CHAMBER_FILL_EXEC_STATE_T handleBicarbChamberCartridgeFillWaterState( void ); static BICARB_CHAMBER_FILL_EXEC_STATE_T handleBicarbChamberSupplyState( void ); static BICARB_CHAMBER_FILL_EXEC_STATE_T handleBicarbChamberSupplyVentState(void); // Drain static configureValvesForDrain( void ); static terminateDrainSequence( void ); static void resetDryBicartDrainRequest( void ); static DRY_BICART_DRAIN_EXEC_STATE_T handleDryBicartDrainIdleState( void ); static DRY_BICART_DRAIN_EXEC_STATE_T handleDryBicartDrainState( void ); static DRY_BICART_DRAIN_EXEC_STATE_T handleDryBicartDrainDurationCheckState( void ); // Depressurize static void resetDryBicartDepressurizeRequest( void ); static DRY_BICART_DEPRESSURIZE_EXEC_STATE_T handleDryBicartDepressurizeIdleState( void ); static DRY_BICART_DEPRESSURIZE_EXEC_STATE_T handleDryBicartDepressurizeState( void ); // publish the status static void publishDryBicartData( void ); static U32 getDryBicartFillDataPublishInterval( void ); /*********************************************************************//** * @brief * The The initDryBiCart function initializes the Dry Bicarbonate Cartridge * module. * @details \b Inputs: none * @details \b Outputs: unit variables initialized * @return none *************************************************************************/ void initDryBiCart( void ) { dryBiCartFillExecState = DRY_BICART_FILL_IDLE_STATE; bicarbChamberFillExecState = BICARB_CHAMBER_SUPPLY_IDLE_STATE; dryBiCartDrainExecState = BICART_DRAIN_IDLE_STATE; dryBiCartDepressurizeExecState = DRY_BICART_DEPRESSURIZE_IDLE_STATE; dryBicartStartRequest = DRY_BICART_IDLE; prevDryBicartState = DRY_BICART_IDLE; dryBiCartDataPublishInterval.data = DRY_BICART_DATA_PUBLISH_INTERVAL; dryBiCartDataPublishInterval.ovData = DRY_BICART_DATA_PUBLISH_INTERVAL; dryBiCartDataPublishInterval.ovInitData = 0; dryBiCartDataPublishInterval.override = OVERRIDE_RESET; biCartMaxFillCycleCount.data = DRY_BICART_MAX_FILL_CYCLE_CNT; biCartMaxFillCycleCount.ovData = DRY_BICART_MAX_FILL_CYCLE_CNT; biCartMaxFillCycleCount.ovInitData = 0; biCartMaxFillCycleCount.override = OVERRIDE_RESET; dryBiCartFillRequested.data = FALSE; dryBiCartFillRequested.ovData = FALSE; dryBiCartFillRequested.ovInitData = FALSE; dryBiCartFillRequested.override = OVERRIDE_RESET; dryBiCartDrainRequested.data = FALSE; dryBiCartDrainRequested.ovData = FALSE; dryBiCartDrainRequested.ovInitData = FALSE; dryBiCartDrainRequested.override = OVERRIDE_RESET; bicarbChamberFillRequested.data = FALSE; bicarbChamberFillRequested.ovData = FALSE; bicarbChamberFillRequested.ovInitData = FALSE; bicarbChamberFillRequested.override = OVERRIDE_RESET; dryBiCartType.data = FALSE; dryBiCartType.ovData = FALSE; dryBiCartType.ovInitData = 0; dryBiCartType.override = OVERRIDE_RESET; dryBiCartUpperCartPressure.data = GET_SUPPLY_FILL_COMPLETE_PRESSURE_PSI; dryBiCartUpperCartPressure.ovData = GET_SUPPLY_FILL_COMPLETE_PRESSURE_PSI; dryBiCartUpperCartPressure.ovInitData = 0.0F; dryBiCartUpperCartPressure.override = OVERRIDE_RESET; dryBiCartLowerCartPressure.data = DRY_BICART_FILL_INITIATE_SUPPLY_PRESSURE_PSI; dryBiCartLowerCartPressure.ovData = DRY_BICART_FILL_INITIATE_SUPPLY_PRESSURE_PSI; dryBiCartLowerCartPressure.ovInitData = 0.0F; dryBiCartLowerCartPressure.override = OVERRIDE_RESET; dryBiCartPressureDecayStartTimeFlag = FALSE; dryBiCartVentCycleWaitTimeStartedFlag = FALSE; dryBiCartFillVentTimeOut = FALSE; dryBiCartVentCycleStartTime = 0; dryBiCartFillStartTime = 0; lastFillDurationInMS = 0; currentFillDurationInMS = 0; dryBiCartDataPublicationTimerCounter = 0; biCartFillCycleCounter = 0; dryBiCarbSupplyStartTime = 0; dryBiCarbSypplyVentStartTime = 0; dryBiCartDrainStartTime = 0; dryBiCartPumpStartStopStartTime = 0; dryBiCartDrainTimePeriod = 0; dryBiCartFillPersistenceStartTime = 0; //dryBiCartVentPersistenceStartTime = 0; drybicartLowercartPressurePersistenceStartTime = 0; drybicartUppercartPressurePersistenceStartTime = 0; initPersistentAlarm( ALARM_ID_DD_DRY_BICART_FILL_INLET_PRESSURE_LOW, INLET_PRES_OUT_OF_RANGE_TIMEOUT_MS, INLET_PRES_OUT_OF_RANGE_CLEAR_MS ); } /*********************************************************************//** * @brief * The transitionToDryBicart function prepares for transition to * dry bicart fill/degas operations. * @details \b Inputs: none * @details \b Outputs: none * @return none *************************************************************************/ void transitionToDryBicart( void ) { initDryBiCart(); } /*********************************************************************//** * @brief * The execDryBicart function executes the set of dry bicarbonate cartridge fill, * bicarbonate chamber fill and bicarbonate cartridge drain related state machines one at time * @details \b Inputs: dryBicartStartRequest, prevDryBicartState * @details \b Outputs: prevDryBicartState * @details \b Alarm: ALARM_ID_DD_SOFTWARE_FAULT when wrong dry bicart state machine is * invoked. * @return none. *************************************************************************/ void execDryBicart( void ) { // top level state machine selection DRY_BICART_OPERATION_T dryBicartState = dryBicartStartRequest; hydChamberWaterInletControl(); switch ( dryBicartState ) { case DRY_BICART_IDLE: // run as idle state updateDrybicartOperation(); break; case DRY_BICART_INITIAL_FILL: // Dry bicart fill exec execDryBicartFill(); break; case DRY_BICART_SUPPLY: // Fill Bicarb chamber F exec execBicarbChamberSupply(); break; case DRY_BICART_DRAIN: // Dry bicart drain exec execDryBicartDrain(); break; case DRY_BICART_DEPRESSURIZE: // Dry bicart depressurize execDryBicartDepressurize(); break; default: // software fault, dryBicartStartRequest = DRY_BICART_IDLE; SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DD_SOFTWARE_FAULT, SW_FAULT_ID_DRY_BICART_FILL_INVALID_EXEC_STATE, dryBicartStartRequest ); break; } if ( prevDryBicartState != dryBicartStartRequest ) { SEND_EVENT_WITH_2_U32_DATA( DD_EVENT_DRY_BICART_STATE_CHANGE, prevDryBicartState, dryBicartStartRequest ); prevDryBicartState = dryBicartStartRequest; } // Publish dry bicart data publishDryBicartData(); } /*********************************************************************//** * @brief * The execDryBicartFill function executes the dry bicart fill (mixing water * with dry sodium bicarbonate ) state machine. * @details \b Inputs: dryBiCartFillExecState * @details \b Outputs: dryBiCartFillExecState * @details \b Alarm: ALARM_ID_DD_SOFTWARE_FAULT when wrong dry bicart fill state * invoked. * @return current state. *************************************************************************/ U32 execDryBicartFill( void ) { // execute drybicart fill state machine switch ( dryBiCartFillExecState ) { case DRY_BICART_FILL_IDLE_STATE: dryBiCartFillExecState = handleDryBicartFillIdleState(); break; case DRY_BICART_FILL_WATER_STATE: dryBiCartFillExecState = handleDryBicartFillWaterState(); break; case DRY_BICART_VENT_STATE: dryBiCartFillExecState = handleDryBicartVentState(); break; case DRY_BICART_FILL_DURATION_CHECK_STATE: dryBiCartFillExecState = handleDryBicartFillDurationCheckState(); break; default: SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DD_SOFTWARE_FAULT, SW_FAULT_ID_DRY_BICART_FILL_INVALID_EXEC_STATE, dryBiCartFillExecState ); break; } return dryBiCartFillExecState; } /*********************************************************************//** * @brief * The execBicarbChamberSupply function executes the bicarb chamber fill * (delivering bicarbonate from Bicart assembly to chamber F)state machine. * @details \b Inputs: bicarbChamberFillExecState * @details \b Outputs: bicarbChamberFillExecState * @details \b Alarm: ALARM_ID_DD_SOFTWARE_FAULT when wrong bicarb chamber * fill state invoked. * @return current state. *************************************************************************/ U32 execBicarbChamberSupply( void ) { // execute bicarb chamber fill state machine switch ( bicarbChamberFillExecState ) { case BICARB_CHAMBER_SUPPLY_IDLE_STATE: bicarbChamberFillExecState = handleBicarbChamberSupplyIdleState(); break; case BICARB_CARTRIDGE_FILL_WATER_STATE: bicarbChamberFillExecState = handleBicarbChamberCartridgeFillWaterState(); break; case BICARB_CHAMBER_SUPPLY_STATE: bicarbChamberFillExecState = handleBicarbChamberSupplyState(); break; case BICARB_SUPPLY_VENT_STATE: bicarbChamberFillExecState = handleBicarbChamberSupplyVentState(); break; default: SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DD_SOFTWARE_FAULT, SW_FAULT_ID_BICARB_CHAMBER_FILL_INVALID_EXEC_STATE, bicarbChamberFillExecState ); break; } return bicarbChamberFillExecState; } /*********************************************************************//** * @brief * The execDryBicartDrain function executes the dry bicart drain state machine. * @details \b Inputs: dryBiCartDrainExecState * @details \b Outputs: dryBiCartDrainExecState * @details \b Alarm: ALARM_ID_DD_SOFTWARE_FAULT when wrong dry bicart drain state * invoked. * @return current state. *************************************************************************/ U32 execDryBicartDrain( void ) { // execute drybicart drain state machine switch ( dryBiCartDrainExecState ) { case BICART_DRAIN_IDLE_STATE: dryBiCartDrainExecState = handleDryBicartDrainIdleState(); break; case BICART_DRAIN_STATE: dryBiCartDrainExecState = handleDryBicartDrainState(); break; case BICART_DRAIN_DURATION_CHECK_STATE: dryBiCartDrainExecState = handleDryBicartDrainDurationCheckState(); break; default: SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DD_SOFTWARE_FAULT, SW_FAULT_ID_DRY_BICART_DRAIN_INVALID_EXEC_STATE, dryBiCartDrainExecState ); break; } return dryBiCartDrainExecState; } /*********************************************************************//** * @brief * The execDryBicartDepressurize function executes the dry bicart depressurize state machine. * @details \b Inputs: dryBiCartDepressurizeExecState * @details \b Outputs: dryBiCartDepressurizeExecState * @details \b Alarm: ALARM_ID_DD_SOFTWARE_FAULT when wrong dry bicart depressurize state * invoked. * @return current state. *************************************************************************/ U32 execDryBicartDepressurize( void ) { // execute drybicart depressurize state machines switch ( dryBiCartDepressurizeExecState ) { case DRY_BICART_DEPRESSURIZE_IDLE_STATE: dryBiCartDepressurizeExecState = handleDryBicartDepressurizeIdleState(); break; case DRY_BICART_DEPRESSURIZE_STATE: dryBiCartDepressurizeExecState = handleDryBicartDepressurizeState(); break; default: SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DD_SOFTWARE_FAULT, SW_FAULT_ID_DRY_BICART_DEPRESURIZE_INVALID_EXEC_STATE, dryBiCartDepressurizeExecState ); break; } return dryBiCartDepressurizeExecState; } /*********************************************************************//** * @brief * The setBicarbChamberFillRequested function sets the chmaberFillRequest * flag value to be True. * @details \b Inputs: dryBiCartFillRequested, dryBiCartDrainRequested, * dryBiCartDepressurizeRequested * @details \b Outputs: bicarbChamberFillRequested * @return TRUE if successful, FALSE if not. *************************************************************************/ BOOL setBicarbChamberFillRequested( void ) { BOOL result = FALSE; BOOL requestStatus = getU32OverrideValue( &dryBiCartFillRequested ) ||\ getU32OverrideValue( &dryBiCartDrainRequested ) || \ getU32OverrideValue( &dryBiCartDepressurizeRequested ); // ensure that there is no other operation in progress before new request set to true if ( FALSE == requestStatus ) { bicarbChamberFillRequested.data = TRUE; result = TRUE; } return result; } /*********************************************************************//** * @brief * The getBicarbChamberFillRequested function gets the chmaberFillRequest * flag values * @details \b Inputs: bicarbChamberFillRequested * @details \b Outputs: none * @return TRUE if successful, FALSE if not. *************************************************************************/ BOOL getBicarbChamberFillRequested( void ) { BOOL result = FALSE; if ( (TRUE == getU32OverrideValue( &bicarbChamberFillRequested ) ) ) { result = TRUE; } return result; } /*********************************************************************//** * @brief * The isDryBicartChamberFillWindowOpen function checks whether D65 may be * opened for dry bicarb refill: fresh-side BC valves closed and BC switch not * within the 50 ms valve-close window. * @details \b Inputs: getBalChamberFreshSideValvesClosedStatus, isBalChamberSwitchImminent * @details \b Outputs: none * @return TRUE when the BC fill is completed and allow D65 to fill Chamber F *************************************************************************/ static BOOL isDryBicartChamberFillWindowOpen( void ) { BOOL result = FALSE; if ( ( TRUE == getBalChamberFreshSideValvesClosedStatus() ) && ( FALSE == isBalChamberSwitchImminent() ) ) { result = TRUE; } return result; } /*********************************************************************//** * @brief * The updateValvesOnBalChamberSwitch function closes D65 when the balancing * chamber is within 100 ms of switching and open D80 * @details \b Inputs: isBalChamberSwitchImminent * @details \b Outputs: valve states * @return none *************************************************************************/ static void updateValvesOnBalChamberSwitch( void ) { if ( TRUE == isBalChamberSwitchImminent() ) { setValveState( D65_VALV, VALVE_STATE_CLOSED ); // Open D80 only in supply state setValveState( D80_VALV, VALVE_STATE_OPEN ); } } /*********************************************************************//** * @brief * The setBicartFillRequested function sets the bicart fill request * flag value to be True. * @details \b Inputs: bicarbChamberFillRequested, dryBiCartDrainRequested, * dryBiCartDepressurizeRequested * @details \b Outputs: dryBiCartFillRequested * @return TRUE if successful, FALSE if not. *************************************************************************/ BOOL setBicartFillRequested( void ) { BOOL result = FALSE; BOOL requestStatus = getU32OverrideValue( &bicarbChamberFillRequested ) \ || getU32OverrideValue( &dryBiCartDrainRequested ) || \ getU32OverrideValue( &dryBiCartDepressurizeRequested ) ; //ensure that there is no other operation in progress before new request set to true if ( FALSE == requestStatus ) { dryBiCartFillRequested.data = TRUE; result = TRUE; } return result; } /*********************************************************************//** * @brief * The getBicartFillRequested function gets the bicart fill request * flag value * @details \b Inputs: dryBiCartFillRequested * @details \b Outputs: none * @return TRUE if successful, FALSE if not. *************************************************************************/ BOOL getBicartFillRequested( void ) { BOOL result = FALSE; if ( ( TRUE == getU32OverrideValue( &dryBiCartFillRequested ) ) ) { result = TRUE; } return result; } /*********************************************************************//** * @brief * The setBicartDrainRequested function sets the bicart drain request * flag value to be True. * @details \b Inputs: bicarbChamberFillRequested,dryBiCartFillRequested, * dryBiCartDepressurizeRequested * @details \b Outputs: dryBiCartDrainRequested * @return TRUE if successful, FALSE if not. *************************************************************************/ BOOL setBicartDrainRequested( void ) { BOOL result = FALSE; BOOL requestStatus = getU32OverrideValue( &bicarbChamberFillRequested ) || \ getU32OverrideValue( &dryBiCartFillRequested ) || \ getU32OverrideValue( &dryBiCartDepressurizeRequested ); //ensure that there is no other operation in progress before new request set to true if ( FALSE == requestStatus ) { dryBiCartDrainRequested.data = TRUE; result = TRUE; } return result; } /*********************************************************************//** * @brief * The getBicartDrainRequested function gets the bicart drain request * flag value * @details \b Inputs: dryBiCartDrainRequested * @details \b Outputs: none * @return TRUE if successful, FALSE if not. *************************************************************************/ BOOL getBicartDrainRequested( void ) { BOOL result = FALSE; if ( ( TRUE == getU32OverrideValue( &dryBiCartDrainRequested ) ) ) { result = TRUE; } return result; } /*********************************************************************//** * @brief * The setBicartDepressurizeRequested function sets the bicart depressurize request * flag value to be True. * @details \b Inputs: bicarbChamberFillRequested,dryBiCartFillRequested,dryBiCartDrainRequested * @details \b Outputs: dryBiCartDepressurizeRequested * @return TRUE if successful, FALSE if not. *************************************************************************/ BOOL setBicartDepressurizeRequested( void ) { BOOL result = FALSE; BOOL requestStatus = getU32OverrideValue( &bicarbChamberFillRequested ) || \ getU32OverrideValue( &dryBiCartFillRequested ) || \ getU32OverrideValue( &dryBiCartDrainRequested ); //ensure that there is no other operation in progress before new request set to true if ( FALSE == requestStatus ) { dryBiCartDepressurizeRequested.data = TRUE; result = TRUE; } return result; } /*********************************************************************//** * @brief * The getBicartDepressurizeRequested function gets the bicart depressurize request * flag value * @details \b Inputs: dryBiCartDepressurizeRequested * @details \b Outputs: none * @return TRUE if successful, FALSE if not. *************************************************************************/ BOOL getBicartDepressurizeRequested( void ) { BOOL result = FALSE; if ( ( TRUE == getU32OverrideValue( &dryBiCartDepressurizeRequested ) ) ) { result = TRUE; } return result; } /*********************************************************************//** * @brief * The getCurrentDryBiCartFillExecState function returns the current state * of the dry bicart fill state. * @details \b Inputs: dryBiCartFillExecState * @details \b Outputs: none * @return the current state of dry bicart fill exec state. *************************************************************************/ DRY_BICART_FILL_EXEC_STATE_T getCurrentDryBiCartFillExecState( void ) { return dryBiCartFillExecState; } /*********************************************************************//** * @brief * The checkDryBicartInletPressure function check the persistence alarm * @details \b Inputs: none * @details \b Outputs: none * @return none. *************************************************************************/ void checkDryBicartInletPressure( ALARM_ID_T alarm, F32 lowerThreshold ) { F32 pressureD66 = getFilteredPressure( D66_PRES ); BOOL isPressureLowRange = ( ( pressureD66 < lowerThreshold ) ? TRUE : FALSE ); checkPersistentAlarm( alarm, isPressureLowRange, pressureD66, lowerThreshold ); } /*********************************************************************//** * @brief * The getDryBicartUpperCartPressure function gets the bicart upper threshold pressure * @details \b Inputs: dryBiCartUpperCartPressure * @details \b Outputs: none * @return TRUE if successful, FALSE if not. *************************************************************************/ static F32 getDryBicartUpperCartPressure( void ) { F32 result = getF32OverrideValue( &dryBiCartUpperCartPressure ); return result; } /*********************************************************************//** * @brief * The getDryBicartLowerCartPressure function gets the bicart lower threshold pressure * @details \b Inputs: dryBiCartLowerCartPressure * @details \b Outputs: none * @return TRUE if successful, FALSE if not. *************************************************************************/ static F32 getDryBicartLowerCartPressure( void ) { F32 result = getF32OverrideValue( &dryBiCartLowerCartPressure ); return result; } /*********************************************************************//** * @brief * The updateDrybicartOperation function initiates bicart fill water, bicarbonate supply, * bicart drain or bicart depressurize * operation * @details \b Inputs: none * @details \b Outputs: dryBicartStartRequest * @return none *************************************************************************/ static void updateDrybicartOperation(void) { if ( TRUE == getBicarbChamberFillRequested() ) { // supply dryBicartStartRequest = DRY_BICART_SUPPLY ; } else if ( TRUE == getBicartFillRequested() ) { // fill dryBicartStartRequest = DRY_BICART_INITIAL_FILL; } else if ( TRUE == getBicartDrainRequested() ) { //drain dryBicartStartRequest = DRY_BICART_DRAIN; } else if ( TRUE == getBicartDepressurizeRequested() ) { dryBicartStartRequest = DRY_BICART_DEPRESSURIZE; } else { // idle dryBicartStartRequest = DRY_BICART_IDLE; } } /*********************************************************************//** * @brief * The handleDryBicartFillIdleState function wait for a fill request * @details \b Inputs: dryBiCartFillRequested * @details \b Outputs: valve states, dryBiCartFillStartTime * @return the next drybicart fill water state. *************************************************************************/ static DRY_BICART_FILL_EXEC_STATE_T handleDryBicartFillIdleState( void ) { DRY_BICART_FILL_EXEC_STATE_T state = DRY_BICART_FILL_IDLE_STATE; if ( TRUE == getU32OverrideValue( &dryBiCartFillRequested ) ) { // TODO: pre gen should start the D12 pump and D14 valve setValveState( D14_VALV, VALVE_STATE_OPEN ); setDialysatePumpTargetRPM( D12_PUMP, FRESH_DIAL_PUMP_INITIAL_RPM_B1_9_B2_0, TRUE ); // Close vent valves and de-scaling valve setValveState( D80_VALV, VALVE_STATE_CLOSED ); setValveState( D81_VALV, VALVE_STATE_CLOSED ); setValveState( D85_VALV, VALVE_STATE_CLOSED ); // Open D65 and D64 setValveState( D65_VALV, VALVE_STATE_OPEN ); setValveState( D64_VALV, VALVE_STATE_OPEN ); // Initiate timer to measure length of fill (ONLY ONCE) dryBiCartFillStartTime = getMSTimerCount(); state = DRY_BICART_FILL_WATER_STATE; } return state; } /*********************************************************************//** * @brief * The handleDryBicartFillWaterStartState function initiates the water fill * into dry bicarbonate cartridge. * @details \b Inputs: dryBiCartFillPersistenceStartTime * @details \b Outputs: valve states, dryBiCartFillStartTime, lastFillDurationInMS, * currentFillDurationInMS * @return the next drybicart fill water end state. *************************************************************************/ static DRY_BICART_FILL_EXEC_STATE_T handleDryBicartFillWaterState( void ) { DRY_BICART_FILL_EXEC_STATE_T state = DRY_BICART_FILL_WATER_STATE; F32 d66Pressure = getFilteredPressure( D66_PRES ); F32 fillCompletePressure = GET_FILL_COMPLETE_PRESSURE_PSI; checkDryBicartInletPressure(ALARM_ID_DD_DRY_BICART_FILL_INLET_PRESSURE_LOW, DRY_BICART_FILL_INITIATE_PRESSURE_PSI ); // Close dry bicart inlet water if D66 pressure is equal to fill complete pressure if ( d66Pressure >= fillCompletePressure ) { // start the persistence timer once d66 reaches fill complete pressure if ( 0 == dryBiCartFillPersistenceStartTime ) { dryBiCartFillPersistenceStartTime = getMSTimerCount(); } // defined persistence on D66 pressure since pressure overshoot just after D65 opening if ( TRUE == didTimeout( dryBiCartFillPersistenceStartTime, DRY_BICART_PERSISTENCE_DURATION_MS ) ) { setValveState( D65_VALV, VALVE_STATE_CLOSED ); lastFillDurationInMS = currentFillDurationInMS; currentFillDurationInMS = calcTimeSince( dryBiCartFillStartTime ); //Increment number of fill cycle biCartFillCycleCounter++; dryBiCartFillPersistenceStartTime = 0; startDryBicartVent(); state = DRY_BICART_VENT_STATE; } } else { dryBiCartFillPersistenceStartTime = 0; } return state; } /*********************************************************************//** * @brief * The startDryBicartVent function actuates the vent valve * present in the Bicart assembly. * @details \b Inputs: none * @details \b Outputs: valve states, dryBiCartFillStartTime, dryBiCartPersistenceStartTime * @return the next drybicart degas end state. *************************************************************************/ static void startDryBicartVent( void ) { //Close D64 setValveState( D64_VALV, VALVE_STATE_CLOSED); //Vent bicart to chamber F setValveState( D85_VALV, VALVE_STATE_OPEN ); //Initiate timer to measure length of bicart vent dryBiCarbFillVentStartTime = getMSTimerCount(); dryBiCartFillVentPersistenceStartTime = 0; } /*********************************************************************//** * @brief * The handleDryBicartDegasEndState function open vent valve present in * the F Chamber (Bicarb) and closes the vent valve once pressure is met. * @details \b Inputs: D66 pressure sensor reading, dryBiCarbFillVentStartTime, * dryBiCartFillVentPersistenceStartTime * @details \b Outputs: valve states, dryBiCartFillVentTimeOut * @return the next drybicart fill duration check state. *************************************************************************/ static DRY_BICART_FILL_EXEC_STATE_T handleDryBicartVentState( void ) { DRY_BICART_FILL_EXEC_STATE_T state = DRY_BICART_VENT_STATE; F32 d66Pressure = getFilteredPressure( D66_PRES ); if ( TRUE == didTimeout( dryBiCarbFillVentStartTime, DRY_BICART_FILL_VENT_TIME_MS ) ) { //Vent chamber F to atmosphere setValveState( D64_VALV, VALVE_STATE_OPEN ); // D66 pressure drops to below fill vent complete pressure if ( ( d66Pressure <= DRY_BICART_FILL_VENT_COMPLETE_PRESSURE_PSI ) ) { // start the persistence timer once d66 reaches fill vent complete pressure if ( 0 == dryBiCartFillVentPersistenceStartTime ) { dryBiCartFillVentPersistenceStartTime = getMSTimerCount(); } // defined persistence on D66 pressure since pressure drop below fill vent complete pressure after opening D64 if ( TRUE == didTimeout( dryBiCartFillVentPersistenceStartTime, DRY_BICART_PERSISTENCE_DURATION_MS ) ) { setValveState( D85_VALV, VALVE_STATE_CLOSED ); dryBiCartFillVentPersistenceStartTime = 0; state = DRY_BICART_FILL_DURATION_CHECK_STATE; } } else if ( ( TRUE == didTimeout( dryBiCarbFillVentStartTime, DRY_BICART_FILL_VENT_MAX_TIME_MS ) ) ) { setValveState( D85_VALV, VALVE_STATE_CLOSED ); dryBiCartFillVentPersistenceStartTime = 0; dryBiCartFillVentTimeOut = TRUE; state = DRY_BICART_FILL_DURATION_CHECK_STATE; } else { dryBiCartFillVentPersistenceStartTime = 0; } } //TODO: Alarm when vent timeout exceeded, but pressure not dropped below expected PSI (0 psi) return state; } /*********************************************************************//** * @brief * The handleDryBicartFillDurationCheckState function checks the fill duration * between last and current fill and exits if the duration is reduced over period * or number of fill cycle done. * @details \b Inputs: biCartMaxFillCycleCount, biCartFillCycleCounter * D66 pressure, biCartFillCycleCounter, dryBiCartFillRequested * @details \b Outputs: valve states, dryBiCartFillStartTime, dryBiCartFillVentTimeOut * @return the next drybicart fill state. *************************************************************************/ static DRY_BICART_FILL_EXEC_STATE_T handleDryBicartFillDurationCheckState( void ) { DRY_BICART_FILL_EXEC_STATE_T state = DRY_BICART_FILL_DURATION_CHECK_STATE; U32 dryBiCartMaxFillCount = getU32OverrideValue( &biCartMaxFillCycleCount ); F32 d66Pressure = getFilteredPressure( D66_PRES ); // Fill for a minimum 3 cycle count and vent time out or number of fill cycle exceeded max fill cycle count if ( ( ( biCartFillCycleCounter >= DRY_BICART_MINIMUM_FILL_CYCLE_CNT ) && ( TRUE == dryBiCartFillVentTimeOut ) ) || ( biCartFillCycleCounter >= dryBiCartMaxFillCount ) ) { // TODO: stop the D12 pump signalDialysatePumpHardStop( D12_PUMP ); // TODO: close the D14 valve setValveState( D14_VALV, VALVE_STATE_CLOSED ); resetDryBicartFillRequest(); state = DRY_BICART_FILL_IDLE_STATE; } else { dryBiCartFillVentTimeOut = FALSE; // transition to next fill cycle and degas state = DRY_BICART_FILL_WATER_STATE; } return state; } /*********************************************************************//** * @brief * The resetDryBicartFillRequest function reset dry bicart * fill states related variables * @details \b Inputs: none * @details \b Outputs: valve states, currentFillDurationInMS, lastFillDurationInMS, biCartFillCycleCounter, * dryBiCartFillVentTimeOut, dryBiCartFillRequested, dryBicartStartRequest * @return the next drybicart start state. *************************************************************************/ static void resetDryBicartFillRequest( void ) { // TODO: in pre-gen, need to check the fill complete status currentFillDurationInMS = 0; lastFillDurationInMS = 0; biCartFillCycleCounter = 0; dryBiCartFillVentTimeOut = FALSE; // Go idle dryBiCartFillRequested.data = FALSE; // for this request override also cleared dryBiCartFillRequested.ovData = FALSE; dryBicartStartRequest = DRY_BICART_IDLE; } /*********************************************************************//** * @brief * The getDryBicartFillDataPublishInterval function gets the dry bicart * fill data publish interval. * @details \b Inputs: dryBiCartDataPublishInterval * @details \b Outputs: none * @return the interval at dry bicart fill/supply/drain data being published. *************************************************************************/ static U32 getDryBicartFillDataPublishInterval( void ) { U32 result = getU32OverrideValue( &dryBiCartDataPublishInterval ); return result; } /*********************************************************************//** * @brief * The handleBicarbChamberSupplyIdleState function wait for bicarb chamber fill request * @details \b Inputs: bicarbChamberFillRequested * @details \b Outputs: dryBiCartVentCycleWaitTimeStartedFlag, dryBiCartPressureDecayStartTimeFlag, * dryBiCartVentCycleStartTime. * @return the next drybicart fluid supply state. *************************************************************************/ static BICARB_CHAMBER_FILL_EXEC_STATE_T handleBicarbChamberSupplyIdleState( void ) { BICARB_CHAMBER_FILL_EXEC_STATE_T state = BICARB_CHAMBER_SUPPLY_IDLE_STATE; dryBiCartPressureDecayStartTimeFlag = FALSE; if ( TRUE == getU32OverrideValue( &bicarbChamberFillRequested ) ) { //startBicarbChamberCartridgeFillWaterSequence(); startBicarbChamberSupply(); state = BICARB_CHAMBER_SUPPLY_STATE; if ( FALSE == dryBiCartVentCycleWaitTimeStartedFlag ) { dryBiCartVentCycleWaitTimeStartedFlag = TRUE; dryBiCartVentCycleStartTime = getMSTimerCount(); } } return state; } /*********************************************************************//** * @brief * The startBicarbChamberCartridgeFillWaterSequence function start fill water in the dry bicart * @details \b Inputs: none * @details \b Outputs: valve states, dryBiCarbSupplyStartTime, dryBiCartSupplyFillPersistenceStartTime * @return none. *************************************************************************/ static void startBicarbChamberCartridgeFillWaterSequence( void ) { if ( TRUE == isDryBicartChamberFillWindowOpen() ) { // Close vent valves and descaling valve setValveState( D80_VALV, VALVE_STATE_CLOSED ); setValveState( D81_VALV, VALVE_STATE_CLOSED ); setValveState( D85_VALV, VALVE_STATE_CLOSED ); // open inlet water to bicart only when fresh-side BC valves are closed setValveState( D65_VALV, VALVE_STATE_OPEN ); setValveState( D64_VALV, VALVE_STATE_OPEN ); //startBicarbChamberSupply(); dryBiCarbSupplyStartTime = getMSTimerCount(); dryBiCartSupplyFillPersistenceStartTime = 0; } } /*********************************************************************//** * @brief * The handleBicarbChamberCartridgeFillWaterState function stops the inlet water to cartridge. * @details \b Inputs: dryBiCartSupplyFillPersistenceStartTime * @details \b Outputs: valve states * @return the next bicarb chamber check level state. *************************************************************************/ static BICARB_CHAMBER_FILL_EXEC_STATE_T handleBicarbChamberCartridgeFillWaterState( void ) { BICARB_CHAMBER_FILL_EXEC_STATE_T state = BICARB_CARTRIDGE_FILL_WATER_STATE; F32 d66Pressure = getFilteredPressure( D66_PRES ); F32 fillCompletePressure = GET_SUPPLY_FILL_COMPLETE_PRESSURE_PSI; LVL_STATE_T bicarbChamberLevel = getBicarbChamberLevelStatus(); if ( FALSE == isDryBicartChamberFillWindowOpen() ) { setValveState( D65_VALV, VALVE_STATE_CLOSED ); } else if ( TRUE == isDryBicartChamberFillWindowOpen() ) { setValveState( D65_VALV, VALVE_STATE_OPEN ); } // check D66 pressure greater than or equal to Fill complete pressure if ( d66Pressure >= fillCompletePressure ) { // start the persistence timer once d66 reaches 17 PSI if ( 0 == dryBiCartSupplyFillPersistenceStartTime ) { dryBiCartSupplyFillPersistenceStartTime = getMSTimerCount(); } // Defined persistence on D66 pressure since pressure overshoot just after D65 opening only for chamber fill if ( TRUE == didTimeout( dryBiCartSupplyFillPersistenceStartTime, DRY_BICART_SUPPLY_PERSISTENCE_DURATION_MS ) ) { // Close water inlet valve as D66 pressure reaches 11 PSI after persistence setValveState( D65_VALV, VALVE_STATE_CLOSED ); dryBiCartSupplyFillPersistenceStartTime = 0; // Return to idle resetBicarbChamberFillRequest(); state = BICARB_CHAMBER_SUPPLY_IDLE_STATE; } } else { dryBiCartSupplyFillPersistenceStartTime = 0; } //Additional code if ( LVL_STATE_LOW == bicarbChamberLevel ) { // Force return to idle to allow next supply resetBicarbChamberFillRequest(); state = BICARB_CHAMBER_SUPPLY_IDLE_STATE; } return state; } /*********************************************************************//** * @brief * The startBicarbChamberSupply function open the bicarb inlet valve (D80). * @details \b Inputs: none * @details \b Outputs: valve states, dryBiCarbSupplyStartTime * @return none. *************************************************************************/ static void startBicarbChamberSupply( void ) { // TODO: set supply in progress to inform BC control to disable alarm setValveState( D64_VALV, VALVE_STATE_OPEN ); // Open the Bicarb chamber inlet valve setValveState( D80_VALV, VALVE_STATE_OPEN ); // Start a timer when bicarb supply started to chamber F dryBiCarbSupplyStartTime = getMSTimerCount(); // TODO: alarm } /*********************************************************************//** * @brief * The handleBicarbChamberPressureCheckStartState function actuates the vent valve * present in the Bicart assembly. * @details \b Inputs: dryBiCarbSupplyStartTime, dryBiCarbSypplyVentStartTime, * drybicartUppercartPressurePersistenceStartTime, * bicarbChamberLevel, dryBiCartPressureDecayStartTimeFlag, * drybicartLowercartPressurePersistenceStartTime * @details \b Outputs: dryBiCarbSypplyVentStartTime, valve states * @return the next bicarb chamber Supply Vent Start state. *************************************************************************/ static BICARB_CHAMBER_FILL_EXEC_STATE_T handleBicarbChamberSupplyState( void ) { BICARB_CHAMBER_FILL_EXEC_STATE_T state = BICARB_CHAMBER_SUPPLY_STATE; F32 d66Pressure = getFilteredPressure( D66_PRES ); LVL_STATE_T bicarbChamberLevel = getBicarbChamberLevelStatus(); // Close D65 , open D85 irrespective of pressure for balancing chamber fresh side fill to complete. updateValvesOnBalChamberSwitch(); // Once upper level reached high , close the valve, timeout is for safety in case level sensor didn't work(10 sec), or else its a time based filling (3 sec) if ( ( LVL_STATE_HIGH == bicarbChamberLevel ) || ( TRUE == didTimeout( dryBiCarbSupplyStartTime, DRY_BICART_SUPPLY_VALVE_D80_OPEN_TIME_MS ) ) ) { if ( TRUE == didTimeout( dryBiCartVentCycleStartTime, DRY_BICART_SUPPLY_VENT_CYCLE_TIME_MS ) ) { // start the timer for d66 pressure decay if ( FALSE == dryBiCartPressureDecayStartTimeFlag ) { dryBiCarbSupplyStartTime = getMSTimerCount(); dryBiCartPressureDecayStartTimeFlag = TRUE; } // do not close the D80 valve, wait till d66 decays to supply decay complete pressure if ( ( TRUE == didTimeout( dryBiCarbSupplyStartTime, DRY_BICART_SUPPLY_COMPLETE_TIME_MS ) ) || ( d66Pressure <= DRY_BICART_SUPPLY_DECAY_COMPLETE_PRESSURE_PSI ) ) { setValveState( D80_VALV, VALVE_STATE_CLOSED ); setValveState( D64_VALV, VALVE_STATE_CLOSED ); setValveState( D85_VALV, VALVE_STATE_OPEN ); dryBiCarbSupplyStartTime = getMSTimerCount(); dryBiCarbSypplyVentStartTime = getMSTimerCount(); state = BICARB_SUPPLY_VENT_STATE; } } else { setValveState( D65_VALV, VALVE_STATE_CLOSED ); setValveState( D80_VALV, VALVE_STATE_CLOSED ); dryBiCarbSupplyStartTime = getMSTimerCount(); startBicarbChamberCartridgeFillWaterSequence(); state = BICARB_CARTRIDGE_FILL_WATER_STATE; } } else if ( d66Pressure <= getDryBicartLowerCartPressure() ) { // start persistence timer if ( 0 == drybicartLowercartPressurePersistenceStartTime ) { drybicartLowercartPressurePersistenceStartTime = getMSTimerCount(); } // defined persistence on D66 pressure if ( ( TRUE == didTimeout( drybicartLowercartPressurePersistenceStartTime, DRY_BICART_SUPPLY_PERSISTENCE_DURATION_MS ) ) && ( TRUE == isDryBicartChamberFillWindowOpen() ) ) { setValveState( D65_VALV, VALVE_STATE_OPEN ); setValveState( D80_VALV, VALVE_STATE_CLOSED ); drybicartLowercartPressurePersistenceStartTime = 0; } } // Close water inlet valve as fill is complete. else if ( d66Pressure >= getDryBicartUpperCartPressure() ) { // start persistence timer if ( 0 == drybicartUppercartPressurePersistenceStartTime ) { drybicartUppercartPressurePersistenceStartTime = getMSTimerCount(); } // defined persistence on D66 pressure since pressure overshoot just after D65 opening if ( TRUE == didTimeout( drybicartUppercartPressurePersistenceStartTime, DRY_BICART_SUPPLY_PERSISTENCE_DURATION_MS ) ) { setValveState( D65_VALV, VALVE_STATE_CLOSED ); setValveState( D80_VALV, VALVE_STATE_OPEN ); drybicartUppercartPressurePersistenceStartTime = 0; } } else { drybicartUppercartPressurePersistenceStartTime = 0; drybicartLowercartPressurePersistenceStartTime = 0; } return state; } /*********************************************************************//** * @brief * The handleBicarbChamberSupplyVentState function actuates the vent valve * present in the Bicart assembly. * @details \b Inputs: dryBiCarbSypplyVentStartTime, dryBiCartSupplyVentPersistenceStartTime * @details \b Outputs: dryBiCarbSypplyVentStartTime,dryBiCartVentCycleWaitTimeStartedFlag, * dryBiCartFillVentTimeOut, valve states * @return the next bicarb chamber Supply Vent End state. *************************************************************************/ static BICARB_CHAMBER_FILL_EXEC_STATE_T handleBicarbChamberSupplyVentState(void) { BICARB_CHAMBER_FILL_EXEC_STATE_T state = BICARB_SUPPLY_VENT_STATE; F32 d66Pressure = getFilteredPressure( D66_PRES ); if ( TRUE == didTimeout( dryBiCarbSypplyVentStartTime, DRY_BICART_SUPPLY_VENT_TIME_MS ) ) { //Vent chamber F to atmosphere setValveState( D64_VALV, VALVE_STATE_OPEN ); // D66 pressure drops to below fill vent complete pressure or time out if ( ( d66Pressure <= DRY_BICART_FILL_VENT_COMPLETE_PRESSURE_PSI ) ) { // start the persistence timer once d66 reaches if it drops below fill vent complete pressure if ( 0 == dryBiCartSupplyVentPersistenceStartTime ) { dryBiCartSupplyVentPersistenceStartTime = getMSTimerCount(); } // defined persistence on D66 pressure since pressure overshoot just after D65 opening if ( TRUE == didTimeout( dryBiCartSupplyVentPersistenceStartTime, DRY_BICART_PERSISTENCE_DURATION_MS ) ) { setValveState( D85_VALV, VALVE_STATE_CLOSED ); dryBiCartSupplyVentPersistenceStartTime = 0; dryBiCartVentCycleWaitTimeStartedFlag = FALSE; resetBicarbChamberFillRequest(); state = BICARB_CHAMBER_SUPPLY_IDLE_STATE; } } else if ( ( TRUE == didTimeout( dryBiCarbSypplyVentStartTime, DRY_BICART_FILL_VENT_MAX_TIME_MS ) ) ) { setValveState( D85_VALV, VALVE_STATE_CLOSED ); dryBiCartSupplyVentPersistenceStartTime = 0; dryBiCartFillVentTimeOut = TRUE; dryBiCartVentCycleWaitTimeStartedFlag = FALSE; resetBicarbChamberFillRequest(); state = BICARB_CHAMBER_SUPPLY_IDLE_STATE; } else { dryBiCartSupplyVentPersistenceStartTime = 0; } } return state; } /*********************************************************************//** * @brief * The resetBicarbChamberFillRequest function clears bicarb chamber fill * request. * @details \b Inputs: none * @details \b Outputs: bicarbChamberFillRequested, dryBiCartPressureDecayStartTimeFlag, * dryBicartStartRequest * @return BICARB_CHAMBER_START_STATE *************************************************************************/ static void resetBicarbChamberFillRequest( void ) { bicarbChamberFillRequested.data = FALSE; // for this request override also cleared bicarbChamberFillRequested.ovData = FALSE; dryBiCartPressureDecayStartTimeFlag = FALSE; dryBicartStartRequest = DRY_BICART_IDLE; } /*********************************************************************//** * @brief * The configureValvesForDrain function open all necessary valves for drain * @details \b Inputs: None * @details \b Outputs: valve states * @return None. *************************************************************************/ static configureValvesForDrain() { //Close valves setValveState( D8_VALV, VALVE_STATE_CLOSED ); setValveState( D14_VALV, VALVE_STATE_CLOSED ); setValveState( D34_VALV, VALVE_STATE_CLOSED ); setValveState( D40_VALV, VALVE_STATE_CLOSED ); setValveState( D52_VALV, VALVE_STATE_CLOSED ); setValveState( D54_VALV, VALVE_STATE_CLOSED ); setValveState( D65_VALV, VALVE_STATE_CLOSED ); setValveState( D34_VALV, VALVE_STATE_CLOSED ); setValveState( D35_VALV, VALVE_STATE_CLOSED ); setValveState( D40_VALV, VALVE_STATE_CLOSED ); setValveState( D80_VALV, VALVE_STATE_CLOSED ); setValveState( D81_VALV, VALVE_STATE_CLOSED ); setValveState( D83_VALV, VALVE_STATE_CLOSED ); setValveState( D85_VALV, VALVE_STATE_CLOSED ); setValveState( D91_VALV, VALVE_STATE_CLOSED ); setValveState( D100_VALV, VALVE_STATE_CLOSED ); // Open vent valves and supply valve setValveState( D83_VALV, VALVE_STATE_OPEN ); setValveState( D85_VALV, VALVE_STATE_OPEN ); // Open D64 valve (vent for chamber F) setValveState( D64_VALV, VALVE_STATE_OPEN ); // open bypass valve setValveState( D34_VALV, VALVE_STATE_OPEN ); // TODO: open iofp drain valve, remove, this should be handled in IO/FP module. setValveState( M12_VALV, VALVE_STATE_OPEN ); // Open balancing chamber valves //valveControlForBCOpenState(); valveControlForBCSpentSideOnlyOpenState(); dryBiCartPumpStartStopStartTime = getMSTimerCount(); } /*********************************************************************//** * @brief * The handleDryBicartDrainIdleState function set the one time actuation * for bicarb drain request. * @details \b Inputs: dryBiCartDrainRequested, dryBiCartType * @details \b Outputs: valve states, dryBiCartDrainStartTime, dryBiCartDrainTimePeriod * @return the next drybicart fluid drain state. *************************************************************************/ static DRY_BICART_DRAIN_EXEC_STATE_T handleDryBicartDrainIdleState( void ) { DRY_BICART_DRAIN_EXEC_STATE_T state = BICART_DRAIN_IDLE_STATE; if ( TRUE == getU32OverrideValue( &dryBiCartDrainRequested ) ) { if ( TRUE == getU32OverrideValue( &dryBiCartType ) ) { dryBiCartDrainTimePeriod = LARGE_DRY_BICART_MAX_DRAIN_TIME_MS; } else { dryBiCartDrainTimePeriod = SMALL_DRY_BICART_MAX_DRAIN_TIME_MS; } dryBiCartDrainStartTime = getMSTimerCount(); configureValvesForDrain(); state = BICART_DRAIN_STATE; } return state; } /*********************************************************************//** * @brief * The handleDryBicartDrainState function initiates the water drain * from dry bicarbonate cartridge. * @details \b Inputs: dryBiCartPumpStartStopStartTime * @details \b Outputs: valve states, dryBiCartDrainStartTime * @return the next drybicart drain duration check state. *************************************************************************/ static DRY_BICART_DRAIN_EXEC_STATE_T handleDryBicartDrainState( void ) { DRY_BICART_DRAIN_EXEC_STATE_T state = BICART_DRAIN_STATE; if ( TRUE == didTimeout( dryBiCartPumpStartStopStartTime, DRY_BICART_DRAIN_FLUID_PHASE_TIME_MS ) ) { // Run D48 at 2500 rpm ie 800ml/min setDialysatePumpTargetRPM( D48_PUMP, DIAL_PUMP_DRAIN_D48_RPM, TRUE ); setDialysatePumpTargetRPM( D12_PUMP, DIAL_PUMP_DRAIN_D12_RPM, TRUE ); //dryBiCartValveOnOffStartTime = getMSTimerCount(); if( 0 == dryBiCartDrainStartTime ) { dryBiCartDrainStartTime = getMSTimerCount(); } state = BICART_DRAIN_DURATION_CHECK_STATE; } return state; } /*********************************************************************//** * @brief * The terminateDrainSequence function close all valves opened for drain and stop the pumps * @details \b Inputs: None * @details \b Outputs: valve states, pumps state * @return None. *************************************************************************/ static terminateDrainSequence( void ) { // Stop pumps requestConcentratePumpOff( D10_PUMP, FALSE ); signalDialysatePumpHardStop( D48_PUMP ); signalDialysatePumpHardStop( D12_PUMP ); // Close valves used for drain setValveState( D64_VALV, VALVE_STATE_CLOSED ); setValveState( D80_VALV, VALVE_STATE_CLOSED ); setValveState( D83_VALV, VALVE_STATE_CLOSED ); setValveState( D85_VALV, VALVE_STATE_CLOSED ); // close bypass valve setValveState( D34_VALV, VALVE_STATE_CLOSED ); // TODO : close iofp drain valve, remove this should be handled in IO/FP module. setValveState( M12_VALV, VALVE_STATE_CLOSED ); //close all balancing chamber valves valveControlForBCClosedState(); } /*********************************************************************//** * @brief * The handleDryBicartFluidDrainDurationCheckState function determines drain complete by max timeout * @details \b Inputs: dryBiCartDrainStartTime * @details \b Outputs: none * @return the next drybicart drain idle state. *************************************************************************/ static DRY_BICART_DRAIN_EXEC_STATE_T handleDryBicartDrainDurationCheckState( void ) { // switch back to DRY_BICART_FLUID_DRAIN_STATE if not fully drained or not timeout DRY_BICART_DRAIN_EXEC_STATE_T state = BICART_DRAIN_DURATION_CHECK_STATE; // Max drain time fall back, it is different for small and large bicart, // 4 minutes for small bicart with full of water and 8 minutes for large bicart // TODO: user settings should be derived for large and small dry bicart for drain time out // right now dialin override is provided. if ( TRUE == didTimeout( dryBiCartDrainStartTime, dryBiCartDrainTimePeriod ) ) { state = BICART_DRAIN_IDLE_STATE; terminateDrainSequence(); resetDryBicartDrainRequest(); } return state; } /*********************************************************************//** * @brief * The resetDryBicartDrainRequest function reset the drain request * * @details \b Inputs: dryBiCartDrainRequested * @details \b Outputs: dryBiCartDrainRequested * @return the next drybicart drain start state. *************************************************************************/ static void resetDryBicartDrainRequest( void ) { // Go idle dryBiCartDrainRequested.data = FALSE; // for this request override also cleared dryBiCartDrainRequested.ovData = FALSE; dryBicartStartRequest = DRY_BICART_IDLE; } /*********************************************************************//** * @brief * The handleDryBicartDepressurizeIdleState function set the one time actuation * for drybicart de-pressurise request. * @details \b Inputs: dryBiCartDepressurizeRequested * @details \b Outputs: none * @return the next drybicart depressurize state. *************************************************************************/ static DRY_BICART_DEPRESSURIZE_EXEC_STATE_T handleDryBicartDepressurizeIdleState( void ) { DRY_BICART_DEPRESSURIZE_EXEC_STATE_T state = DRY_BICART_DEPRESSURIZE_IDLE_STATE; if ( TRUE == getU32OverrideValue( &dryBiCartDepressurizeRequested ) ) { setValveState( D85_VALV, VALVE_STATE_OPEN ); state = DRY_BICART_DEPRESSURIZE_STATE; } return state; } /*********************************************************************//** * @brief * The handleDryBicartDepressurizeState function handles the vent start state for * drybicart de-pressurise * @details \b Inputs: dryBiCartDepressurizeStartTime, dryBiCartDepressurizePersistenceStartTime * @details \b Outputs: none * @return the next drybicart depressurize state. *************************************************************************/ static DRY_BICART_DEPRESSURIZE_EXEC_STATE_T handleDryBicartDepressurizeState( void ) { DRY_BICART_DEPRESSURIZE_EXEC_STATE_T state = DRY_BICART_DEPRESSURIZE_STATE; F32 d66Pressure = getFilteredPressure( D66_PRES ); if ( TRUE == didTimeout( dryBiCartDepressurizeStartTime, DRY_BICART_SUPPLY_VENT_TIME_MS ) ) { //Vent chamber F to atmosphere setValveState( D64_VALV, VALVE_STATE_OPEN ); // D66 pressure drops to below 1.5 PSI or time out if ( ( d66Pressure <= DRY_BICART_FILL_VENT_COMPLETE_PRESSURE_PSI ) ) { // start the persistence timer once d66 reaches if it drops below 1.5 if ( 0 == dryBiCartDepressurizePersistenceStartTime ) { dryBiCartDepressurizePersistenceStartTime = getMSTimerCount(); } // 200 ms persistence on D66 pressure since pressure drop just after D64 opening if ( TRUE == didTimeout( dryBiCartDepressurizePersistenceStartTime, DRY_BICART_PERSISTENCE_DURATION_MS ) ) { setValveState( D85_VALV, VALVE_STATE_CLOSED ); dryBiCartDepressurizePersistenceStartTime = 0; resetDryBicartDepressurizeRequest(); state = DRY_BICART_DEPRESSURIZE_IDLE_STATE; } } else if ( ( TRUE == didTimeout( dryBiCartDepressurizeStartTime, DRY_BICART_DEPRESSURIZE_VENT_MAX_TIME_MS ) ) ) { setValveState( D85_VALV, VALVE_STATE_CLOSED ); dryBiCartDepressurizePersistenceStartTime = 0; resetDryBicartDepressurizeRequest(); state = DRY_BICART_DEPRESSURIZE_IDLE_STATE; } else { dryBiCartDepressurizePersistenceStartTime = 0; } } return state; } /*********************************************************************//** * @brief * The resetDryBicartDepressurizeRequest function handles reset request depressurize request * @details \b Inputs: none * @details \b Outputs: dryBiCartDepressurizeRequested * @return the next drybicart depressurize state. *************************************************************************/ static void resetDryBicartDepressurizeRequest( void ) { // Go idle dryBiCartDepressurizeRequested.data = FALSE; // for this request override also cleared dryBiCartDepressurizeRequested.ovData = FALSE; dryBicartStartRequest = DRY_BICART_IDLE; } /*********************************************************************//** * @brief * The publishDryBicartData function broadcasts the dry bicart * data at defined interval. * @details \b Inputs: dryBiCartDataPublicationTimerCounter * @details \b Outputs: none * @details \b Message \Sent: MSG_ID_DD_DRY_BICART_DATA to publish the dry bicart * data. * @return none *************************************************************************/ static void publishDryBicartData( void ) { if ( ++dryBiCartDataPublicationTimerCounter >= getDryBicartFillDataPublishInterval() ) { DRY_BICART_DATA_T data; data.dryBiCartFillExecState = (U32)dryBiCartFillExecState; data.bicarbChamberFillExecState = (U32)bicarbChamberFillExecState; data.dryBiCartDrainExecState = (U32)dryBiCartDrainExecState; data.dryBiCartDepressurizeExecState = (U32)dryBiCartDepressurizeExecState; data.dryBiCartFillCycleCounter = biCartFillCycleCounter; data.dryBiCartMaxFillCycleCount = getU32OverrideValue( &biCartMaxFillCycleCount ); data.dryBiCartFillRequest = getU32OverrideValue( &dryBiCartFillRequested ); data.bicarbChamberFillRequest = getU32OverrideValue( &bicarbChamberFillRequested ); data.dryBiCartDrainRequest = getU32OverrideValue( &dryBiCartDrainRequested ); data.dryBiCartDepressurizeRequest = getU32OverrideValue( &dryBiCartDepressurizeRequested ); data.dryBiCartLastFillTime = lastFillDurationInMS; data.dryBiCartCurrentFillTime = currentFillDurationInMS; data.dryBiCartType = getU32OverrideValue( &dryBiCartType ); data.dryBiCartDrainTimePeriod = dryBiCartDrainTimePeriod; broadcastData( MSG_ID_DD_DRY_BICART_DATA, COMM_BUFFER_OUT_CAN_DD_BROADCAST, (U08*)&data, sizeof( DRY_BICART_DATA_T ) ); dryBiCartDataPublicationTimerCounter = 0; } } /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/ /*********************************************************************//** * @brief * The testDDDryBiCartDataPublishIntervalOverride function overrides the * DD dry bicart data publish interval. * @details \b Inputs: dryBiCartDataPublishInterval * @details \b Outputs: dryBiCartDataPublishInterval * @param Override message from Dialin which includes the interval * (in ms) to override the DD dry bicart data publish interval to. * @return TRUE if override successful, FALSE if not. *************************************************************************/ BOOL testDryBiCartDataPublishIntervalOverride( MESSAGE_T *message ) { BOOL result = u32BroadcastIntervalOverride( message, &dryBiCartDataPublishInterval, TASK_GENERAL_INTERVAL ); return result; } /*********************************************************************//** * @brief * The testDryBiCartFillCycleMaxCountOverride function sets the override value * of the max dry bicart fill cycle count. * @details Inputs: biCartMaxFillCycleCount * @details Outputs: biCartMaxFillCycleCount * @param message Override message from Dialin which includes the override * value to override the max dry bicart fill cycle count. * @return TRUE if override successful, FALSE if not *************************************************************************/ BOOL testDryBiCartFillCycleMaxCountOverride( MESSAGE_T *message ) { BOOL result = u32Override( message, &biCartMaxFillCycleCount, 0, DRY_BICART_MAX_FILL_CYCLE_CNT ); return result; } /*********************************************************************//** * @brief * The testDryBiCartFillRequestOverride function starts/stops the dry bicart * fill. * @details \b Inputs: dryBiCartFillRequested * @details \b Outputs: dryBiCartFillRequested * @param message set message from Dialin which includes the dry bicart fill * start/stop. * @return TRUE if set request is successful, FALSE if not *************************************************************************/ BOOL testDryBiCartFillRequestOverride( MESSAGE_T *message ) { BOOL result = u32Override( message, &dryBiCartFillRequested, FALSE, TRUE ); return result; } /*********************************************************************//** * @brief * The testBiCarbChamberFillRequestOverride function starts/stops the bicarb * chamber F fill. * @details \b Inputs: bicarbChamberFillRequested * @details \b Outputs: bicarbChamberFillRequested * @param message set message from Dialin which includes the bicarb chamber * fill start/stop. * @return TRUE if set request is successful, FALSE if not *************************************************************************/ BOOL testBiCarbChamberFillRequestOverride( MESSAGE_T *message ) { BOOL result = u32Override( message, &bicarbChamberFillRequested, FALSE, TRUE ); return result; } /*********************************************************************//** * @brief * The testDryBiCartDrainRequestOverride function starts/stops the bicart * drain request * @details \b Inputs: dryBiCartDrainRequested * @details \b Outputs: dryBiCartDrainRequested * @param message set message from Dialin which includes the bicart * drain request start/stop. * @return TRUE if set request is successful, FALSE if not *************************************************************************/ BOOL testDryBiCartDrainRequestOverride( MESSAGE_T *message ) { BOOL result = u32Override( message, &dryBiCartDrainRequested, FALSE, TRUE ); return result; } /*********************************************************************//** * @brief * The testDryBiCartDepressurizeRequestOverride function starts/stops the bicart * depressurize request * @details \b Inputs: dryBiCartDepressurizeRequested * @details \b Outputs: dryBiCartDepressurizeRequested * @param message set message from Dialin which includes the bicart * depressurize request start/stop. * @return TRUE if set request is successful, FALSE if not *************************************************************************/ BOOL testDryBiCartDepressurizeRequestOverride( MESSAGE_T *message ) { BOOL result = u32Override( message, &dryBiCartDepressurizeRequested, FALSE, TRUE ); return result; } /*********************************************************************//** * @brief * The testDryBiCartTypeOverride function selects small/large cartridge type * @details \b Inputs: dryBiCartType * @details \b Outputs: dryBiCartType * @param message set message from Dialin for small/large bicart type * @return TRUE if set request is successful, FALSE if not *************************************************************************/ BOOL testDryBiCartTypeOverride( MESSAGE_T *message ) { BOOL result = u32Override( message, &dryBiCartType, FALSE, TRUE ); return result; } /*********************************************************************//** * @brief * The testDryBiCartUpperCartPressureOverride function sets the override value * of bicart upper cart pressure * @details Inputs: dryBiCartUpperCartPressure * @details Outputs: dryBiCartUpperCartPressure * @param message Override message from Dialin which includes the override * value to override the bicart upper cart pressure * @return TRUE if override successful, FALSE if not *************************************************************************/ BOOL testDryBiCartUpperCartPressureOverride( MESSAGE_T *message ) { BOOL result = f32Override( message, &dryBiCartUpperCartPressure ); return result; } /*********************************************************************//** * @brief * The testDryBiCartLowerCartPressureOverride function sets the override value * of Lowercart pressure * @details Inputs: dryBiCartLowerCartPressure * @details Outputs: dryBiCartLowerCartPressure * @param message Override message from Dialin which includes the override * value to override the bicart lower pressure. * @return TRUE if override successful, FALSE if not *************************************************************************/ BOOL testDryBiCartLowerCartPressureOverride( MESSAGE_T *message ) { BOOL result = f32Override( message, &dryBiCartLowerCartPressure ); return result; } /**@}*/