Index: firmware/App/Modes/ModeHeatDisinfect.c =================================================================== diff -u -r05019ca03114d75099dd3ae6e09f776bd8a2c46e -r9490539a39d2bfd8d40558f3c05b09b48f041e6c --- firmware/App/Modes/ModeHeatDisinfect.c (.../ModeHeatDisinfect.c) (revision 05019ca03114d75099dd3ae6e09f776bd8a2c46e) +++ firmware/App/Modes/ModeHeatDisinfect.c (.../ModeHeatDisinfect.c) (revision 9490539a39d2bfd8d40558f3c05b09b48f041e6c) @@ -162,6 +162,7 @@ static U32 ROFCoolingTimer = 0; ///< RO filter cooling timer. static BOOL hasROFCirculationBeenStarted = FALSE; ///< Flag to indicate the water in RO filter has been recirculated. static U32 targetDisinfectTime = 0; ///< Target disinfect time. +static BOOL haveDrainParamsBeenInit; ///< Boolean flag to indicate whether the drain parameters have been reset or not. // ********** private function prototypes ********** @@ -207,6 +208,7 @@ * isPartialDisinfectInProgress, isDrainPumpOnInMixDrain, * hasROFCirculationBeenStarted, ROFCirculationTimer, targetDisinfectTime * ROFCirculationCoolingCounter, concentratePumpsPrimeTimer, + * haveDrainParamsBeenInit * @return none *************************************************************************/ void initHeatDisinfectMode( void ) @@ -232,6 +234,7 @@ hasROFCirculationBeenStarted = FALSE; concentratePumpsPrimeTimer = 0; targetDisinfectTime = 0; + haveDrainParamsBeenInit = FALSE; } /*********************************************************************//** @@ -1852,20 +1855,29 @@ { DG_RESERVOIR_STATUS_T status = DG_RESERVOIR_ABOVE_TARGET; + // If the drain parameters of the reservoir is not initialized, initialize them + if ( FALSE == haveDrainParamsBeenInit ) + { + initDrainParameters( r ); + haveDrainParamsBeenInit = TRUE; + } + BOOL isDrainComplete = hasTargetDrainVolumeBeenReached( r, drainSteadyStateTimeout ); if ( TRUE == isDrainComplete ) { // Set the state timer in case it needs to be used for another timeout check - stateTimer = getMSTimerCount(); - status = DG_RESERVOIR_REACHED_TARGET; + stateTimer = getMSTimerCount(); + haveDrainParamsBeenInit = FALSE; + status = DG_RESERVOIR_REACHED_TARGET; } else if ( TRUE == didTimeout( stateTimer, timeout ) ) { // Failed to drain on time. Update the previous heat disinfect state and transition to basic cancellation - prevHeatDisinfectState = heatDisinfectState; + prevHeatDisinfectState = heatDisinfectState; alarmDetectedPendingTrigger = ALARM_ID_DG_RESERVOIR_DRAIN_TIMEOUT; - status = DG_RESERVOIR_NOT_REACHED_TARGET; + haveDrainParamsBeenInit = FALSE; + status = DG_RESERVOIR_NOT_REACHED_TARGET; } return status;