Index: firmware/App/Modes/TreatmentStop.c =================================================================== diff -u -r9944e4f766d9eb4cdf7a5ca7587e3ceca556e106 -r1f91b5a53bda942b0967817bbd5e68a499dbf816 --- firmware/App/Modes/TreatmentStop.c (.../TreatmentStop.c) (revision 9944e4f766d9eb4cdf7a5ca7587e3ceca556e106) +++ firmware/App/Modes/TreatmentStop.c (.../TreatmentStop.c) (revision 1f91b5a53bda942b0967817bbd5e68a499dbf816) @@ -1,14 +1,14 @@ /************************************************************************** * -* Copyright (c) 2020-2022 Diality Inc. - All Rights Reserved. +* Copyright (c) 2020-2023 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * @file TreatmentStop.c * -* @author (last) Darren Cox -* @date (last) 11-May-2022 +* @author (last) Michael Garthwaite +* @date (last) 19-Jan-2023 * * @author (original) Sean * @date (original) 15-Jan-2020 @@ -90,6 +90,7 @@ // Set user alarm recovery actions allowed in this sub-mode setAlarmUserActionEnabled( ALARM_USER_ACTION_RESUME, TRUE ); + if ( TRUE == getRinsebackCompleted() ) { // block rinseback action if already done setAlarmUserActionEnabled( ALARM_USER_ACTION_RINSEBACK, FALSE ); @@ -143,6 +144,7 @@ static void setupForDialysateRecirculationState( void ) { // Re-circulate dialysate side of dialyzer w/ heating to maintain temperature + doorClosedRequired( TRUE, TRUE ); setDialInPumpTargetFlowRate( DIALYSATE_FLOW_RATE_FOR_RECIRC, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_CLOSED_LOOP ); cmdStartDGTrimmerHeater(); } @@ -158,6 +160,7 @@ *************************************************************************/ static void setupForBloodRecirculationState( void ) { + doorClosedRequired( TRUE, TRUE ); // Open VBA and VBV valves to patient for blood recirculation setValvePosition( VBA, VALVE_POSITION_B_OPEN ); setValvePosition( VBV, VALVE_POSITION_B_OPEN ); @@ -215,6 +218,8 @@ *************************************************************************/ void execTreatmentStop( void ) { + TREATMENT_STOP_STATE_T priorSubState = currentTxStopState; + // Execute treatment stop sub-mode state machine switch ( currentTxStopState ) { @@ -239,6 +244,10 @@ break; } + if ( priorSubState != currentTxStopState ) + { + SEND_EVENT_WITH_2_U32_DATA( HD_EVENT_SUB_STATE_CHANGE, priorSubState, currentTxStopState ); + } // Broadcast treatment stop status publishTreatmentStopData(); } @@ -254,8 +263,8 @@ static TREATMENT_STOP_STATE_T handleTreatmentStopAlarmsAndSignals( TREATMENT_STOP_STATE_T state ) { TREATMENT_STOP_STATE_T result = state; - bool bloodRecircBlocked = isBloodRecircBlocked(); - bool dialysateRecircBlocked = isDialysateRecircBlocked(); + BOOL bloodRecircBlocked = isBloodRecircBlocked(); + BOOL dialysateRecircBlocked = isDialysateRecircBlocked(); // Both unblocked and not in recirculate both state if ( (TREATMENT_STOP_RECIRC_STATE != state) && ( FALSE == dialysateRecircBlocked ) @@ -361,9 +370,11 @@ { TREATMENT_STOP_STATE_T result = TREATMENT_STOP_NO_RECIRC_STATE; + doorClosedRequired( FALSE, FALSE ); + handleTreatmentStopBloodSittingTimer(); - result = handleTreatmentStopAlarmsAndSignals(result); + result = handleTreatmentStopAlarmsAndSignals( result ); return result; }