Index: firmware/App/Modes/ModeFlush.c =================================================================== diff -u -r34ed52c598042fdcfa5526e3b1d46fa09b040199 -re86af65442a36724461317980814f0868bd8c995 --- firmware/App/Modes/ModeFlush.c (.../ModeFlush.c) (revision 34ed52c598042fdcfa5526e3b1d46fa09b040199) +++ firmware/App/Modes/ModeFlush.c (.../ModeFlush.c) (revision e86af65442a36724461317980814f0868bd8c995) @@ -44,7 +44,7 @@ #define DRAIN_PUMP_TARGET_RPM 1800 ///< Drain pump target RPM during drain. // Drain R1 & R2 states defines -#define DRAIN_WEIGHT_UNCHANGE_TIMEOUT ( 6 * MS_PER_SECOND ) ///< Time period of unchanged weight during draining before timeout. +#define DRAIN_WEIGHT_UNCHANGE_TIMEOUT ( 6 * MS_PER_SECOND ) ///< Time period of unchanged weight during draining before timeout. // Flush drain path state defines #define FLUSH_DRAIN_WAIT_TIME_MS ( 1 * 60 * MS_PER_SECOND ) ///< Flush Drain path wait time in milliseconds. TODo original time is 2 minutes @@ -286,6 +286,9 @@ { DG_FLUSH_STATE_T state = DG_FLUSH_STATE_START; + // Reset the load cells lowest weight prior to starting the run + resetReservoirsLowestWeight(); + // Start overall flush timer overallFlushElapsedTimeStart = getMSTimerCount(); @@ -590,13 +593,13 @@ U32 drainPumpRPM = getTargetDrainPumpRPM(); // Keep monitoring the status of reservoir 1 as the same time - rsrvr1Status = getRsrvrFillStatus( DG_RESERVOIR_1, RSRVRS_PARTIAL_FILL_VOL_ML, RSRVRS_PARTIAL_FILL_TIMEOUT_MS ); + F32 volume = getLoadCellSmallFilteredWeight( LOAD_CELL_RESERVOIR_1_PRIMARY ); // Reservoir 1 cannot be filled before reservoir 2 is filled and is overflowing to reservoir 1. If reservoir 1 has already // reached to target volume, it means reservoir 2's load cell might be reading incorrect values. This situation might continue // until reservoir 1 is filled up and the tubing might expand or leak. // Before checking whether reservoir 1 is filled pre-maturely, we have to make sure reservoir 1 is drained completely to make // sure the extra volume that is read is not because of previous water that is being drained currently and it is above 500 mL - if ( ( DG_RESERVOIR_REACHED_TARGET == rsrvr1Status ) && ( 0 == drainPumpRPM ) ) + if ( ( volume > RSRVRS_PARTIAL_FILL_VOL_ML ) && ( 0 == drainPumpRPM ) ) { prevFlushState = state; alarmDetectedPendingTrigger = ALARM_ID_DG_INVALID_LOAD_CELL_VALUE; @@ -664,6 +667,7 @@ setValveState( VPD, VALVE_STATE_DRAIN_C_TO_NC ); setValveState( VRC, VALVE_STATE_RECIRC_C_TO_NC ); setValveState( VDR, VALVE_STATE_RECIRC_C_TO_NC ); + setValveState( VPO, VALVE_STATE_NOFILL_C_TO_NO ); setROPumpTargetFlowRate( RO_PUMP_TARGET_FLOW_RATE_LPM, RO_PUMP_MAX_PRESSURE_PSI ); stateTimerStart = getMSTimerCount();