Index: firmware/App/Modes/ModeFlush.c =================================================================== diff -u -rf7d8d74379a55ff917b5896627b20ec7c05c0c01 -r75f5cf4a8484f0c08b90edfb4b49a6268e51de65 --- firmware/App/Modes/ModeFlush.c (.../ModeFlush.c) (revision f7d8d74379a55ff917b5896627b20ec7c05c0c01) +++ firmware/App/Modes/ModeFlush.c (.../ModeFlush.c) (revision 75f5cf4a8484f0c08b90edfb4b49a6268e51de65) @@ -8,7 +8,7 @@ * @file ModeFlush.c * * @author (last) Dara Navaei -* @date (last) 05-Jun-2023 +* @date (last) 21-Jun-2023 * * @author (original) Leonardo Baloa * @date (original) 20-Dec-2019 @@ -731,7 +731,7 @@ * within the defined time, it transitions to water cancellation state. * @details Inputs: stateTimerStart, flushLinesVolumeL * @details Outputs: stateTimerStart, flushLinesVolumeL, - * alarmDetectedPendingTrigger + * alarmDetectedPendingTrigger, hasFlushStatusBeenWrittenToNV * @return next state of the flush state machine *************************************************************************/ static DG_FLUSH_STATE_T handleFlushModeFlushCirculationDrainLineState( void ) @@ -756,8 +756,9 @@ setValveState( VDR, VALVE_STATE_RECIRC_C_TO_NC ); setROPumpTargetFlowRateLPM( RO_PUMP_TARGET_FLOW_RATE_LPM, RO_PUMP_MAX_PRESSURE_PSI ); - stateTimerStart = getMSTimerCount(); - state = DG_FLUSH_STATE_FLUSH_CIRCULATION; + hasFlushStatusBeenWrittenToNV = FALSE; + stateTimerStart = getMSTimerCount(); + state = DG_FLUSH_STATE_FLUSH_CIRCULATION; } else if ( TRUE == didTimeout( stateTimerStart, FLUSH_DRAIN_LINE_TIMEOUT_MS ) ) { @@ -925,17 +926,21 @@ /*********************************************************************//** * @brief * The handleFlushModeComplete function handles the complete state. - * @details Inputs: none + * @details Inputs: hasFlushStatusBeenWrittenToNV * @details Outputs: none * @return next state of the flush state machine *************************************************************************/ static DG_FLUSH_STATE_T handleFlushModeComplete( void ) { DG_FLUSH_STATE_T state = DG_FLUSH_STATE_COMPLETE; - stopDGFlush(); writeDisinfectDataToNV( USAGE_INFO_BASIC_FLUSH ); + if ( TRUE == hasFlushStatusBeenWrittenToNV ) + { + stopDGFlush(); + } + return state; }