Index: firmware/App/Modes/StateTxPaused.c =================================================================== diff -u -r9c833ef5623ce842267e284d958820ac0dc3a7fc -r4ea39ac34ede5011de1954b7c58761df25120fcf --- firmware/App/Modes/StateTxPaused.c (.../StateTxPaused.c) (revision 9c833ef5623ce842267e284d958820ac0dc3a7fc) +++ firmware/App/Modes/StateTxPaused.c (.../StateTxPaused.c) (revision 4ea39ac34ede5011de1954b7c58761df25120fcf) @@ -29,6 +29,7 @@ #include "StateTxPaused.h" #include "Switches.h" #include "TaskGeneral.h" +#include "TubeSetInstall.h" #include "TxParams.h" #include "Valves.h" #include "Valve3Way.h" @@ -65,6 +66,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,11 +301,7 @@ /*********************************************************************//** * @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. + * bolus sub-state of the Treatment Paused state machine. * @details \b Inputs: none * @details \b Outputs: currentTxPausedState * @return next treatment paused state. @@ -311,13 +310,6 @@ { 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 +324,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 +343,30 @@ /*********************************************************************//** * @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 ( TUBE_SET_TYPE_HDF == getTubeSetType() ) + { + result = ( TRUE == getDialysateGoodToDeliverStatus() ) ? TRUE : FALSE; + } + else + { + 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 +558,7 @@ } // Set if bolus is permitted or not. - setBolusPermitted( isBolusAllowedByActiveAlarms() ); + setBolusPermitted( isFluidBolusPermitted() ); } /*********************************************************************//**