Index: firmware/App/Controllers/Fans.c =================================================================== diff -u -r9490539a39d2bfd8d40558f3c05b09b48f041e6c -rede368b67b0aecd60a9d90546eca353eb6f86e58 --- firmware/App/Controllers/Fans.c (.../Fans.c) (revision 9490539a39d2bfd8d40558f3c05b09b48f041e6c) +++ firmware/App/Controllers/Fans.c (.../Fans.c) (revision ede368b67b0aecd60a9d90546eca353eb6f86e58) @@ -479,7 +479,7 @@ for ( fan = FAN_INLET_1; fan < NUM_OF_FANS_NAMES; fan++ ) { rpm = getMeasuredFanRPM( fan ); - isFanRPMOutOfRange |= ( ( fabs( rpm - fansMinAllowedRPM ) < NEARLY_ZERO ) || ( fabs( rpm - fansMaxAllowedRPM ) < NEARLY_ZERO ) ? TRUE : FALSE ); + isFanRPMOutOfRange |= ( ( rpm < fansMinAllowedRPM ) || ( ( rpm > fansMaxAllowedRPM ) ) ? TRUE : FALSE ); } // If the fans alarm has been raised already, do not raise again Index: firmware/App/Controllers/LoadCell.c =================================================================== diff -u -r986abcfcf047822cad1a10c1ee0924a80dd5f512 -rede368b67b0aecd60a9d90546eca353eb6f86e58 --- firmware/App/Controllers/LoadCell.c (.../LoadCell.c) (revision 986abcfcf047822cad1a10c1ee0924a80dd5f512) +++ firmware/App/Controllers/LoadCell.c (.../LoadCell.c) (revision ede368b67b0aecd60a9d90546eca353eb6f86e58) @@ -320,7 +320,7 @@ } else { - SET_ALARM_WITH_1_F32_DATA( ALARM_ID_DG_LOAD_CELLS_TARE_WEIGHT_OUT_OF_RANGE, weight ) + //SET_ALARM_WITH_1_F32_DATA( ALARM_ID_DG_LOAD_CELLS_TARE_WEIGHT_OUT_OF_RANGE, weight ) // DEBUG_DENALI } } Index: firmware/App/Modes/ModeChemicalDisinfect.c =================================================================== diff -u -r9490539a39d2bfd8d40558f3c05b09b48f041e6c -rede368b67b0aecd60a9d90546eca353eb6f86e58 --- firmware/App/Modes/ModeChemicalDisinfect.c (.../ModeChemicalDisinfect.c) (revision 9490539a39d2bfd8d40558f3c05b09b48f041e6c) +++ firmware/App/Modes/ModeChemicalDisinfect.c (.../ModeChemicalDisinfect.c) (revision ede368b67b0aecd60a9d90546eca353eb6f86e58) @@ -146,7 +146,8 @@ static U32 rsrvrFillStableTimeCounter = 0; ///< Reservoirs fill stable time counter. static ALARM_ID_T alarmDetectedPendingTrigger; ///< Chemical disinfect alarm to raise. static U32 numberOfPostDisinfectRinses = NUM_OF_POST_DISINFECT_RINSES; ///< Number of times to rinse the fluid path after chemical disinfect. -static U32 primeAcidSteadyStateCounter = 0; +static U32 primeAcidSteadyStateCounter = 0; ///< Prime acid steady state counter. +static BOOL haveDrainParamsBeenInit; ///< Boolean flag to indicate whether the drain parameters have been reset or not. // ********** private function prototypes ********** @@ -192,7 +193,7 @@ * R1ChemDisinfectVol, R2ChemDisinfectVol, overallChemDisinfectTimer, * cancellationMode, rsrvrFillStableTimeCounter, prevChemDisinfectState * isPartialDisinfectInProgress, numberOfPostDisinfectRinses, - * primeAcidSteadyStateCounter, chemDisinfectUIState + * primeAcidSteadyStateCounter, chemDisinfectUIState, haveDrainParamsBeenInit * @return none *************************************************************************/ void initChemicalDisinfectMode( void ) @@ -214,6 +215,7 @@ numberOfPostDisinfectRinses = NUM_OF_POST_DISINFECT_RINSES; primeAcidSteadyStateCounter = 0; chemDisinfectUIState = CHEM_DISINFECT_UI_STATE_NOT_RUNNING; + haveDrainParamsBeenInit = FALSE; } /*********************************************************************//** @@ -1894,20 +1896,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 chemical disinfect state and transition to basic cancellation - prevChemDisinfectState = chemDisinfectState; + prevChemDisinfectState = chemDisinfectState; + haveDrainParamsBeenInit = FALSE; alarmDetectedPendingTrigger = ALARM_ID_DG_RESERVOIR_DRAIN_TIMEOUT; - status = DG_RESERVOIR_NOT_REACHED_TARGET; + status = DG_RESERVOIR_NOT_REACHED_TARGET; } return status; Index: firmware/App/Modes/ModeFlush.c =================================================================== diff -u -r05019ca03114d75099dd3ae6e09f776bd8a2c46e -rede368b67b0aecd60a9d90546eca353eb6f86e58 --- firmware/App/Modes/ModeFlush.c (.../ModeFlush.c) (revision 05019ca03114d75099dd3ae6e09f776bd8a2c46e) +++ firmware/App/Modes/ModeFlush.c (.../ModeFlush.c) (revision ede368b67b0aecd60a9d90546eca353eb6f86e58) @@ -94,6 +94,7 @@ static U32 dataPublishCounter = 0; ///< Flush data publish counter. static BOOL hasWaterCancellationBeenSet = FALSE; ///< Water cancellation set/not set boolean flag. static F32 flushLinesVolumeL = 0.0; ///< Volume of water pumped by RO pump during flush lines state. +static BOOL haveDrainParamsBeenInit; ///< Boolean flag to indicate whether the drain parameters have been reset or not. // ********** private function prototypes ********** @@ -124,7 +125,7 @@ * @details Outputs: flushState, prevFlushState, rsrvrFillStableTimeCounter, * overallFlushElapsedTime, isThisInitialDrain, dataPublishCounter, * rsrvr1Status, rsrvr2Status, hasWaterCancellationBeenSet, - * flushLinesVolumeL + * flushLinesVolumeL, haveDrainParamsBeenInit * @return none *************************************************************************/ void initFlushMode( void ) @@ -141,6 +142,7 @@ rsrvr2Status = NUM_OF_DG_RESERVOIR_STATUS; hasWaterCancellationBeenSet = FALSE; flushLinesVolumeL = 0.0; + haveDrainParamsBeenInit = FALSE; } /*********************************************************************//** @@ -972,20 +974,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 - stateTimerStart = getMSTimerCount(); - status = DG_RESERVOIR_REACHED_TARGET; + stateTimerStart = getMSTimerCount(); + haveDrainParamsBeenInit = FALSE; + status = DG_RESERVOIR_REACHED_TARGET; } else if ( TRUE == didTimeout( stateTimerStart, timeout ) ) { // Failed to drain on time - prevFlushState = flushState; + prevFlushState = flushState; + haveDrainParamsBeenInit = FALSE; alarmDetectedPendingTrigger = ALARM_ID_DG_RESERVOIR_DRAIN_TIMEOUT; - status = DG_RESERVOIR_NOT_REACHED_TARGET; + status = DG_RESERVOIR_NOT_REACHED_TARGET; } return status;