Index: firmware/App/Controllers/DryBiCart.c =================================================================== diff -u -rbd522c8ffdf75130571e5b6a79d1b1d6acd78b1c -rc67f50a3c737b65216f513477dbf91d8af044e58 --- firmware/App/Controllers/DryBiCart.c (.../DryBiCart.c) (revision bd522c8ffdf75130571e5b6a79d1b1d6acd78b1c) +++ firmware/App/Controllers/DryBiCart.c (.../DryBiCart.c) (revision c67f50a3c737b65216f513477dbf91d8af044e58) @@ -98,6 +98,7 @@ DRY_BICART_SUPPLY, ///< Dry bicart chamber fill DRY_BICART_DRAIN, ///< Dry bicart drain DRY_BICART_DEPRESSURIZE, ///< Dry bicart depressurize + DRY_BICART_PRE_GEN_CHAMBER_FILL, NUM_OF_DRY_BICART_OPERATION ///< Number of dry bicart operation } DRY_BICART_OPERATION_T; @@ -107,6 +108,7 @@ 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 +static BICARB_CHAMBER_PRE_GEN_FILL_EXEC_STATE_T bicarbChamberPreGenFillExecState; // fill static U32 dryBiCartFillStartTime; ///< Dry bicart fill start time. static U32 biCartFillCycleCounter; ///< Number of drybicart fill cycle @@ -122,6 +124,7 @@ 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 +static OVERRIDE_U32_T bicarbChamberPreGenFillRequested; ///< Start/stop bicarb chamber pre gen fill. // publish static OVERRIDE_U32_T dryBiCartDataPublishInterval; ///< Dry bicart data publish interval. static U32 dryBiCartDataPublicationTimerCounter; ///< Used to schedule drybicart data publication to CAN bus. @@ -130,14 +133,17 @@ // supply static U32 dryBiCarbSupplyStartTime; ///< Bicarb supply start time from bicart to Chamber F. // vent -static U32 dryBiCarbSypplyVentStartTime; ///< Bicarb supply vent start time for both bicart & Chamber F. +static U32 dryBiCarbSupplyVentStartTime; ///< Bicarb supply vent start time for both bicart & Chamber F. // drain static U32 dryBiCartDrainStartTime; ///< Drain overall start time (for max timeout) //TODO: implement draining //static U32 dryBiCartDrainLastCondSampleTime; ///< Last time conductivity was sampled //static U32 dryBiCartDrainCondStableCount; ///< Debounce counter for "zero" conductivity static U32 dryBiCartDrainTimePeriod; ///< Dry bicart drain time period +static U32 dryBiCarbPreGenSupplyStartTime; +static U32 dryBiCartPreGenPersistenceStartTime; +static U32 drybicartPreGenPersistenceOnLowercartPressureStartTime; ///< Dry bicart Persistence on lower cart pressure start time. static U32 dryBiCartPersistenceStartTime; ///< Dry bicart Persistence time. static U32 drybicartPersistenceOnLowercartPressureStartTime; ///< Dry bicart Persistence on lower cart pressure start time. static BOOL dryBiCartPressureDecayStartTimeFlag; ///< Dry bicart d66 pressure decay start timer. @@ -169,6 +175,14 @@ static DRY_BICART_DRAIN_EXEC_STATE_T handleDryBicartFluidDrainState( void ); static DRY_BICART_DRAIN_EXEC_STATE_T handleDryBicartFluidDrainDurationCheckState( void ); static DRY_BICART_DRAIN_EXEC_STATE_T handleDryBicartFluidDrainEndState( void ); +// Pre Gen Supply & Vent +static BICARB_CHAMBER_PRE_GEN_FILL_EXEC_STATE_T handleBicarbChamberPreGenStartState( void ); +static BICARB_CHAMBER_PRE_GEN_FILL_EXEC_STATE_T handleBicarbChamberPreGenCartridgeFillWaterStartState( void ); +static BICARB_CHAMBER_PRE_GEN_FILL_EXEC_STATE_T handleBicarbChamberPreGenCartridgeFillWaterEndState( void ); +static BICARB_CHAMBER_PRE_GEN_FILL_EXEC_STATE_T handleBicarbChamberPreGenSupplyStart( void ); +static BICARB_CHAMBER_PRE_GEN_FILL_EXEC_STATE_T handleBicarbChamberPreGenPressureCheckState( void ); +static BICARB_CHAMBER_PRE_GEN_FILL_EXEC_STATE_T handleBicarbChamberPreGenSupplyVentStartState(void); +static BICARB_CHAMBER_PRE_GEN_FILL_EXEC_STATE_T handleBicarbChamberPreGenSupplyVentEndState(void); static DRY_BICART_DEPRESSURIZE_EXEC_STATE_T handleDryBicartDepressurizeStartState( void ); static DRY_BICART_DEPRESSURIZE_EXEC_STATE_T handleDryBicartDepressurizeVentStartState( void ); @@ -244,12 +258,14 @@ dryBiCartDataPublicationTimerCounter = 0; biCartFillCycleCounter = 0; dryBiCarbSupplyStartTime = 0; - dryBiCarbSypplyVentStartTime = 0; + dryBiCarbSupplyVentStartTime = 0; dryBiCartDrainStartTime = 0; //dryBiCartDrainLastCondSampleTime = 0; //dryBiCartDrainCondStableCount = 0; dryBiCartDrainTimePeriod = 0; dryBiCartPersistenceStartTime = 0; + dryBiCarbPreGenSupplyStartTime = 0; + dryBiCartPreGenPersistenceStartTime = 0; drybicartPersistenceOnLowercartPressureStartTime = 0; prevDryBicartState = DRY_BICART_IDLE; } @@ -309,6 +325,11 @@ execDryBicartDepressurize(); break; + case DRY_BICART_PRE_GEN_CHAMBER_FILL: + // Fill Bicarb chamber F exec + execBicarbChamberPreGenFillMode(); + break; + default: // software fault, dryBicartStartRequest = DRY_BICART_IDLE; @@ -505,6 +526,117 @@ /*********************************************************************//** * @brief + * The execBicarbChamberFillMode 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 execBicarbChamberPreGenFillMode( void ) +{ + // TODO in pregen mode call hydChamberWaterInletControl(); + // execute bicarb chamber fill state machine + switch ( bicarbChamberPreGenFillExecState ) + { + case PRE_GEN_BICARB_CHAMBER_START_STATE: + bicarbChamberPreGenFillExecState = handleBicarbChamberPreGenStartState(); + break; + + case PRE_GEN_BICARB_CARTRIDGE_FILL_WATER_START_STATE: + bicarbChamberPreGenFillExecState = handleBicarbChamberPreGenCartridgeFillWaterStartState(); + break; + + case PRE_GEN_BICARB_CARTRIDGE_FILL_WATER_END_STATE: + bicarbChamberPreGenFillExecState = handleBicarbChamberPreGenCartridgeFillWaterEndState(); + break; + + case PRE_GEN_BICARB_CHAMBER_SUPPLY_STATE: + bicarbChamberPreGenFillExecState = handleBicarbChamberPreGenSupplyStart(); + break; + + case PRE_GEN_BICARB_CHAMBER_PRESSURE_CHECK_STATE: + bicarbChamberPreGenFillExecState = handleBicarbChamberPreGenPressureCheckState(); + break; + + case PRE_GEN_BICARB_SUPPLY_VENT_START_STATE: + bicarbChamberPreGenFillExecState = handleBicarbChamberPreGenSupplyVentStartState(); + break; + + case PRE_GEN_BICARB_SUPPLY_VENT_END_STATE: + bicarbChamberPreGenFillExecState = handleBicarbChamberPreGenSupplyVentEndState(); + 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 bicarbChamberPreGenFillExecState; +} + +/*********************************************************************//** + * @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 setBicartPreGenFillRequested( void ) +{ + BOOL result = FALSE; + BOOL requestStatus = getU32OverrideValue( &bicarbChamberPreGenFillRequested ) \ + || getU32OverrideValue( &dryBiCartDrainRequested ) || \ + getU32OverrideValue( &dryBiCartDepressurizeRequested ) ; + + //ensure that there is no other operation in progress before new request set to true + if ( FALSE == requestStatus ) + { + bicarbChamberPreGenFillRequested.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 getBicartPreGenFillRequested( void ) +{ + BOOL result = FALSE; + + if ( ( TRUE == getU32OverrideValue( &bicarbChamberPreGenFillRequested ) ) ) + { + 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. + *************************************************************************/ +BICARB_CHAMBER_PRE_GEN_FILL_EXEC_STATE_T getCurrentDryBiCartPreGenFillExecState( void ) +{ + return bicarbChamberPreGenFillExecState; +} + +/*********************************************************************//** + * @brief * The setBicarbChamberFillRequested function sets the chmaberFillRequest * flag value to be True. * @details \b Inputs: dryBiCartFillRequested, dryBiCartDrainRequested, @@ -515,7 +647,7 @@ BOOL setBicarbChamberFillRequested( void ) { BOOL result = FALSE; - BOOL requestStatus = getU32OverrideValue( &dryBiCartFillRequested ) ||\ + BOOL requestStatus = getU32OverrideValue( &bicarbChamberFillRequested ) ||\ getU32OverrideValue( &dryBiCartDrainRequested ) || \ getU32OverrideValue( &dryBiCartDepressurizeRequested ); @@ -757,6 +889,11 @@ { dryBicartStartRequest = DRY_BICART_DEPRESSURIZE; } + if ( TRUE == getBicartPreGenFillRequested() ) + { + // supply + dryBicartStartRequest = DRY_BICART_PRE_GEN_CHAMBER_FILL ; + } else { // idle @@ -1189,7 +1326,7 @@ setValveState( D85_VALV, VALVE_STATE_OPEN ); dryBiCarbSupplyStartTime = getMSTimerCount(); - dryBiCarbSypplyVentStartTime = getMSTimerCount(); + dryBiCarbSupplyVentStartTime = getMSTimerCount(); state = BICARB_SUPPLY_VENT_START_STATE; } @@ -1247,7 +1384,7 @@ BICARB_CHAMBER_FILL_EXEC_STATE_T state = BICARB_SUPPLY_VENT_START_STATE; F32 d66Pressure = getFilteredPressure( D66_PRES ); - if ( TRUE == didTimeout( dryBiCarbSypplyVentStartTime, DRY_BICART_SUPPLY_VENT_TIME_MS ) ) + if ( TRUE == didTimeout( dryBiCarbSupplyVentStartTime, DRY_BICART_SUPPLY_VENT_TIME_MS ) ) { //Vent chamber F to atmosphere setValveState( D64_VALV, VALVE_STATE_OPEN ); @@ -1269,7 +1406,7 @@ state = BICARB_SUPPLY_VENT_END_STATE; } } - else if ( ( TRUE == didTimeout( dryBiCarbSypplyVentStartTime, DRY_BICART_FILL_VENT_MAX_TIME_MS ) ) ) + else if ( ( TRUE == didTimeout( dryBiCarbSupplyVentStartTime, DRY_BICART_FILL_VENT_MAX_TIME_MS ) ) ) { setValveState( D85_VALV, VALVE_STATE_CLOSED ); dryBiCartPersistenceStartTime = 0; @@ -1515,7 +1652,7 @@ F32 d66Pressure = getFilteredPressure( D66_PRES ); - if ( TRUE == didTimeout( dryBiCarbSypplyVentStartTime, DRY_BICART_SUPPLY_VENT_TIME_MS ) ) + if ( TRUE == didTimeout( dryBiCarbSupplyVentStartTime, DRY_BICART_SUPPLY_VENT_TIME_MS ) ) { //Vent chamber F to atmosphere setValveState( D64_VALV, VALVE_STATE_OPEN ); @@ -1572,6 +1709,275 @@ /*********************************************************************//** * @brief + * The handleBicarbChamberStartState function wait for bicarb chamber fill request + * @details \b Inputs: bicarbChamberFillRequested + * @details \b Outputs: none + * @return the next drybicart fluid drain state. + *************************************************************************/ +static BICARB_CHAMBER_PRE_GEN_FILL_EXEC_STATE_T handleBicarbChamberPreGenStartState( void ) +{ + BICARB_CHAMBER_PRE_GEN_FILL_EXEC_STATE_T state = PRE_GEN_BICARB_CHAMBER_START_STATE; + + dryBiCartPressureDecayStartTimeFlag = FALSE; + + if ( TRUE == getU32OverrideValue( &bicarbChamberPreGenFillRequested ) ) + { + state = PRE_GEN_BICARB_CARTRIDGE_FILL_WATER_START_STATE; + } + + return state; +} +/*********************************************************************//** + * @brief + * The handleBicarbChamberCartridgeFillWaterStartState function fill water in the dry bicart + * @details \b Inputs: none + * @details \b Outputs: valve states, dryBiCarbSupplyStartTime, dryBiCartPersistenceStartTime + * @return the next bicarb cartridge fill water end state. + *************************************************************************/ +static BICARB_CHAMBER_PRE_GEN_FILL_EXEC_STATE_T handleBicarbChamberPreGenCartridgeFillWaterStartState( void ) +{ + BICARB_CHAMBER_PRE_GEN_FILL_EXEC_STATE_T state = PRE_GEN_BICARB_CARTRIDGE_FILL_WATER_END_STATE; + + // 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 + setValveState( D65_VALV, VALVE_STATE_OPEN ); + setValveState( D64_VALV, VALVE_STATE_OPEN ); + setValveState( D14_VALV, VALVE_STATE_OPEN ); + + dryBiCarbPreGenSupplyStartTime = getMSTimerCount(); + dryBiCartPreGenPersistenceStartTime = 0; + + return state; +} + +/*********************************************************************//** + * @brief + * The handleBicarbChamberCartridgeFillWaterStartState function stop water in the dry bicart + * @details \b Inputs: D66 pressure, dryBiCartPersistenceStartTime + * @details \b Outputs: valve states + * @return the next bicarb chamber check level state. + *************************************************************************/ +static BICARB_CHAMBER_PRE_GEN_FILL_EXEC_STATE_T handleBicarbChamberPreGenCartridgeFillWaterEndState( void ) +{ + BICARB_CHAMBER_PRE_GEN_FILL_EXEC_STATE_T state = PRE_GEN_BICARB_CARTRIDGE_FILL_WATER_END_STATE; + F32 d66Pressure = getFilteredPressure( D66_PRES ); + F32 fillCompletePressure = GET_FILL_COMPLETE_PRESSURE_PSI; + + // check D66 pressure greater than or equal to 17 PSI + if ( d66Pressure >= fillCompletePressure ) + { + // start the persistence timer once d66 reaches 17 PSI + if ( 0 == dryBiCartPreGenPersistenceStartTime ) + { + dryBiCartPreGenPersistenceStartTime = getMSTimerCount(); + } + + // 200 ms persistence on D66 pressure since pressure overshoot just after D65 opening + if ( TRUE == didTimeout( dryBiCartPreGenPersistenceStartTime, DRY_BICART_PERSISTENCE_DURATION_MS ) ) + { + // Close water inlet valve as D66 pressure reaches 1 PSI after persistence + setValveState( D65_VALV, VALVE_STATE_CLOSED ); + dryBiCartPreGenPersistenceStartTime = 0; + + state = PRE_GEN_BICARB_CHAMBER_SUPPLY_STATE; + } + } + else + { + dryBiCartPreGenPersistenceStartTime = 0; + } + + return state; +} + +/*********************************************************************//** + * @brief + * The handleBicarbChamberSupplyStart function open the bicarb inlet valve (D80). + * @details \b Inputs: none + * @details \b Outputs: valve states, dryBiCarbSupplyStartTime + * @return the next bicarb chamber fill state. + *************************************************************************/ +static BICARB_CHAMBER_PRE_GEN_FILL_EXEC_STATE_T handleBicarbChamberPreGenSupplyStart( void ) +{ + BICARB_CHAMBER_PRE_GEN_FILL_EXEC_STATE_T state = PRE_GEN_BICARB_CHAMBER_PRESSURE_CHECK_STATE; + + // 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 + dryBiCarbPreGenSupplyStartTime = getMSTimerCount(); + + // TODO: alarm + + return state; +} + +/*********************************************************************//** + * @brief + * The handleBicarbChamberPressureCheckStartState function actuates the vent valve + * present in the Bicart assembly. + * @details \b Inputs: D66 Pressure, D63 level, dryBiCarbSupplyStartTime, + * dryBiCarbSypplyVentStartTime, dryBiCartPersistenceStartTime, bicarbChamberLevel, + * dryBiCartPressureDecayStartTimeFlag, drybicartPersistenceOnLowercartPressureStartTime + * @details \b Outputs: dryBiCarbSypplyVentStartTime + * @return the next bicarb chamber Supply Vent Start state. + *************************************************************************/ +static BICARB_CHAMBER_PRE_GEN_FILL_EXEC_STATE_T handleBicarbChamberPreGenPressureCheckState( void ) +{ + BICARB_CHAMBER_PRE_GEN_FILL_EXEC_STATE_T state = PRE_GEN_BICARB_CHAMBER_PRESSURE_CHECK_STATE; + F32 d66Pressure = getFilteredPressure( D66_PRES ); + LVL_STATE_T bicarbChamberLevel = getBicarbChamberLevelStatus(); + + // 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( dryBiCarbPreGenSupplyStartTime, DRY_BICART_SUPPLY_VALVE_D80_OPEN_TIME_MS ) ) ) + { + setValveState( D65_VALV, VALVE_STATE_CLOSED ); + + // start the timer for d66 pressure decay + if( FALSE == dryBiCartPressureDecayStartTimeFlag ) + { + dryBiCarbPreGenSupplyStartTime = getMSTimerCount(); + dryBiCartPressureDecayStartTimeFlag = TRUE; + } + // do not close the D80 valve, wait till d66 decays to 3 PSI + if ( TRUE == didTimeout( dryBiCarbPreGenSupplyStartTime, DRY_BICART_SUPPLY_COMPLETE_TIME_MS ) ) + { + if ( d66Pressure <= getDryBicartLowerCartPressure() ) + { + setValveState( D80_VALV, VALVE_STATE_CLOSED ); + setValveState( D85_VALV, VALVE_STATE_OPEN ); + + dryBiCarbPreGenSupplyStartTime = getMSTimerCount(); + dryBiCarbSupplyVentStartTime = getMSTimerCount(); + + state = PRE_GEN_BICARB_SUPPLY_VENT_START_STATE; + } + } + } + else if ( d66Pressure <= getDryBicartLowerCartPressure() ) + { + // start persistence timer + if ( 0 == drybicartPreGenPersistenceOnLowercartPressureStartTime ) + { + drybicartPreGenPersistenceOnLowercartPressureStartTime = getMSTimerCount(); + } + // 200 ms persistence on D66 pressure + if ( TRUE == didTimeout( drybicartPreGenPersistenceOnLowercartPressureStartTime, DRY_BICART_PERSISTENCE_DURATION_MS ) ) + { + setValveState( D65_VALV, VALVE_STATE_OPEN ); + drybicartPreGenPersistenceOnLowercartPressureStartTime = 0; + } + } + // Close water inlet valve as fill is complete. + else if ( d66Pressure >= getDryBicartUpperCartPressure() ) + { + // start persistence timer + if ( 0 == dryBiCartPreGenPersistenceStartTime ) + { + dryBiCartPreGenPersistenceStartTime = getMSTimerCount(); + } + + // 200 ms persistence on D66 pressure since pressure overshoot just after D65 opening + if ( TRUE == didTimeout( dryBiCartPreGenPersistenceStartTime, DRY_BICART_PERSISTENCE_DURATION_MS ) ) + { + setValveState( D65_VALV, VALVE_STATE_CLOSED ); + dryBiCartPreGenPersistenceStartTime = 0; + } + } + else + { + dryBiCartPreGenPersistenceStartTime = 0; + drybicartPreGenPersistenceOnLowercartPressureStartTime = 0; + } + + return state; +} + +/*********************************************************************//** + * @brief + * The handleBicarbChamberSupplyVentStartState function actuates the vent valve + * present in the Bicart assembly. + * @details \b Inputs: dryBiCarbSypplyVentStartTime, dryBiCartPersistenceStartTime + * @details \b Outputs: dryBiCarbSypplyVentStartTime + * @return the next bicarb chamber Supply Vent End state. + *************************************************************************/ +static BICARB_CHAMBER_PRE_GEN_FILL_EXEC_STATE_T handleBicarbChamberPreGenSupplyVentStartState(void) +{ + BICARB_CHAMBER_PRE_GEN_FILL_EXEC_STATE_T state = PRE_GEN_BICARB_SUPPLY_VENT_START_STATE; + F32 d66Pressure = getFilteredPressure( D66_PRES ); + + if ( TRUE == didTimeout( dryBiCarbSupplyVentStartTime, 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 == dryBiCartPreGenPersistenceStartTime ) + { + dryBiCartPreGenPersistenceStartTime = getMSTimerCount(); + } + // 200 ms persistence on D66 pressure since pressure overshoot just after D65 opening + if ( TRUE == didTimeout( dryBiCartPreGenPersistenceStartTime, DRY_BICART_PERSISTENCE_DURATION_MS ) ) + { + setValveState( D85_VALV, VALVE_STATE_CLOSED ); + dryBiCartPreGenPersistenceStartTime = 0; + + state = PRE_GEN_BICARB_SUPPLY_VENT_END_STATE; + } + } + else if ( ( TRUE == didTimeout( dryBiCarbSupplyVentStartTime, DRY_BICART_FILL_VENT_MAX_TIME_MS ) ) ) + { + setValveState( D85_VALV, VALVE_STATE_CLOSED ); + dryBiCartPreGenPersistenceStartTime = 0; + dryBiCartFillVentTimeOut = TRUE; + + state = PRE_GEN_BICARB_SUPPLY_VENT_END_STATE; + } + else + { + dryBiCartPreGenPersistenceStartTime = 0; + } + } + + return state; +} + +/*********************************************************************//** + * @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. + *************************************************************************/ +static BICARB_CHAMBER_PRE_GEN_FILL_EXEC_STATE_T handleBicarbChamberPreGenSupplyVentEndState(void) +{ + BICARB_CHAMBER_PRE_GEN_FILL_EXEC_STATE_T state = PRE_GEN_BICARB_SUPPLY_VENT_END_STATE; + + bicarbChamberPreGenFillRequested.data = FALSE; + // for this request override also cleared + bicarbChamberPreGenFillRequested.ovData = FALSE; + + dryBiCartPressureDecayStartTimeFlag = FALSE; + + state = PRE_GEN_BICARB_CHAMBER_START_STATE; + + dryBicartStartRequest = DRY_BICART_IDLE; + + return state; +} +/*********************************************************************//** + * @brief * The publishDryBicartData function broadcasts the dry bicart * data at defined interval. * @details \b Inputs: dryBiCartDataPublicationTimerCounter