Index: firmware/App/Controllers/SyringePump.c =================================================================== diff -u -r0e457429d65039d16cd631c3aaa06b5409de67c4 -r225ed8df4cae44e1007ec5ad931b6cc62d09e94d --- firmware/App/Controllers/SyringePump.c (.../SyringePump.c) (revision 0e457429d65039d16cd631c3aaa06b5409de67c4) +++ firmware/App/Controllers/SyringePump.c (.../SyringePump.c) (revision 225ed8df4cae44e1007ec5ad931b6cc62d09e94d) @@ -76,7 +76,7 @@ #define SYRINGE_PUMP_ADC_FULL_SCALE_BITS 1024.0F ///< Syringe pump ADC has 1024 full scale counts (10-bit) per channel. #define SYRINGE_PUMP_DAC_FULL_SCALE_BITS 4096.0F ///< Syringe pump DAC has has 4096 full scale counts (12-bit). -#define SYRINGE_FORCE_OCCLUSION_THRESHOLD_V 3.2F ///< Force sensor threshold (in V) above which an occlusion is detected. +#define SYRINGE_FORCE_OCCLUSION_THRESHOLD_V 2.5F ///< Force sensor threshold (in V) above which an occlusion is detected. #define SYRINGE_FORCE_OCCLUSION_DIFF_V 0.5F ///< Force sensor difference (in V) which an occlusion alarm is triggered. #define SYRINGE_FORCE_PLUNGER_THRESHOLD_V 0.25F ///< Force sensor threshold (in V) above which we have engaged with plunger. #define SYRINGE_PUMP_SYRINGE_DETECT_THRESHOLD_V 2.0F ///< Syringe pump syringe detected threshold (in V). @@ -162,7 +162,7 @@ #define SYRINGE_PUMP_ADC_FPGA_ERROR_TIMEOUT_MS ( 2 * MS_PER_SECOND ) ///< Syringe pump ADC FPGA error timeout in milliseconds. #define SYRINGE_PUMP_DAC_MAX_RETRIES 5 ///< Syringe pump DAC retries to write. #define SYRINGE_PUMP_DAC_TIMER ( 200 / TASK_PRIORITY_INTERVAL ) ///< Syringe pump DAC timer between retries. -#define SYRINGE_PUMP_OCCLUSION_PERSISTENCE 50 ///< Syringe pump occlusion persistence timer. +#define SYRINGE_PUMP_OCCLUSION_PERSISTENCE 50 ///< Syringe pump occlusion persistence timer in milliseconds. #define SYRINGE_PUMP_EMPTY_FORCE_COUNT 5 ///< Syringe pump empty force voltage count persistence. /// Defined states for the syringe pump control state machine. typedef enum SyringePump_States @@ -1689,11 +1689,12 @@ // Has syringe been removed? stopPump = checkSyringeRemoved( stopPump ); - stopPump = checkForSyringeOcclusion(); - // Check for syringe pump empty stopPump = checkSyringeEmpty( stopPump ); + // Check for occlusion + stopPump = checkForSyringeOcclusion(); + // Check position > empty + 0.5 mL stopPump = checkMaxTravel( stopPump, SYRINGE_PUMP_EMPTY_POS + SYRINGE_PUMP_EMPTY_POS_MARGIN ); @@ -1856,13 +1857,15 @@ BOOL checkForSyringeOcclusion( void ) { BOOL result = FALSE; // Return FALSE if no occlusion is detected - F32 forceAtEndOfPriming = getSyringePumpForceV(); // Read the force sensor at the end of the priming - F32 forceDelta = forceAtEndOfPriming - forceAtEndOfSeek; // Occlusion is detected if force at end of prime is > than force at end of seek by 0.5 volts or more - BOOL occlusionDetected = ( forceDelta >= SYRINGE_FORCE_OCCLUSION_DIFF_V ? TRUE : FALSE ); + F32 currentForceV = getSyringePumpForceV(); // Read the force sensor at the end of the priming + F32 forceDelta = currentForceV - forceAtEndOfSeek; // Occlusion is detected if force at end of prime is > than force at end of seek by 0.5 volts or more + BOOL occlusionDetected = FALSE; // Checking for occlusion in dry self tests without persistence if ( MODE_PRET == getCurrentOperationMode() ) { + occlusionDetected = ( forceDelta >= SYRINGE_FORCE_OCCLUSION_DIFF_V ? TRUE : FALSE ); + if ( TRUE == occlusionDetected ) { SET_ALARM_WITH_2_F32_DATA( ALARM_ID_HD_SYRINGE_PUMP_OCCLUSION, forceAtEndOfSeek, forceAtEndOfPriming ) @@ -1873,6 +1876,8 @@ // Check with persistence during continuous state if ( SYRINGE_PUMP_OP_CONTINUOUS == syringePumpState ) { + occlusionDetected = ( currentForceV >= SYRINGE_FORCE_OCCLUSION_THRESHOLD_V ? TRUE : FALSE ); + checkPersistentAlarm( ALARM_ID_HD_SYRINGE_PUMP_OCCLUSION, occlusionDetected, forceAtEndOfSeek, forceAtEndOfPriming ); }