Index: firmware/App/Modes/SalineBolus.c =================================================================== diff -u -r1a36e9bd718b40ceaee21dd12eca2da353828e30 -r0bb3fe3f34c02bd19c36aff2b98876e46a2ad177 --- firmware/App/Modes/SalineBolus.c (.../SalineBolus.c) (revision 1a36e9bd718b40ceaee21dd12eca2da353828e30) +++ firmware/App/Modes/SalineBolus.c (.../SalineBolus.c) (revision 0bb3fe3f34c02bd19c36aff2b98876e46a2ad177) @@ -15,7 +15,6 @@ * ***************************************************************************/ - #include "BloodFlow.h" #include "Dialysis.h" #include "ModeTreatment.h" @@ -44,6 +43,7 @@ static U32 salineBolusBroadcastTimerCtr; ///< Saline bolus data broadcast timer counter used to schedule when to transmit data. static BOOL salineBolusStartRequested; ///< Flag indicates a saline bolus start has been requested by user. static BOOL salineBolusAbortRequested; ///< Flag indicates a salien bolus abort has been requested by user. +static BOOL airTrapFillInProgress; ///< Flag indicates an air trap fill is in progress. static F32 totalSalineVolumeDelivered_mL; ///< Volume (mL) in total of saline delivered so far (cumulative for all boluses including current one). static F32 bolusSalineVolumeDelivered_mL; ///< Volume (mL) of current bolus delivered so far (calculated from measured blood flow rate). @@ -74,6 +74,7 @@ bolusSalineVolumeDelivered_mL = 0.0; salineBolusStartRequested = FALSE; salineBolusAbortRequested = FALSE; + airTrapFillInProgress = FALSE; bolusSalineLastVolumeTimeStamp = getMSTimerCount(); } @@ -90,6 +91,7 @@ bolusSalineVolumeDelivered_mL = 0.0; salineBolusStartRequested = FALSE; salineBolusAbortRequested = FALSE; + airTrapFillInProgress = FALSE; currentSalineBolusState = SALINE_BOLUS_STATE_IDLE; resetUF(); } @@ -125,6 +127,8 @@ break; } + airTrapFillInProgress = isAirTrapFillInProgress(); + if ( priorSubState != currentSalineBolusState ) { setCurrent4thLevelState( (U32)currentSalineBolusState ); @@ -217,7 +221,7 @@ } else if ( ( TRUE == isAnyAlarmActive() ) && ( ( TRUE == isBloodRecircBlocked() ) || ( TRUE == isRinseBackBlocked() ) ) ) { - // Any alarm can be active but blood recirculation and dialysate recirculation cannot be blocked in their properties in order + // Any alarm can be active but blood recirculation and rinseback cannot be blocked in their properties in order // to do saline bolus rejReason = REQUEST_REJECT_REASON_SALINE_BOLUS_NOT_ALLOWED; } @@ -395,6 +399,23 @@ bolusSalineVolumeDelivered_mL += volSinceLastUpdateMl; totalSalineVolumeDelivered_mL += volSinceLastUpdateMl; + // if an air trap fill has started, set BP rate and VBV state accordingly + if ( ( airTrapFillInProgress != TRUE ) && ( TRUE == isAirTrapFillInProgress() ) ) + { + // set BP to air trap fill rate if air trap fill has been initiated + setBloodPumpTargetFlowRate( AIR_TRAP_FILL_BLOOD_FLOW_RATE, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_CLOSED_LOOP ); + // close VBV for fill + setValvePosition( VBV, VALVE_POSITION_C_CLOSE ); + } + // if an air trap fill has completed, restore BP and VBV to saline bolus + else if ( ( TRUE == airTrapFillInProgress ) && ( isAirTrapFillInProgress() != TRUE ) ) + { + // Set to patient in case VBV is closed in treatment stop + setValvePosition( VBV, VALVE_POSITION_B_OPEN ); + // Start blood pump at saline bolus rate + setBloodPumpTargetFlowRate( SALINE_BOLUS_FLOW_RATE, MOTOR_DIR_FORWARD, PUMP_CONTROL_MODE_CLOSED_LOOP ); + } + // Check for empty saline bag per arterial line pressure if ( TRUE == isSalineBagEmpty() ) {