Index: firmware/App/Modes/ModeGenIdle.c =================================================================== diff -u -r7ed011e79e1338f614cbcc7d3cedf07d359196b7 -re6f3a632890f96a5aa282922d11df148bdd06587 --- firmware/App/Modes/ModeGenIdle.c (.../ModeGenIdle.c) (revision 7ed011e79e1338f614cbcc7d3cedf07d359196b7) +++ firmware/App/Modes/ModeGenIdle.c (.../ModeGenIdle.c) (revision e6f3a632890f96a5aa282922d11df148bdd06587) @@ -24,6 +24,7 @@ #include "FPGA.h" #include "Heaters.h" #include "ModeGenIdle.h" +#include "NVDataMgmt.h" #include "OperationModes.h" #include "Pressures.h" #include "ROPump.h" @@ -45,7 +46,6 @@ #define TARGET_RO_FLOW_RATE_L 0.3 ///< Target flow rate for RO pump. #define TARGET_FLUSH_LINES_RO_FLOW_RATE_L 0.6 ///< Target flow rate for RO pump. -#define FLUSH_LINES_VOLUME_L 0.01 ///< Water volume (in Liters) to flush when starting generation idle mode. // ********** private data ********** @@ -154,6 +154,35 @@ /*********************************************************************//** * @brief + * The getCurrentGenIdleState function returns the current state of the + * generation idle mode. + * @details Inputs: recircState + * @details Outputs: none + * @return the current state of generation idle mode + *************************************************************************/ +DG_GEN_IDLE_MODE_STATE_T getCurrentGenIdleState( void ) +{ + return genIdleState; +} + +/*********************************************************************//** + * @brief + * The requestDGStop function handles an HD request to stop (return to standby mode). + * @details Inputs: none + * @details Outputs: DG standby mode requested + * @return TRUE if request accepted, FALSE if not. + *************************************************************************/ +BOOL requestDGStop( void ) +{ + BOOL result = TRUE; + + requestNewOperationMode( DG_MODE_STAN ); + + return result; +} + +/*********************************************************************//** + * @brief * The handleFlushLinesState function executes the flush lines state of the * generation idle mode state machine. * @details Inputs: flushLinesVolumeL @@ -169,9 +198,10 @@ // Integrate volume of water moved through line flushLinesVolumeL += waterVolume; - // When enough water volume has flowed to flush the lines, transition to flush water state - if ( flushLinesVolumeL >= FLUSH_LINES_VOLUME_L ) + // When enough water volume has flowed to flush the lines, transition to re-circ state + if ( flushLinesVolumeL >= getRecirculationDrainVol() ) { + setValveState( VDR, VALVE_STATE_RECIRC_C_TO_NC ); setROPumpTargetFlowRate( TARGET_RO_FLOW_RATE_L, TARGET_RO_PRESSURE_PSI ); result = DG_GEN_IDLE_MODE_STATE_FLUSH_WATER; } @@ -192,33 +222,4 @@ return DG_GEN_IDLE_MODE_STATE_FLUSH_WATER; } -/*********************************************************************//** - * @brief - * The requestDGStop function handles an HD request to stop (return to standby mode). - * @details Inputs: none - * @details Outputs: DG standby mode requested - * @return TRUE if request accepted, FALSE if not. - *************************************************************************/ -BOOL requestDGStop( void ) -{ - BOOL result = TRUE; - - requestNewOperationMode( DG_MODE_STAN ); - - return result; -} - -/*********************************************************************//** - * @brief - * The getCurrentGenIdleState function returns the current state of the - * generation idle mode. - * @details Inputs: recircState - * @details Outputs: none - * @return the current state of generation idle mode - *************************************************************************/ -DG_GEN_IDLE_MODE_STATE_T getCurrentGenIdleState( void ) -{ - return genIdleState; -} - /**@}*/