Index: firmware/App/Modes/TreatmentStop.c =================================================================== diff -u -rac2842e1727bf631b7249927f429bbf1368b75ba -r33177024ac5a710bc4ed290795a74abb4f91ff3c --- firmware/App/Modes/TreatmentStop.c (.../TreatmentStop.c) (revision ac2842e1727bf631b7249927f429bbf1368b75ba) +++ firmware/App/Modes/TreatmentStop.c (.../TreatmentStop.c) (revision 33177024ac5a710bc4ed290795a74abb4f91ff3c) @@ -306,41 +306,48 @@ TREATMENT_STOP_STATE_T result = state; BOOL bloodRecircBlocked = isBloodRecircBlocked(); BOOL dialysateRecircBlocked = isDialysateRecircBlocked(); + BOOL bldAlarmsStatus = ( ( TRUE == isAlarmActive( ALARM_ID_HD_BLOOD_LEAK_RECOVERING_PLEASE_WAIT ) ) && + ( FALSE == isAlarmActive( ALARM_ID_HD_BLOOD_LEAK_DETECTED ) ? TRUE : FALSE ) ); - if ( ( TREATMENT_STOP_RECOVER_BLOOD_DETECT_STATE != state ) && ( dialysateRecircBlocked != TRUE ) && - ( TRUE == isAlarmActive( ALARM_ID_HD_BLOOD_LEAK_RECOVERING_PLEASE_WAIT ) ) && ( FALSE == isAlarmActive( ALARM_ID_HD_BLOOD_LEAK_DETECTED ) ) ) + if ( TRUE == bldAlarmsStatus ) { - setupForRecoverBloodDetectState(); - result = TREATMENT_STOP_RECOVER_BLOOD_DETECT_STATE; + if ( TREATMENT_STOP_RECOVER_BLOOD_DETECT_STATE != state ) && ( dialysateRecircBlocked != TRUE ) + { + setupForRecoverBloodDetectState(); + result = TREATMENT_STOP_RECOVER_BLOOD_DETECT_STATE; + } } - // Both unblocked and not in recirculate both state - else if ( ( TREATMENT_STOP_RECIRC_STATE != state ) && ( FALSE == dialysateRecircBlocked ) && ( FALSE == bloodRecircBlocked ) ) + else { - setupForBloodRecirculationState(); - setupForDialysateRecirculationState(); - result = TREATMENT_STOP_RECIRC_STATE; + // Both unblocked and not in recirculate both state + if ( ( TREATMENT_STOP_RECIRC_STATE != state ) && ( FALSE == dialysateRecircBlocked ) && ( FALSE == bloodRecircBlocked ) ) + { + setupForBloodRecirculationState(); + setupForDialysateRecirculationState(); + result = TREATMENT_STOP_RECIRC_STATE; + } + // Both blocked and not in stopped state + else if ( ( TREATMENT_STOP_NO_RECIRC_STATE != state ) && ( TRUE == dialysateRecircBlocked ) && ( TRUE == bloodRecircBlocked ) ) + { + setupForBloodRecirculationStopState(); + setupForDialysateRecirculationStopState(); + result = TREATMENT_STOP_NO_RECIRC_STATE; + } + // Dialysate recirculation blocked and not in blood recirc state + else if ( ( TREATMENT_STOP_RECIRC_BLOOD_ONLY_STATE != state ) && ( TRUE == dialysateRecircBlocked ) && + ( FALSE == bloodRecircBlocked ) ) + { + setupForDialysateRecirculationStopState(); + result = TREATMENT_STOP_RECIRC_BLOOD_ONLY_STATE; + } + // Blood recirculation blocked and not in dialysate recirc state + else if ( ( TREATMENT_STOP_RECIRC_DIALYSATE_ONLY_STATE != state ) && ( TRUE == bloodRecircBlocked ) && + ( FALSE == dialysateRecircBlocked ) ) + { + setupForBloodRecirculationStopState(); + result = TREATMENT_STOP_RECIRC_DIALYSATE_ONLY_STATE; + } } - // Both blocked and not in stopped state - else if ( ( TREATMENT_STOP_NO_RECIRC_STATE != state ) && ( TRUE == dialysateRecircBlocked ) && ( TRUE == bloodRecircBlocked ) ) - { - setupForBloodRecirculationStopState(); - setupForDialysateRecirculationStopState(); - result = TREATMENT_STOP_NO_RECIRC_STATE; - } - // Dialysate recirculation blocked and not in blood recirc state - else if ( ( TREATMENT_STOP_RECIRC_BLOOD_ONLY_STATE != state ) && ( TRUE == dialysateRecircBlocked ) && - ( FALSE == bloodRecircBlocked ) ) - { - setupForDialysateRecirculationStopState(); - result = TREATMENT_STOP_RECIRC_BLOOD_ONLY_STATE; - } - // Blood recirculation blocked and not in dialysate recirc state - else if ( ( TREATMENT_STOP_RECIRC_DIALYSATE_ONLY_STATE != state ) && ( TRUE == bloodRecircBlocked ) && - ( FALSE == dialysateRecircBlocked ) ) - { - setupForBloodRecirculationStopState(); - result = TREATMENT_STOP_RECIRC_DIALYSATE_ONLY_STATE; - } return result; }