Index: firmware/App/Modes/TreatmentStop.c =================================================================== diff -u -rf63f470a02e5584d107becc6d6ffcacaac88b19e -r3833c8a7a90288a6010a625a884048c775c598d3 --- firmware/App/Modes/TreatmentStop.c (.../TreatmentStop.c) (revision f63f470a02e5584d107becc6d6ffcacaac88b19e) +++ firmware/App/Modes/TreatmentStop.c (.../TreatmentStop.c) (revision 3833c8a7a90288a6010a625a884048c775c598d3) @@ -7,8 +7,8 @@ * * @file TreatmentStop.c * -* @author (last) Dara Navaei -* @date (last) 07-Apr-2023 +* @author (last) Sean Nash +* @date (last) 21-Jun-2023 * * @author (original) Sean * @date (original) 15-Jan-2020 @@ -85,7 +85,8 @@ void transitionToTreatmentStop( void ) { initTreatmentStop(); - + setCurrentSubState( (U32)currentTxStopState ); + setCurrent4thLevelState( NO_SUB_STATE ); // Set user alarm recovery actions allowed in this sub-mode setAlarmUserActionEnabled( ALARM_USER_ACTION_RESUME, TRUE ); @@ -108,6 +109,8 @@ setupForDialysateRecirculationState(); + signalUserRateChange(); // so pressure limits re-stabilize + // Reset saline bolus state in case alarm interrupted one resetSalineBolus(); @@ -231,7 +234,6 @@ { TREATMENT_STOP_STATE_T priorSubState = currentTxStopState; - // Execute treatment stop sub-mode state machine switch ( currentTxStopState ) { case TREATMENT_STOP_RECIRC_STATE: @@ -257,6 +259,7 @@ if ( priorSubState != currentTxStopState ) { + setCurrentSubState( (U32)currentTxStopState ); SEND_EVENT_WITH_2_U32_DATA( HD_EVENT_SUB_STATE_CHANGE, priorSubState, currentTxStopState ); } // Broadcast treatment stop status @@ -402,15 +405,19 @@ // Ensure we do not sit in stopped state for too long (if blood in line) if ( getRinsebackCompleted() != TRUE ) { - if ( ++bloodSittingTimerCtr > WARN_TIME_BLOOD_SITTING ) + bloodSittingTimerCtr++; + if ( FALSE == doesAlarmStatusIndicateEndTxOnly() ) // Alarms appropriate only if we are not already at an alarm stop, end Tx only { - activateAlarmNoData( ALARM_ID_HD_BLOOD_SITTING_WARNING ); + if ( bloodSittingTimerCtr > WARN_TIME_BLOOD_SITTING ) + { + activateAlarmNoData( ALARM_ID_HD_BLOOD_SITTING_WARNING ); + } + if ( bloodSittingTimerCtr > MAX_TIME_BLOOD_SITTING ) + { + // Activate the alarm + activateAlarmNoData( ALARM_ID_HD_TREATMENT_STOPPED_NO_RINSEBACK ); + } } - if ( bloodSittingTimerCtr > MAX_TIME_BLOOD_SITTING ) - { - // Activate the alarm - activateAlarmNoData( ALARM_ID_HD_TREATMENT_STOPPED_NO_RINSEBACK ); - } } else { @@ -449,7 +456,9 @@ data.timeout = 0; data.countdown = 0; - if ( getRinsebackCompleted() != TRUE ) + if ( ( getRinsebackCompleted() != TRUE ) && + ( isAlarmActive( ALARM_ID_HD_TREATMENT_RINSEBACK_TIMEOUT_ALARM ) != TRUE ) && + ( isAlarmActive( ALARM_ID_HD_TREATMENT_STOPPED_NO_RINSEBACK ) != TRUE ) ) { if ( bloodSittingTimerCtr > 0 ) {