Index: firmware/App/Controllers/SyringePump.c =================================================================== diff -u -r1cc7e8c241bb79c0af92207a14572e83467e2830 -rc5bb5120f0464a85cf942e19d75a75979b5b190f --- firmware/App/Controllers/SyringePump.c (.../SyringePump.c) (revision 1cc7e8c241bb79c0af92207a14572e83467e2830) +++ firmware/App/Controllers/SyringePump.c (.../SyringePump.c) (revision c5bb5120f0464a85cf942e19d75a75979b5b190f) @@ -187,7 +187,6 @@ static OVERRIDE_F32_T syringePumpMeasHome = { 0.0, 0.0, 0.0, 0 }; ///< Measured optical home (in V). static OVERRIDE_S32_T syringePumpPosition = { 0, 0, 0, 0 }; ///< Encoder based position (in steps). static OVERRIDE_F32_T syringePumpVolumeDelivered = { 0.0, 0.0, 0.0, 0 }; ///< Measured volume delivered (in mL). -static F32 syringePumpVolumeRequired = 0.0F; ///< Volume required for complete therapy (in mL). static OVERRIDE_F32_T heparinBolusTargetRate = { HEPARIN_BOLUS_TARGET_RATE, 0.0, HEPARIN_BOLUS_TARGET_RATE, 0 }; ///< Target rate of the heprin bolus in mL/hour static OVERRIDE_U32_T syringePumpStatus = {0, 0, 0, 0}; ///< Syringe pump status reported by FPGA. @@ -211,6 +210,7 @@ static U32 syringePumpSpeedCalcTimerCounter; ///< Used to calculate measured rate from change in position over time. static MOTOR_DIR_T syringePumpControllerMeasuredDirection; ///< Measured direction of syringe pump per controller. static MOTOR_DIR_T syringePumpEncoderMeasuredDirection; ///< Measured direction of syringe pump per encoder position relative to previous. +static F32 syringePumpVolumeRequired; ///< Volume required for complete therapy (in mL). static BOOL syringePumpRetractRequested; ///< Flag indicates a retract operation is requested. static BOOL syringePumpPreloadRequested; ///< Flag indicates a plunger preload operation is requested. @@ -291,6 +291,7 @@ syringePumpVolumeStartPosition = 0; syringePumpHomePositionOffset = 0; syringePumpLastPosition = 0; + syringePumpVolumeRequired = 0.0; #ifndef _RELEASE_ if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_SYRINGE_PUMP_ALARMS ) != SW_CONFIG_ENABLE_VALUE ) @@ -1079,7 +1080,6 @@ { clearAlarmCondition( ALARM_ID_HD_SYRINGE_PUMP_SYRINGE_REMOVED ); clearAlarmCondition( ALARM_ID_HD_SYRINGE_DETECTED ); - syringePumpVolumeRequired = 0.0F; } } @@ -1385,6 +1385,7 @@ syringeVolumeAdequate = FALSE; syringePumpPrimeCompleted = FALSE; syringePumpPreLoadCompleted = FALSE; + syringePumpVolumeRequired = 0.0F; // Clear insufficient volume alarm condition in case we're retracting to allow user to resolve alarm clearAlarmCondition( ALARM_ID_HD_SYRINGE_PUMP_NOT_ENOUGH_HEPARIN_ALARM ); } @@ -1431,36 +1432,37 @@ F32 txVolumeReq = SYRINGE_PUMP_PRIME_VOLUME_ML + bolusVol + ( hepDurHr * contRate ); F32 syringeVol = ( SYRINGE_PUMP_EMPTY_POS - (F32)pos ) / SYRINGE_ENCODER_COUNTS_PER_ML; + syringePumpVolumeRequired = txVolumeReq; + txVolumeReq = txVolumeReq + SYRINGE_PUMP_PRELOAD_MARGIN_VOLUME_ML; + // Is syringe loaded? if ( TRUE == isSyringeDetected() ) { activateAlarmNoData( ALARM_ID_HD_SYRINGE_DETECTED ); - stopSyringePump(); - return result; + stopPump = TRUE; } + else + { + // Handle ramp up + rampSyringePump(); - syringePumpVolumeRequired = txVolumeReq; - txVolumeReq = txVolumeReq + SYRINGE_PUMP_PRELOAD_MARGIN_VOLUME_ML; + // Is plunger Heparin volume position detected? or volume requiring full syringe. + if ( ( syringeVol <= txVolumeReq ) || ( SYRINGE_PUMP_PRELOAD_MAX_VOLUME_ML < txVolumeReq ) ) + { + stopPump = TRUE; + syringePumpVolumeDelivered.data = 0.0; + syringePumpSafetyVolumeDelivered = 0.0; + syringePumpVolumeStartPosition = pos; + syringePumpPreLoadCompleted = TRUE; + } - // Handle ramp up - rampSyringePump(); + // Check max position > empty + 0.5 mL + stopPump = checkMaxTravel( stopPump, SYRINGE_PUMP_EMPTY_POS + SYRINGE_PUMP_EMPTY_POS_MARGIN ); - // Is plunger Heparin volume position detected? or volume requiring full syringe. - if ( ( syringeVol <= txVolumeReq ) || ( SYRINGE_PUMP_PRELOAD_MAX_VOLUME_ML < txVolumeReq ) ) - { - stopPump = TRUE; - syringePumpVolumeDelivered.data = 0.0; - syringePumpSafetyVolumeDelivered = 0.0; - syringePumpVolumeStartPosition = pos; - syringePumpPreLoadCompleted = TRUE; + // Check pump direction + stopPump = checkDirection( stopPump, MOTOR_DIR_FORWARD ); } - // Check max position > empty + 0.5 mL - stopPump = checkMaxTravel( stopPump, SYRINGE_PUMP_EMPTY_POS + SYRINGE_PUMP_EMPTY_POS_MARGIN ); - - // Check pump direction - stopPump = checkDirection( stopPump, MOTOR_DIR_FORWARD ); - // If anything found that would require stopping the pump, stop pump and go to off state if ( TRUE == stopPump ) {