Index: firmware/App/Modes/TreatmentEnd.c =================================================================== diff -u -rccfd15568f1e3d304320c2babb2fd4bcf0413304 -r74be223d47ea7bb0ac7d814e74d3627d830a5fac --- firmware/App/Modes/TreatmentEnd.c (.../TreatmentEnd.c) (revision ccfd15568f1e3d304320c2babb2fd4bcf0413304) +++ firmware/App/Modes/TreatmentEnd.c (.../TreatmentEnd.c) (revision 74be223d47ea7bb0ac7d814e74d3627d830a5fac) @@ -125,6 +125,7 @@ signalDialOutPumpHardStop(); stopSyringePump(); setBloodPumpTargetFlowRate( TX_END_BP_FLOW_RATE_ML_MIN, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_CLOSED_LOOP ); + cmdStopDGTrimmerHeater(); // Continue air trap control startAirTrapControl(); @@ -146,6 +147,8 @@ *************************************************************************/ static void setupForTxEndWait4RinsebackState( void ) { + // No resume alarm action allowed + setAlarmUserActionEnabled( ALARM_USER_ACTION_RESUME, FALSE ); // Open VBA and VBV valves to allow flow from saline bag and to patient venous line setValvePosition( VBA, VALVE_POSITION_B_OPEN ); setValvePosition( VBV, VALVE_POSITION_B_OPEN ); @@ -167,6 +170,8 @@ *************************************************************************/ static void setupForTxEndPausedState( void ) { + // Resume alarm action will take us back to TxEndWait4RinsebackState + setAlarmUserActionEnabled( ALARM_USER_ACTION_RESUME, TRUE ); // Stop blood pump signalBloodPumpHardStop(); // Close arterial and venous lines @@ -219,6 +224,19 @@ { TREATMENT_END_STATE_T result = TREATMENT_END_WAIT_FOR_RINSEBACK_STATE; + // Set reservoir 2 as active so we can drain reservoir 1 ASAP // TODO - I think this should be handled by treatment reservoir mgmt state machine + if ( ( DG_MODE_GENE == getDGOpMode() ) && ( DG_GEN_IDLE_MODE_STATE_FLUSH_WATER == getDGSubMode() ) ) + { + if ( getDGInactiveReservoir() != DG_RESERVOIR_1 ) + { + cmdSetDGActiveReservoir( DG_RESERVOIR_2 ); + } + else + { + cmdStartDGDrain( DRAIN_RESERVOIR_TO_VOLUME_ML, TRUE, FALSE ); + } + } + // Is alarm stop or user reconnect requested? if ( TRUE == doesAlarmStatusIndicateStop() ) { @@ -279,12 +297,12 @@ // Ensure we do not sit in stopped state for too long if ( bloodSittingTimerCtr > WARN_TIME_BLOOD_SITTING ) { - activateAlarmNoData( ALARM_ID_BLOOD_SITTING_WARNING ); + activateAlarmNoData( ALARM_ID_END_OF_TREATMENT_ALARM ); } if ( bloodSittingTimerCtr > MAX_TIME_BLOOD_SITTING ) { // Raise the alarm - activateAlarmNoData( ALARM_ID_TREATMENT_STOPPED_NO_RINSEBACK ); + activateAlarmNoData( ALARM_ID_END_OF_TREATMENT_HIGH ); } }