Index: firmware/App/Controllers/SyringePump.c =================================================================== diff -u -re4cc37257141c5227186ac6d8ca3d6c87d009042 -re45524455c005d4fa1734efcbaf7ed0499302670 --- firmware/App/Controllers/SyringePump.c (.../SyringePump.c) (revision e4cc37257141c5227186ac6d8ca3d6c87d009042) +++ firmware/App/Controllers/SyringePump.c (.../SyringePump.c) (revision e45524455c005d4fa1734efcbaf7ed0499302670) @@ -523,17 +523,29 @@ { syringePumpSetRate = SYRINGE_PUMP_PRIME_RATE; syringePumpPrimeRequested = TRUE; - // Reset volume and start pos before starting prime operation - syringePumpVolumeDelivered.data = 0.0; - syringePumpSafetyVolumeDelivered = 0.0; - syringePumpVolumeStartPosition = getSyringePumpPosition(); + resetHeparinVolumeDelivered(); } return syringePumpPrimeRequested; } /*********************************************************************//** * @brief + * The resetHeparinVolumeDelivered function resets the Heparin volume delivered. + * @details Inputs: none + * @details Outputs: syringePumpVolumeDelivered, syringePumpSafetyVolumeDelivered, + * syringePumpVolumeStartPosition + * @return none + *************************************************************************/ +void resetHeparinVolumeDelivered( void ) +{ + syringePumpVolumeDelivered.data = 0.0; + syringePumpSafetyVolumeDelivered = 0.0; + syringePumpVolumeStartPosition = getSyringePumpPosition(); +} + +/*********************************************************************//** + * @brief * The startHeparinBolus function requests Heparin bolus delivery. * @details Inputs: syringePumpState * @details Outputs: syringePumpSetRate, syringePumpBolusRequested @@ -554,10 +566,6 @@ { syringePumpSetRate = tgtRate; syringePumpBolusRequested = TRUE; - // Reset volume and start pos before starting bolus operation - syringePumpVolumeDelivered.data = 0.0; - syringePumpSafetyVolumeDelivered = 0.0; - syringePumpVolumeStartPosition = getSyringePumpPosition(); } } else @@ -934,6 +942,7 @@ static void execSyringePumpMonitor( void ) { F32 forceSensorBeforCal = 0.0; + BOOL prevSyringeDetected = isSyringeDetected(); // Check if a new calibration is available if ( TRUE == isNewCalibrationRecordAvailable() ) @@ -953,6 +962,11 @@ // Get latest ADC data and convert to V syringePumpMeasHome.data = ( (F32)getFPGASyringePumpADCChannel2() * SYRINGE_PUMP_ADC_REF_V ) / SYRINGE_PUMP_ADC_FULL_SCALE_BITS; syringePumpMeasSyringeDetectionSwitch.data = ( (F32)getFPGASyringePumpADCChannel1() * SYRINGE_PUMP_ADC_REF_V ) / SYRINGE_PUMP_ADC_FULL_SCALE_BITS; + // On transition from not detected to detected - clear syringe removed alarm condition + if ( ( prevSyringeDetected != TRUE ) && ( TRUE == isSyringeDetected() ) ) + { + clearAlarmCondition( ALARM_ID_HD_SYRINGE_PUMP_SYRINGE_REMOVED ); + } forceSensorBeforCal = ( (F32)getFPGASyringePumpADCChannel0() * SYRINGE_PUMP_ADC_REF_V ) / SYRINGE_PUMP_ADC_FULL_SCALE_BITS; syringePumpMeasForce.data = pow(forceSensorBeforCal, 4) * forceSensorCalRecord.hdHeparinForceSensor.fourthOrderCoeff + @@ -1312,6 +1326,7 @@ if ( TRUE == stopPump ) { stopSyringePump(); + retractSyringePump(); result = SYRINGE_PUMP_OFF_STATE; }