Index: firmware/App/Modes/ModeStandby.c =================================================================== diff -u -r47205a5002f27add91d8548f31c8a6fa18993fea -r54e58f64179ea382d2e2c403c8c3b9a15a612636 --- firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision 47205a5002f27add91d8548f31c8a6fa18993fea) +++ firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision 54e58f64179ea382d2e2c403c8c3b9a15a612636) @@ -51,7 +51,7 @@ static BOOL flushFilterRequest = FALSE; ///< Flag indicating HD has requested to flush filters static BOOL endSampleWaterRequest = FALSE; ///< Flag indicating HD has requested to end sample water -static BOOL pendingStartDGRequest = FALSE; ///< Flag indicating HD has requested DG start (go to re-circulate mode). +static BOOL pendingStartDGRequest = FALSE; ///< Flag indicating HD has requested DG start (go to generation idle mode). static U32 waterSampleStartTime = 0; ///< Time stamp for start of water sample state. static U32 filterFlushStartTime = 0; ///< Time stamp for start of filter flush state. static U32 filterFlushPublishTimerCounter = 0; ///< Filter flush data publish timer counter. @@ -64,7 +64,6 @@ static DG_STANDBY_MODE_STATE_T handleStandbyFlushFilterState( void ); static DG_STANDBY_MODE_STATE_T handleStandbyFlushFilterIdleState( void ); static DG_STANDBY_MODE_STATE_T handleStandbySampleWaterState( void ); -static U32 getFilterFlushTimePeriod( void ); /*********************************************************************//** * @brief @@ -168,17 +167,13 @@ flushFilterRequest = FALSE; filterFlushStartTime = getMSTimerCount(); setValveState( VPI, VALVE_STATE_OPEN ); -#ifndef V_2_SYSTEM setValveState( VPD, VALVE_STATE_OPEN_C_TO_NC ); -#else - setValveState( VPD, VALVE_STATE_OPEN ); // TODO: VPD drain state is closed for V3 -#endif state = DG_STANDBY_MODE_STATE_FLUSH_FILTER; } else if ( TRUE == pendingStartDGRequest ) { pendingStartDGRequest = FALSE; - requestNewOperationMode( DG_MODE_CIRC ); + requestNewOperationMode( DG_MODE_GENE ); } return state; @@ -195,12 +190,13 @@ static DG_STANDBY_MODE_STATE_T handleStandbyFlushFilterState( void ) { DG_STANDBY_MODE_STATE_T state = DG_STANDBY_MODE_STATE_FLUSH_FILTER; - U32 const filterFlushTimePeriod_ms = getFilterFlushTimePeriod(); + U32 const filterFlushTimePeriod_ms = getU32OverrideValue( &filterFlushTimePeriod ); checkInletPressure(); if ( TRUE == didTimeout( filterFlushStartTime, filterFlushTimePeriod_ms ) ) { + setValveState( VPI, VALVE_STATE_CLOSED ); state = DG_STANDBY_MODE_STATE_FLUSH_FILTER_IDLE; } @@ -213,15 +209,24 @@ broadcastFilterFlushData( timeout, countdown ); } + if ( TRUE == endSampleWaterRequest ) + { + endSampleWaterRequest = FALSE; + setValveState( VPI, VALVE_STATE_CLOSED ); + setValveState( VPD, VALVE_STATE_CLOSED ); + state = DG_STANDBY_MODE_STATE_IDLE; + } + return state; } /*********************************************************************//** * @brief - * The handleStandbyFlushFilterIdleState function executes the flush filter state - * of the standby mode state machine. - * @details Inputs: filterFLushStartTime - * @details Outputs: Flushed the filters + * The handleStandbyFlushFilterIdleState function executes the flush filter + * idle state of the standby mode state machine. + * @details Inputs: filterFLushStartTime, startSampleWaterRequest, endSampleWaterRequest + * @details Outputs: Flushed the filters, startSampleWaterRequest, endSampleWaterRequest, + * waterSampleStartTime * @return the next state *************************************************************************/ static DG_STANDBY_MODE_STATE_T handleStandbyFlushFilterIdleState( void ) @@ -239,12 +244,9 @@ if ( TRUE == endSampleWaterRequest ) { + endSampleWaterRequest = FALSE; setValveState( VPI, VALVE_STATE_CLOSED ); -#ifndef V_2_SYSTEM setValveState( VPD, VALVE_STATE_DRAIN_C_TO_NO ); -#else - setValveState( VPD, VALVE_STATE_CLOSED ); -#endif state = DG_STANDBY_MODE_STATE_IDLE; } @@ -266,13 +268,10 @@ // After HD requests to stop or 10 seconds has elapsed, close and return to idle state if ( ( TRUE == stopSampleWaterRequest ) || ( TRUE == didTimeout( waterSampleStartTime, MAX_WATER_SAMPLE_TIME_MS ) ) ) { + stopSampleWaterRequest = FALSE; setValveState( VSP, VALVE_STATE_CLOSED ); -#ifndef V_2_SYSTEM setValveState( VPD, VALVE_STATE_DRAIN_C_TO_NO ); -#else - setValveState( VPD, VALVE_STATE_OPEN ); // TODO: VPD drain state is closed for V3 -#endif state = DG_STANDBY_MODE_STATE_FLUSH_FILTER_IDLE; } @@ -324,7 +323,7 @@ break; case SAMPLE_WATER_CMD_END: - if ( ( DG_MODE_STAN == getCurrentOperationMode() ) && ( DG_STANDBY_MODE_STATE_FLUSH_FILTER_IDLE == standbyState ) ) + if ( DG_MODE_STAN == getCurrentOperationMode() ) { endSampleWaterRequest = TRUE; cmdResponse.rejected = FALSE; @@ -342,7 +341,7 @@ /*********************************************************************//** * @brief - * The requestDGStart function handles an HD request to start (go to re-circulate mode). + * The requestDGStart function handles an HD request to start (go to generation idle mode). * @details Inputs: standbyState * @details Outputs: pendingSampleWaterRequest * @return TRUE if request accepted, FALSE if not. @@ -439,26 +438,7 @@ return standbyState; } -/*********************************************************************//** - * @brief - * The getFilterFlushTimePeriod function gets the filter flush time period. - * @details Inputs: filterFlushTimePeriod - * @details Outputs: none - * @return the current filter flush time period (in ms). - *************************************************************************/ -static U32 getFilterFlushTimePeriod( void ) -{ - U32 result = filterFlushTimePeriod.data; - if ( OVERRIDE_KEY == filterFlushTimePeriod.override ) - { - result = filterFlushTimePeriod.ovData; - } - - return result; -} - - /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/