Index: firmware/App/Modes/StateTxPaused.c =================================================================== diff -u -r9c833ef5623ce842267e284d958820ac0dc3a7fc -r0b025cea0b0f290ea44714a8fae6d71ea05088b9 --- firmware/App/Modes/StateTxPaused.c (.../StateTxPaused.c) (revision 9c833ef5623ce842267e284d958820ac0dc3a7fc) +++ firmware/App/Modes/StateTxPaused.c (.../StateTxPaused.c) (revision 0b025cea0b0f290ea44714a8fae6d71ea05088b9) @@ -65,6 +65,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 +300,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 +309,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 +323,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 +342,33 @@ /*********************************************************************//** * @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; + BOOL isDialysateGoodToDeliver = TRUE; // TODO: replace TRUE with getDialysateGoodToDeliverStatus() when we are ready + + //TODO: Uncomment and remove the modality when tube set type logic is implemented + //if ( ( TUBE_SET_TYPE_HDF == getTubeSetType() ) + if ( TREATMENT_MODALITY_HDF == getTreatmentParameterU32( TREATMENT_PARAM_TREATMENT_MODALITY ) ) + { + result = ( TRUE == isDialysateGoodToDeliver ) ? 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 +560,7 @@ } // Set if bolus is permitted or not. - setBolusPermitted( isBolusAllowedByActiveAlarms() ); + setBolusPermitted( isFluidBolusPermitted() ); } /*********************************************************************//**