Index: firmware/App/Modes/StateTxPaused.c =================================================================== diff -u -r9c833ef5623ce842267e284d958820ac0dc3a7fc -r069dee3a2428d3c6bb281db1844a372ae6e2063a --- firmware/App/Modes/StateTxPaused.c (.../StateTxPaused.c) (revision 9c833ef5623ce842267e284d958820ac0dc3a7fc) +++ firmware/App/Modes/StateTxPaused.c (.../StateTxPaused.c) (revision 069dee3a2428d3c6bb281db1844a372ae6e2063a) @@ -8,7 +8,7 @@ * @file StateTxPaused.c * * @author (last) Praneeth Bunne -* @date (last) 29-May-2026 +* @date (last) 26-Jun-2026 * * @author (original) Sean Nash * @date (original) 21-Apr-2025 @@ -22,13 +22,15 @@ #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" @@ -65,6 +67,8 @@ 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. @@ -298,26 +302,15 @@ /*********************************************************************//** * @brief * The handleTreatmentPausedFluidBolusState function handles the fluid - * 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 + * bolus sub-state of the Treatment Paused state machine. + * @details \b Inputs: pauseBolusResumeState * @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() ) { @@ -332,15 +325,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: currentTxPausedState + * @details \b Inputs: none * @details \b Outputs: fluidBolusRequested * @return TRUE if request is accepted, FALSE if rejected. *************************************************************************/ BOOL signalPauseTreatFluidBolusRequest( void ) { BOOL result = FALSE; - if ( TREATMENT_PAUSED_RECOVER_BLOOD_DETECT_STATE != currentTxPausedState ) + if ( TRUE == isFluidBolusPermitted() ) { fluidBolusRequested = TRUE; result = TRUE; @@ -351,6 +344,26 @@ /*********************************************************************//** * @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. @@ -542,7 +555,7 @@ } // Set if bolus is permitted or not. - setBolusPermitted( isBolusAllowedByActiveAlarms() ); + setBolusPermitted( isFluidBolusPermitted() ); } /*********************************************************************//**