Index: firmware/App/Modes/TreatmentStop.c =================================================================== diff -u -rfba69244d94307e50fefaa1e88bcbb979584461e -rc9890bc0bc9a1d779be9fec7e0478cfc6fba1cfb --- firmware/App/Modes/TreatmentStop.c (.../TreatmentStop.c) (revision fba69244d94307e50fefaa1e88bcbb979584461e) +++ firmware/App/Modes/TreatmentStop.c (.../TreatmentStop.c) (revision c9890bc0bc9a1d779be9fec7e0478cfc6fba1cfb) @@ -23,6 +23,7 @@ #include "DialOutFlow.h" #include "ModeTreatment.h" #include "OperationModes.h" +#include "SalineBolus.h" #include "SystemCommMessages.h" #include "TaskGeneral.h" #include "TreatmentStop.h" @@ -58,6 +59,7 @@ static TREATMENT_STOP_STATE_T handleTreatmentStopDialysateRecircState( void ); static TREATMENT_STOP_STATE_T handleTreatmentStopBloodRecircState( void ); static TREATMENT_STOP_STATE_T handleTreatmentStopRecoverBloodDetectState( void ); +static TREATMENT_STOP_STATE_T handleTreatmentStopDeliverSalineBolusState( void ); static void handleTreatmentStopBloodSittingTimer( void ); static void publishTreatmentStopData( void ); @@ -279,6 +281,10 @@ currentTxStopState = handleTreatmentStopRecoverBloodDetectState(); break; + case TREATMENT_STOP_DELIVER_SALINE_BOLUS_STATE: + currentTxStopState = handleTreatmentStopDeliverSalineBolusState(); + break; + default: SET_ALARM_WITH_2_U32_DATA( ALARM_ID_HD_SOFTWARE_FAULT, SW_FAULT_ID_TREATMENT_STOP_INVALID_STATE, currentTxStopState ); break; @@ -347,6 +353,10 @@ setupForBloodRecirculationStopState(); result = TREATMENT_STOP_RECIRC_DIALYSATE_ONLY_STATE; } + else if ( ( TREATMENT_STOP_DELIVER_SALINE_BOLUS_STATE != state ) /*&&*/ ) + { + result = TREATMENT_STOP_DELIVER_SALINE_BOLUS_STATE; + } } return result; @@ -383,7 +393,7 @@ handleTreatmentStopBloodSittingTimer(); - result = handleTreatmentStopAlarmsAndSignals(result); + result = handleTreatmentStopAlarmsAndSignals( result ); return result; } @@ -400,7 +410,7 @@ { TREATMENT_STOP_STATE_T result = TREATMENT_STOP_RECIRC_BLOOD_ONLY_STATE; - result = handleTreatmentStopAlarmsAndSignals(result); + result = handleTreatmentStopAlarmsAndSignals( result ); return result; } @@ -449,6 +459,27 @@ /*********************************************************************//** * @brief + * The handleTreatmentStopDeliverSalineBolusState function handles the + * delivery of saline bolus state in treatment stop. + * @details Inputs: none + * @details Outputs: none + * @return next treatment stop state + *************************************************************************/ +static TREATMENT_STOP_STATE_T handleTreatmentStopDeliverSalineBolusState( void ) +{ + TREATMENT_STOP_STATE_T result = TREATMENT_STOP_DELIVER_SALINE_BOLUS_STATE; + + execSalineBolus(); + + // Keep reseting the blood sitting timer + handleTreatmentStopBloodSittingTimer(); + result = handleTreatmentStopAlarmsAndSignals( result ); + + return result; +} + +/*********************************************************************//** + * @brief * The handleTreatmentStopBloodSittingTimer function handles the no re-circ * blood timer. It should only be called when Blood is NOT circulating. * Increments and checks for warning and alarm timeouts.