Index: firmware/App/Modes/ModeFlush.c =================================================================== diff -u -r1e34d32fcfac88792ed72e55953dee721bacd9d5 -r9426334142cbfdea9ee99e3040fc08ff0247da7b --- firmware/App/Modes/ModeFlush.c (.../ModeFlush.c) (revision 1e34d32fcfac88792ed72e55953dee721bacd9d5) +++ firmware/App/Modes/ModeFlush.c (.../ModeFlush.c) (revision 9426334142cbfdea9ee99e3040fc08ff0247da7b) @@ -16,6 +16,7 @@ ***************************************************************************/ #include "ConcentratePumps.h" +#include "ConductivitySensors.h" #include "CPLD.h" #include "DrainPump.h" #include "FlowSensors.h" @@ -72,7 +73,7 @@ #define RSRVRS_FILL_UP_TIMEOUT_MS ( 5 * 60 * MS_PER_SECOND ) ///< Reservoirs 1 & 2 full fill up timeout in ms. #define RSRVRS_PARTIAL_FILL_TIMEOUT_MS ( 2 * 60 * MS_PER_SECOND ) ///< Reservoirs 1 & 2 partial fill up timeout in ms. #define RSRVRS_DRAIN_TIMEOUT_MS ( 2 * 60 * MS_PER_SECOND ) ///< Reservoirs 1 & 2 drain timeout in ms. -#define FINAL_DRAIN_RO_PUMP_FLOW_LPM 0.6F ///< Final drain RO pump flow rate in L/min. This is used to flush the drain line during drain. +#define FINAL_DRAIN_RO_PUMP_FLOW_LPM 0.8F ///< Final drain RO pump flow rate in L/min. This is used to flush the drain line during drain. // Flush drain line state defines #define FLUSH_DRAIN_LINE_VOLUME_L 0.1F ///< Water volume to flush in liters. @@ -150,7 +151,7 @@ rsrvr1Status = NUM_OF_DG_RESERVOIR_STATUS; rsrvr2Status = NUM_OF_DG_RESERVOIR_STATUS; hasWaterCancellationBeenSet = FALSE; - flushLinesVolumeL = 0.0; + flushLinesVolumeL = 0.0F; haveDrainParamsBeenInit[ DG_RESERVOIR_1 ] = FALSE; haveDrainParamsBeenInit[ DG_RESERVOIR_2 ] = FALSE; stateTimerStart = 0; @@ -185,6 +186,16 @@ *************************************************************************/ U32 execFlushMode( void ) { + checkInletWaterTemperature(); + + if ( flushState != DG_FLUSH_STATE_FLUSH_DRAIN ) + { + // Do not check on the inlet water temperature and conductivity until the inlet filters have been flushed + // The initial states are drain reservoirs but in those states VPi is closed so these alarms are not checked + checkInletWaterConductivity(); + checkInletWaterPressure(); + } + monitorModeFlush(); // Execute current flush state @@ -375,7 +386,7 @@ } else if ( DG_RESERVOIR_NOT_REACHED_TARGET == rsrvr1Status ) { - state = DG_FLUSH_STATE_CANCEL_BASIC_PATH; + state = DG_FLUSH_STATE_CANCEL_WATER_PATH; } return state; @@ -413,6 +424,7 @@ setValveState( VPD, VALVE_STATE_DRAIN_C_TO_NO ); setValveState( VRD2, VALVE_STATE_CLOSED ); setValveState( VPO, VALVE_STATE_NOFILL_C_TO_NO ); + turnOnUVReactor( INLET_UV_REACTOR ); state = DG_FLUSH_STATE_FLUSH_DRAIN; } @@ -644,7 +656,7 @@ // Reservoir 1 drain time out else if ( DG_RESERVOIR_NOT_REACHED_TARGET == rsrvr1Status ) { - state = DG_FLUSH_STATE_CANCEL_BASIC_PATH; + state = DG_FLUSH_STATE_CANCEL_WATER_PATH; } // First reservoir 2 must be completely full but if reservoir 1 is filled before reservoir 2 is full, alarm @@ -926,6 +938,7 @@ DG_FLUSH_STATE_T state = DG_FLUSH_STATE_COMPLETE; stopDGFlush(); + writeDisinfectDataToNV( USAGE_INFO_BASIC_FLUSH ); return state; } @@ -939,7 +952,11 @@ *************************************************************************/ static void failFlushMode( void ) { - SET_ALARM_WITH_1_U32_DATA( alarmDetectedPendingTrigger, prevFlushState ) + if ( alarmDetectedPendingTrigger != ALARM_ID_NO_ALARM ) + { + SET_ALARM_WITH_1_U32_DATA( alarmDetectedPendingTrigger, prevFlushState ) + } + requestNewOperationMode( DG_MODE_FAUL ); } /*********************************************************************//** @@ -1095,6 +1112,8 @@ *************************************************************************/ static void monitorModeFlush( void ) { + BOOL areInletWaterAlarmsActive = FALSE; + #ifndef _RELEASE_ if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_CAPS_MONITOR ) != SW_CONFIG_ENABLE_VALUE ) #endif @@ -1109,6 +1128,19 @@ alarmDetectedPendingTrigger = ALARM_ID_DG_DIALYSATE_OR_CONC_CAP_NOT_IN_PROPER_POSITION; } } + + areInletWaterAlarmsActive |= isAlarmActive( ALARM_ID_DG_CLEANING_MODE_INLET_WATER_TEMP_TOO_HIGH ); + areInletWaterAlarmsActive |= isAlarmActive( ALARM_ID_DG_CLEANING_MODE_INLET_WATER_TEMP_TOO_LOW ); + areInletWaterAlarmsActive |= isAlarmActive( ALARM_ID_DG_CLEANING_MODE_INLET_WATER_PRESSURE_TOO_HIGH ); + areInletWaterAlarmsActive |= isAlarmActive( ALARM_ID_DG_CLEANING_MODE_INLET_WATER_PRESSURE_TOO_LOW ); + areInletWaterAlarmsActive |= isAlarmActive( ALARM_ID_DG_CLEANING_MODE_INLET_WATER_COND_TOO_HIGH ); + areInletWaterAlarmsActive |= isAlarmActive( ALARM_ID_DG_CLEANING_MODE_INLET_WATER_COND_TOO_LOW ); + + if ( ( TRUE == areInletWaterAlarmsActive ) ) + { + prevFlushState = flushState; + flushState = DG_FLUSH_STATE_CANCEL_WATER_PATH; + } } /*********************************************************************//**