Index: firmware/App/Controllers/SyringePump.c =================================================================== diff -u -r8b791e3252b79d693cb6d959648f85df2e44b709 -r90ac1467b8d858ec3c690f50d87893f3b1778a33 --- firmware/App/Controllers/SyringePump.c (.../SyringePump.c) (revision 8b791e3252b79d693cb6d959648f85df2e44b709) +++ firmware/App/Controllers/SyringePump.c (.../SyringePump.c) (revision 90ac1467b8d858ec3c690f50d87893f3b1778a33) @@ -182,6 +182,7 @@ static BOOL syringePumpContinuousRequested; ///< Flag indicates start or resume of a Heparin continuous delivery operation is requested. static BOOL syringePumpDACVrefSetRequested; ///< Flag indicates request to set DAC Vref for force sensor. +static BOOL syringePumpPositionKnown; ///< Flag indicates we know position from a prior retract to home. static BOOL syringePumpPlungerFound; ///< Flag indicates plunger was found. static BOOL syringePumpPrimeCompleted; ///< Flag indicates prime operation was completed. @@ -247,6 +248,7 @@ syringePumpSpeedCalcTimerCounter = 0; syringePumpRampTimerCtr = 0; + syringePumpPositionKnown = FALSE; syringePumpPlungerFound = FALSE; syringePumpPrimeCompleted = FALSE; @@ -434,7 +436,7 @@ BOOL seekSyringePlunger( void ) { if ( ( SYRINGE_PUMP_OFF_STATE == syringePumpState ) && ( TRUE == isSyringeDetected() ) && - ( TRUE == isSyringePumpHome() ) && ( heparinDeliveryState != HEPARIN_STATE_OFF ) ) + ( TRUE == syringePumpPositionKnown ) && ( heparinDeliveryState != HEPARIN_STATE_OFF ) ) { syringePumpSetRate = SYRINGE_PUMP_SEEK_RATE; syringePumpSeekRequested = TRUE; @@ -452,7 +454,8 @@ *************************************************************************/ BOOL primeSyringePump( void ) { - if ( ( SYRINGE_PUMP_OFF_STATE == syringePumpState ) && ( TRUE == isSyringeDetected() ) && ( heparinDeliveryState != HEPARIN_STATE_OFF ) ) + if ( ( SYRINGE_PUMP_OFF_STATE == syringePumpState ) && ( TRUE == isSyringeDetected() ) && + ( heparinDeliveryState != HEPARIN_STATE_OFF ) && ( TRUE == syringePumpPlungerFound ) ) { syringePumpSetRate = SYRINGE_PUMP_PRIME_RATE; syringePumpPrimeRequested = TRUE; @@ -478,7 +481,8 @@ // If valid to start a bolus, kick it off if ( ( tgtRate >= MIN_HEPARIN_BOLUS_RATE ) && ( tgtRate <= MAX_HEPARIN_BOLUS_RATE ) && ( FALSE == isSyringePumpHome() ) ) { - if ( ( TRUE == isSyringeDetected() ) && ( SYRINGE_PUMP_OFF_STATE == syringePumpState ) && ( HEPARIN_STATE_STOPPED == heparinDeliveryState ) ) + if ( ( TRUE == isSyringeDetected() ) && ( TRUE == syringePumpPrimeCompleted ) && + ( SYRINGE_PUMP_OFF_STATE == syringePumpState ) && ( HEPARIN_STATE_STOPPED == heparinDeliveryState ) ) { syringePumpSetRate = tgtRate; syringePumpBolusRequested = TRUE; @@ -988,6 +992,7 @@ syringePumpHomePositionOffset = getFPGASyringePumpEncoderPosition(); syringePumpPosition.data = 0; syringePumpVolumeStartPosition = 0; + syringePumpPositionKnown = TRUE; syringePumpVolumeDelivered.data = 0.0; syringePumpPlungerFound = FALSE; syringePumpPrimeCompleted = FALSE;