Index: firmware/App/Modes/ModePreTreat.c =================================================================== diff -u -r044d8892373acc5545020aab894cd1943c4d7449 -r06eb4485aab0b6f160610358395d8a568f239ed1 --- firmware/App/Modes/ModePreTreat.c (.../ModePreTreat.c) (revision 044d8892373acc5545020aab894cd1943c4d7449) +++ firmware/App/Modes/ModePreTreat.c (.../ModePreTreat.c) (revision 06eb4485aab0b6f160610358395d8a568f239ed1) @@ -993,6 +993,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 ) ) @@ -1019,6 +1020,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 ) @@ -1053,18 +1055,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 ); @@ -1242,7 +1240,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 ) Index: firmware/App/Modes/Prime.c =================================================================== diff -u -raa7b1f5f68aae23c1c52b32658fcb625c29accfb -r06eb4485aab0b6f160610358395d8a568f239ed1 --- firmware/App/Modes/Prime.c (.../Prime.c) (revision aa7b1f5f68aae23c1c52b32658fcb625c29accfb) +++ firmware/App/Modes/Prime.c (.../Prime.c) (revision 06eb4485aab0b6f160610358395d8a568f239ed1) @@ -594,8 +594,6 @@ rsrvrCmd.reservoirID = (U32)DG_RESERVOIR_1; rsrvrCmd.useLastTrimmerHeaterDC = FALSE; - cmdSetDGActiveReservoir( &rsrvrCmd ); - if ( TRUE == hasDGCompletedReservoirSwitch() ) { U32 dialyzerDialysateVolume = getDialyzerDialysateVolume();