Index: firmware/App/Modes/StateTxPaused.c =================================================================== diff -u -r069dee3a2428d3c6bb281db1844a372ae6e2063a -re4eceb1ac6e8091d10e0fab49d2d5a9c5e5f1c67 --- firmware/App/Modes/StateTxPaused.c (.../StateTxPaused.c) (revision 069dee3a2428d3c6bb281db1844a372ae6e2063a) +++ firmware/App/Modes/StateTxPaused.c (.../StateTxPaused.c) (revision e4eceb1ac6e8091d10e0fab49d2d5a9c5e5f1c67) @@ -8,7 +8,7 @@ * @file StateTxPaused.c * * @author (last) Praneeth Bunne -* @date (last) 26-Jun-2026 +* @date (last) 29-May-2026 * * @author (original) Sean Nash * @date (original) 21-Apr-2025 @@ -22,15 +22,13 @@ #include "DDInterface.h" #include "FluidBolus.h" #include "Messaging.h" -#include "ModeStandby.h" #include "ModeTreatment.h" //#include "NVDataMgmt.h" #include "OperationModes.h" #include "RotaryValve.h" #include "StateTxPaused.h" #include "Switches.h" #include "TaskGeneral.h" -#include "TubeSetInstall.h" #include "TxParams.h" #include "Valves.h" #include "Valve3Way.h" @@ -67,8 +65,6 @@ static void transitionToTxPausedState( TREATMENT_PAUSED_STATE_T newState ); static void publishTreatmentPausedData( void ); -static BOOL isFluidBolusPermitted( void ); - /*********************************************************************//** * @brief * The initTreatmentPaused function initializes the Treatment Paused State unit. @@ -302,15 +298,26 @@ /*********************************************************************//** * @brief * The handleTreatmentPausedFluidBolusState function handles the fluid - * bolus sub-state of the Treatment Paused state machine. - * @details \b Inputs: pauseBolusResumeState + * bolus sub-state of the Treatment Paused state machine. Entered either + * when an alarm fires during an active bolus in a calling state, or when + * the user requests a new bolus from the paused state. + * Monitors the permitted alarm set every tick — aborts the bolus if a + * non-permitted alarm becomes active. + * @details \b Inputs: none * @details \b Outputs: currentTxPausedState * @return next treatment paused state. *************************************************************************/ static TREATMENT_PAUSED_STATE_T handleTreatmentPausedFluidBolusState( void ) { TREATMENT_PAUSED_STATE_T result = TREATMENT_PAUSED_FLUID_BOLUS_STATE; + // Monitor permitted alarms every tick + if ( ( TRUE == isFluidBolusActive() ) && ( FALSE == isBolusAllowedByActiveAlarms() ) ) + { + signalAbortFluidBolus(); + setBolusPermitted( FALSE ); + } + // Return to pre-bolus sub-state upon bolus complete or abort if ( FALSE == isFluidBolusActive() ) { @@ -325,15 +332,15 @@ * The signalPauseFluidBolusRequest function handles a fluid bolus request * while in the Treatment Paused state. Bolus request is rejected while in * Recover blood detect state. - * @details \b Inputs: none + * @details \b Inputs: currentTxPausedState * @details \b Outputs: fluidBolusRequested * @return TRUE if request is accepted, FALSE if rejected. *************************************************************************/ BOOL signalPauseTreatFluidBolusRequest( void ) { BOOL result = FALSE; - if ( TRUE == isFluidBolusPermitted() ) + if ( TREATMENT_PAUSED_RECOVER_BLOOD_DETECT_STATE != currentTxPausedState ) { fluidBolusRequested = TRUE; result = TRUE; @@ -344,26 +351,6 @@ /*********************************************************************//** * @brief - * The isFluidBolusPermitted function determines whether a fluid bolus - * is currently permitted or not. - * @details \b Inputs: none - * @details \b Outputs: none - * @return TRUE if bolus is permitted, FALSE otherwise. - *************************************************************************/ -static BOOL isFluidBolusPermitted( void ) -{ - BOOL result = FALSE; - - if ( FLUID_TYPE_SALINE == getFluidType() ) - { - result = ( TRUE != isBloodRecircBlocked() ) ? TRUE : FALSE; - } - - return result; -} - -/*********************************************************************//** - * @brief * The handleTreatmentPausedBloodSittingTimer 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. @@ -555,7 +542,7 @@ } // Set if bolus is permitted or not. - setBolusPermitted( isFluidBolusPermitted() ); + setBolusPermitted( isBolusAllowedByActiveAlarms() ); } /*********************************************************************//**