Index: firmware/App/Controllers/DryBiCart.c =================================================================== diff -u -rc1557cc79c8f0b0c358963c99d83015bd3b37e42 -r67d2fdfc9ec326b98b5a0ac2dbfcee283c8791af --- firmware/App/Controllers/DryBiCart.c (.../DryBiCart.c) (revision c1557cc79c8f0b0c358963c99d83015bd3b37e42) +++ firmware/App/Controllers/DryBiCart.c (.../DryBiCart.c) (revision 67d2fdfc9ec326b98b5a0ac2dbfcee283c8791af) @@ -46,7 +46,7 @@ #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 and the measured D66 pressure based on the placement of the sensor for WCID1 #define WCID1_PRESSURE_OFFSET_PSI 1.0F ///< The difference between the actual pressure measured at bicart assembly and the measured D66 pressure based on the placement of the sensor for WCID2 -#define DRY_BICART_PERSISTENCE_DURATION_MS 500 ///< Fill persistence duration to overcome the pressure overshoot/ drop for beta 1.9 and above. +#define DRY_BICART_PERSISTENCE_DURATION_MS 500 ///< Fill persistence duration to overcome the pressure overshoot/ drop for beta 1.9 and above. //#define DRY_BICART_FILL_PERSISTENCE_DURATION_MS ( 1 * MS_PER_SECOND ) ///< Fill persistence duration to overcome the pressure overshoot/ drop for beta 1.9 and above. // Dry Bicart Fill @@ -57,7 +57,7 @@ #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 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_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 @@ -169,6 +169,7 @@ static BICARB_CHAMBER_FILL_EXEC_STATE_T handleBicarbChamberPressureCheckState( void ); static BICARB_CHAMBER_FILL_EXEC_STATE_T handleBicarbChamberSupplyVentStartState(void); static BICARB_CHAMBER_FILL_EXEC_STATE_T handleBicarbChamberSupplyVentEndState(void); +static BICARB_CHAMBER_FILL_EXEC_STATE_T completeBicarbChamberFillToIdle( void ); static BOOL isDryBicartChamberFillWindowOpen( void ); static void closeD65IfBalChamberSwitchImminent( void ); // Drain @@ -1188,8 +1189,8 @@ setValveState( D65_VALV, VALVE_STATE_CLOSED ); dryBiCartPersistenceStartTime = 0; - //state = BICARB_CHAMBER_SUPPLY_STATE; - state = BICARB_SUPPLY_VENT_END_STATE; + // Return to idle + state = completeBicarbChamberFillToIdle(); } } @@ -1201,8 +1202,8 @@ //Additional code if ( LVL_STATE_LOW == bicarbChamberLevel ) { - //Force transition to end state to allow next supply - state = BICARB_SUPPLY_VENT_END_STATE; + // Force return to idle to allow next supply + state = completeBicarbChamberFillToIdle(); } return state; @@ -1386,25 +1387,39 @@ /*********************************************************************//** * @brief - * The handleBicarbChamberSupplyVentEndState function actuates the vent valve - * present in the Bicart assembly. - * @details \b Inputs: dryBiCarbSypplyVentStartTime - * @details \b Outputs: bicarbChamberFillRequested - * @return the next bicarb chamber start state. + * The completeBicarbChamberFillToIdle function clears bicarb chamber fill + * request and returns the bicarb chamber fill state machine to start. + * @details \b Inputs: none + * @details \b Outputs: bicarbChamberFillRequested, dryBiCartPressureDecayStartTimeFlag, + * dryBicartStartRequest + * @return BICARB_CHAMBER_START_STATE *************************************************************************/ -static BICARB_CHAMBER_FILL_EXEC_STATE_T handleBicarbChamberSupplyVentEndState(void) +static BICARB_CHAMBER_FILL_EXEC_STATE_T completeBicarbChamberFillToIdle( void ) { - BICARB_CHAMBER_FILL_EXEC_STATE_T state = BICARB_SUPPLY_VENT_END_STATE; + BICARB_CHAMBER_FILL_EXEC_STATE_T state = BICARB_CHAMBER_START_STATE; - bicarbChamberFillRequested.data = FALSE; + bicarbChamberFillRequested.data = FALSE; // for this request override also cleared bicarbChamberFillRequested.ovData = FALSE; dryBiCartPressureDecayStartTimeFlag = FALSE; + dryBicartStartRequest = DRY_BICART_IDLE; - state = BICARB_CHAMBER_START_STATE; + return state; +} - dryBicartStartRequest = DRY_BICART_IDLE; +/*********************************************************************//** + * @brief + * The handleBicarbChamberSupplyVentEndState function completes bicarb chamber + * fill to idle. Kept for any residual VentEnd transitions; prefer calling + * completeBicarbChamberFillToIdle() directly from FillWater/Vent completion. + * @details \b Inputs: none + * @details \b Outputs: bicarbChamberFillRequested, dryBicartStartRequest + * @return the next bicarb chamber start (idle) state. + *************************************************************************/ +static BICARB_CHAMBER_FILL_EXEC_STATE_T handleBicarbChamberSupplyVentEndState(void) +{ + BICARB_CHAMBER_FILL_EXEC_STATE_T state = completeBicarbChamberFillToIdle(); return state; }