Index: firmware/App/Controllers/SpentChamberFill.c =================================================================== diff -u -rd210786d6c7d75bb0b4d9e18efc40a01d85123fe -r173453569b2eb31b3f19572bf5386440667b0162 --- firmware/App/Controllers/SpentChamberFill.c (.../SpentChamberFill.c) (revision d210786d6c7d75bb0b4d9e18efc40a01d85123fe) +++ firmware/App/Controllers/SpentChamberFill.c (.../SpentChamberFill.c) (revision 173453569b2eb31b3f19572bf5386440667b0162) @@ -53,6 +53,7 @@ // ********** private function prototypes ********** +static SPENT_CHAMBER_FILL_EXEC_STATE_T handleSpentChamberFillWaitPressureStabilizeState( void ); static SPENT_CHAMBER_FILL_EXEC_STATE_T handleSpentChamberFillState1FillStart( void ); static SPENT_CHAMBER_FILL_EXEC_STATE_T handleSpentChamberState1DosingControl( void ); static SPENT_CHAMBER_FILL_EXEC_STATE_T handleSpentChamberFillState1FillEnd(void); @@ -118,9 +119,13 @@ switch ( spentChamberFillExecState ) { case SPENT_CHAMBER_FILL_STATE_START: - spentChamberFillExecState = SPENT_CHAMBER_FILL_STATE1_FILL_START; + spentChamberFillExecState = SPENT_CHAMBER_FILL_WAIT_PRESSURE_STABILIZE_STATE; break; + case SPENT_CHAMBER_FILL_WAIT_PRESSURE_STABILIZE_STATE: + spentChamberFillExecState = handleSpentChamberFillWaitPressureStabilizeState(); + break; + case SPENT_CHAMBER_FILL_STATE1_FILL_START: spentChamberFillExecState = handleSpentChamberFillState1FillStart(); break; @@ -182,6 +187,33 @@ /*********************************************************************//** * @brief + * The handleSpentChamberFillWaitPressureStabilizeState function introduces the pressure + * stabilization period before starting the spent chamber fill + * for state 2 fill process. + * @details \b Inputs: none + * @details \b Outputs: valve states + * @return none. + *************************************************************************/ +static SPENT_CHAMBER_FILL_EXEC_STATE_T handleSpentChamberFillWaitPressureStabilizeState( void ) +{ + SPENT_CHAMBER_FILL_EXEC_STATE_T nextState = SPENT_CHAMBER_FILL_WAIT_PRESSURE_STABILIZE_STATE; + + F32 freshDialPressure = getFilteredPressure( D18_PRES ); + F32 spentDialPressure = getFilteredPressure( D51_PRES ); + + BOOL spentInRange = ( ( spentDialPressure >= SPENT_DIAL_FILL_PRESSURE_MIN_PSIG ) && ( spentDialPressure <= SPENT_DIAL_FILL_PRESSURE_MAX_PSIG ) ); + BOOL freshInRange = ( ( freshDialPressure >= FRESH_DIAL_FILL_PRESSURE_MIN_PSIG ) && ( freshDialPressure <= FRESH_DIAL_FILL_PRESSURE_MAX_PSIG ) ); + + if ( ( TRUE == spentInRange ) && ( TRUE == freshInRange ) ) + { + nextState = SPENT_CHAMBER_FILL_STATE1_FILL_START; + } + + return nextState; +} + +/*********************************************************************//** + * @brief * The valveControlForSCFillState2FillStart function actuates the valve combination * for state 2 fill process. * @details \b Inputs: none @@ -255,7 +287,6 @@ static SPENT_CHAMBER_FILL_EXEC_STATE_T handleSpentChamberState1DosingControl( void ) { SPENT_CHAMBER_FILL_EXEC_STATE_T state = SPENT_CHAMBER_FILL_STATE1_DOSING_CNTRL; - // On dosing completion, transition to next state if ( ( TRUE == isConcentratePumpDosingCompleted( D11_PUMP ) ) && ( TRUE == isConcentratePumpDosingCompleted( D10_PUMP ) ) )