Index: firmware/App/Modes/ModePreTreat.c =================================================================== diff -u -r231665843bcb057cab17d967fa1543d94a66c9df -re408267b7e73d664051a46e65ac248749af8e5be --- firmware/App/Modes/ModePreTreat.c (.../ModePreTreat.c) (revision 231665843bcb057cab17d967fa1543d94a66c9df) +++ firmware/App/Modes/ModePreTreat.c (.../ModePreTreat.c) (revision e408267b7e73d664051a46e65ac248749af8e5be) @@ -992,6 +992,7 @@ cmdStartDG(); } + // Ensure any pending reservoir switches are completed before sending drain command if ( TRUE == hasDGCompletedReservoirSwitch() ) { if ( ( DG_MODE_GENE == dgOpMode ) && ( DG_GEN_IDLE_MODE_STATE_FLUSH_WATER == dgSubMode ) ) @@ -1018,6 +1019,7 @@ DG_CMD_RESPONSE_T dgCmdResp; DG_OP_MODE_T dgOpMode = getDGOpMode(); + // Check DG response to drain command if ( TRUE == getDGCommandResponse( DG_CMD_START_DRAIN, &dgCmdResp ) ) { if ( DG_CMD_REQUEST_REJECT_REASON_NONE == dgCmdResp.rejectCode ) @@ -1052,18 +1054,14 @@ if ( ( DG_MODE_GENE == dgOpMode ) && ( DG_GEN_IDLE_MODE_STATE_FLUSH_WATER == dgSubMode ) ) { - // if fills not yet enabled, check to see if we want to move on to drain the other reservoir - if ( reservoirFlags[ DG_RESERVOIR_1 ].startFlushFill != TRUE ) + // Drain both reservoirs and return to active res 2 before initial fills + if ( ( initialReservoirDrain[ inactiveReservoir ] != TRUE ) || ( inactiveReservoir != DG_RESERVOIR_1 ) ) { - if ( ( initialReservoirDrain[ inactiveReservoir ] != TRUE ) || - ( inactiveReservoir != DG_RESERVOIR_1 ) ) - { - initialReservoirDrain[ inactiveReservoir ] = TRUE; - state = PRE_TREATMENT_RESERVOIR_MGMT_REQUEST_RESERVOIR_SWITCH_STATE; - } + initialReservoirDrain[ inactiveReservoir ] = TRUE; + state = PRE_TREATMENT_RESERVOIR_MGMT_REQUEST_RESERVOIR_SWITCH_STATE; } - - else + // Once both reservoirs drained and returned to active res 2, wait for pre-tx workflow to get to point where fills allowed before filling + else if ( TRUE == reservoirFlags[ DG_RESERVOIR_1 ].startFlushFill ) { volume = getPreTreatmentFillVolume( inactiveReservoir ); @@ -1243,7 +1241,6 @@ { if ( DG_CMD_REQUEST_REJECT_REASON_INVALID_MODE == dgCmdResp.rejectCode ) { - state = PRE_TREATMENT_RESERVOIR_MGMT_REQUEST_RESERVOIR_SWITCH_STATE; } else if ( dgCmdResp.rejectCode != DG_CMD_REQUEST_REJECT_REASON_NONE )