Index: firmware/App/Modes/ModeGenIdle.c =================================================================== diff -u -rd502fb7b72c8b3aa4f3a7cdbc4b3c4f7b5ae7c92 -r557f409455dde035899c9f89a8b93f57e8eb7f2b --- firmware/App/Modes/ModeGenIdle.c (.../ModeGenIdle.c) (revision d502fb7b72c8b3aa4f3a7cdbc4b3c4f7b5ae7c92) +++ firmware/App/Modes/ModeGenIdle.c (.../ModeGenIdle.c) (revision 557f409455dde035899c9f89a8b93f57e8eb7f2b) @@ -45,7 +45,7 @@ #define TARGET_RO_PRESSURE_PSI 130 ///< Target pressure for RO pump. #define TARGET_RO_FLOW_RATE_L 0.3 ///< Target flow rate for RO pump. -#define TARGET_FLUSH_LINES_RO_FLOW_RATE_L 0.3 ///< Target flow rate for RO pump. +#define TARGET_FLUSH_WATER_RO_FLOW_RATE_L 0.3 ///< Target flow rate for RO pump. TODO: determine the flow rate /// The time of HD lost comm before DG transition back to standby. #define HD_LOST_COMM_TIMEOUT_MS (5 * SEC_PER_MIN * MS_PER_SECOND ) @@ -54,13 +54,12 @@ static DG_GEN_IDLE_MODE_STATE_T genIdleState; ///< Currently active generation idle state. static DG_GEN_IDLE_MODE_BAD_FILL_STATE_T badFillState; ///< Current active bad fill state. -static F32 flushLinesVolumeL = 0.0; ///< Volume of water pumped by RO pump during flush lines state. +static F32 flushWaterVolumeL = 0.0; ///< Volume of water pumped by RO pump during flush water state. static U32 hdLostCommStartTime_ms = 0; ///< Lost communication with HD start time in ms. // ********** private function prototypes ********** static DG_GEN_IDLE_MODE_STATE_T handleIdleStartState( void ); -static DG_GEN_IDLE_MODE_STATE_T handleFlushLinesState( void ); static DG_GEN_IDLE_MODE_STATE_T handleFlushWaterState( void ); static DG_GEN_IDLE_MODE_STATE_T handleBadFillState( void ); // This state has sub-states 1.0 to 1.4 @@ -81,7 +80,7 @@ { genIdleState = DG_GEN_IDLE_MODE_STATE_START; badFillState = DG_HANDLE_BAD_FILL_STATE_FIRST_DRAIN; - flushLinesVolumeL = 0.0; + flushWaterVolumeL = 0.0; hdLostCommStartTime_ms = 0; } @@ -119,7 +118,7 @@ // because the initial guess in the heaters driver needs the target flow to calculate // the new PWMs for the main and small primary heaters #ifndef DISABLE_FLOW_CONTROL_TREATMENT - setROPumpTargetFlowRateLPM( TARGET_FLUSH_LINES_RO_FLOW_RATE_L, TARGET_RO_PRESSURE_PSI ); + setROPumpTargetFlowRateLPM( TARGET_FLUSH_WATER_RO_FLOW_RATE_L, TARGET_RO_PRESSURE_PSI ); setHeaterTargetTemperature( DG_PRIMARY_HEATER, getPrimaryHeaterTargetTemperature() ); startHeater( DG_PRIMARY_HEATER ); #endif @@ -191,10 +190,6 @@ genIdleState = handleIdleStartState(); break; - case DG_GEN_IDLE_MODE_STATE_FLUSH_LINES: - genIdleState = handleFlushLinesState(); - break; - case DG_GEN_IDLE_MODE_STATE_FLUSH_WATER: genIdleState = handleFlushWaterState(); break; @@ -216,49 +211,20 @@ * @brief * The handleIdleStartState function executes the start state of the * generation idle mode state machine. - * @details Inputs: flushLinesVolumeL - * @details Outputs: Integrate volume of water moved through line + * @details Inputs: none + * @details Outputs: none * @return the next state *************************************************************************/ static DG_GEN_IDLE_MODE_STATE_T handleIdleStartState( void ) { DG_GEN_IDLE_MODE_STATE_T result = DG_GEN_IDLE_MODE_STATE_START; - if ( TRUE == isAvgConductivityOutOfRange() ) + if ( TRUE == isAvgConductivityOutOfRange() ) // bad fill due to conductivity is out of range and assume bottles need prime { result = DG_GEN_IDLE_MODE_STATE_HANDLE_BAD_FILL ; } else { - result = DG_GEN_IDLE_MODE_STATE_FLUSH_LINES; - } - - return result; -} - -/*********************************************************************//** - * @brief - * The handleFlushLinesState function executes the flush lines state of the - * generation idle mode state machine. - * @details Inputs: flushLinesVolumeL - * @details Outputs: Integrate volume of water moved through line - * @return the next state - *************************************************************************/ -static DG_GEN_IDLE_MODE_STATE_T handleFlushLinesState( void ) -{ - DG_GEN_IDLE_MODE_STATE_T result = DG_GEN_IDLE_MODE_STATE_FLUSH_LINES; - F32 waterFlowRate = getMeasuredROFlowRateLPM(); - F32 waterVolume = ( ( waterFlowRate / SEC_PER_MIN ) / ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ); - - // 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 >= getFlushLineVolume() ) - { -#ifndef DISABLE_FLOW_CONTROL_TREATMENT - setROPumpTargetFlowRateLPM( TARGET_RO_FLOW_RATE_L, TARGET_RO_PRESSURE_PSI ); -#endif result = DG_GEN_IDLE_MODE_STATE_FLUSH_WATER; }