Index: firmware/App/Controllers/SyringePump.c =================================================================== diff -u -rb36fc8801adfc9d2f402450abffe721e71f9a5e5 -rfe91ec494378a7df34e3c14853a797f9f8f044e9 --- firmware/App/Controllers/SyringePump.c (.../SyringePump.c) (revision b36fc8801adfc9d2f402450abffe721e71f9a5e5) +++ firmware/App/Controllers/SyringePump.c (.../SyringePump.c) (revision fe91ec494378a7df34e3c14853a797f9f8f044e9) @@ -188,6 +188,8 @@ static OVERRIDE_U32_T syringePumpADCandDACStatus = {0, 0, 0, 0}; ///< Syringe pump ADC and DAC status reported by FPGA. static OVERRIDE_U32_T syringePumpADCReadCtr = {0, 0, 0, 0}; ///< Syringe pump ADC read counter reported by FPGA. +static BOOL requireSyringeDetection; ///< Flag indicating whether syringe detection is required in the current state. + static F32 syringePumpSetRate; ///< Set rate for syringe pump (in mL/hr). static F32 forceAtEndOfSeek; ///< Force sensor reading in Volts at the end of seek. static U32 syringePumpSetToggleTime; ///< Set rate for syringe pump (in uSec/toggle). @@ -275,6 +277,8 @@ syringePumpState = SYRINGE_PUMP_INIT_STATE; heparinDeliveryState = HEPARIN_STATE_OFF; + requireSyringeDetection = FALSE; + syringePumpSetRate = 0.0; syringePumpSetToggleTime = 0; syringePumpSafetyVolumeDelivered = 0.0; @@ -675,6 +679,20 @@ /*********************************************************************//** * @brief + * The syringeDetectionRequired function sets a flag indicating whether + * the syringe detection is required in current state. + * @details Inputs: none + * @details Outputs: requireSyringeDetection + * @param req True if syringe detection is required in the current state + * @return none + *************************************************************************/ +void syringeDetectionRequired( BOOL req ) +{ + requireSyringeDetection = req; +} + +/*********************************************************************//** + * @brief * The getSyringePumpVolumeDelivered function gets the current syringe pump * volume delivered. * @details Inputs: syringePumpVolumeDelivered @@ -959,37 +977,59 @@ // 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; +#ifndef _RELEASE_ + if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_SYRINGE_PUMP ) != SW_CONFIG_DISABLE_VALUE ) + { + syringePumpMeasSyringeDetectionSwitch.data = 0.0; // if syringe pump disabled, always report no detection + } + else +#endif + { + syringePumpMeasSyringeDetectionSwitch.data = ( (F32)getFPGASyringePumpADCChannel1() * SYRINGE_PUMP_ADC_REF_V ) / SYRINGE_PUMP_ADC_FULL_SCALE_BITS; + } // Log syringe detect switch changes if ( prevSyringeDetected != isSyringeDetected() ) { sendTreatmentLogEventData( SYRINGE_DETECTION_SWITCH_CHANGED_EVENT, (F32)prevSyringeDetected, (F32)isSyringeDetected() ); } + // Handle syringe detect alarm management #ifndef _RELEASE_ if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_SYRINGE_PUMP_ALARMS ) != SW_CONFIG_ENABLE_VALUE ) #endif { - // On transition from not detected to detected - clear syringe removed alarm condition - if ( ( prevSyringeDetected != TRUE ) && ( TRUE == isSyringeDetected() ) ) + F32 bolusVol = getTreatmentParameterF32( TREATMENT_PARAM_HEPARIN_BOLUS_VOLUME ); + F32 hepRate = getTreatmentParameterF32( TREATMENT_PARAM_HEPARIN_DISPENSE_RATE ); + + // Syringe detection not required if not using Heparin in treatment + if ( ( bolusVol > NEARLY_ZERO ) || ( hepRate > NEARLY_ZERO ) ) { - clearAlarmCondition( ALARM_ID_HD_SYRINGE_PUMP_SYRINGE_REMOVED ); + // On transition from not detected to detected or if syringe detection not required - clear syringe removed alarm condition + if ( ( ( prevSyringeDetected != TRUE ) && ( TRUE == isSyringeDetected() ) ) || ( requireSyringeDetection != TRUE ) ) + { + clearAlarmCondition( ALARM_ID_HD_SYRINGE_PUMP_SYRINGE_REMOVED ); + } + // If no syringe detected and detection is required, trigger alarm condition + else if ( ( FALSE == isSyringeDetected() ) && ( TRUE == requireSyringeDetection ) ) + { + activateAlarmNoData( ALARM_ID_HD_SYRINGE_PUMP_SYRINGE_REMOVED ); + } + // On transition from detected to not detected - clear syringe detected alarm condition + if ( ( TRUE == prevSyringeDetected ) && ( isSyringeDetected() != TRUE ) ) + { + clearAlarmCondition( ALARM_ID_HD_SYRINGE_DETECTED ); + } + // If syringe detected and alarm active, maintain alarm condition + else if ( ( TRUE == isSyringeDetected() ) && ( TRUE == isAlarmActive( ALARM_ID_HD_SYRINGE_DETECTED ) ) ) + { + activateAlarmNoData( ALARM_ID_HD_SYRINGE_DETECTED ); + } } - // If no syringe detected while syringe removed alarm is active, maintain alarm condition - else if ( ( FALSE == isSyringeDetected() ) && ( TRUE == isAlarmActive( ALARM_ID_HD_SYRINGE_PUMP_SYRINGE_REMOVED ) ) ) + else { - activateAlarmNoData( ALARM_ID_HD_SYRINGE_PUMP_SYRINGE_REMOVED ); - } - // On transition from detected to not detected - clear syringe detected alarm condition - if ( ( TRUE == prevSyringeDetected ) && ( isSyringeDetected() != TRUE ) ) - { + clearAlarmCondition( ALARM_ID_HD_SYRINGE_PUMP_SYRINGE_REMOVED ); clearAlarmCondition( ALARM_ID_HD_SYRINGE_DETECTED ); } - // If syringe detected while syringe detected alarm is active, maintain alarm condition - else if ( ( TRUE == isSyringeDetected() ) && ( TRUE == isAlarmActive( ALARM_ID_HD_SYRINGE_DETECTED ) ) ) - { - activateAlarmNoData( ALARM_ID_HD_SYRINGE_DETECTED ); - } } forceSensorBeforCal = ( (F32)getFPGASyringePumpADCChannel0() * SYRINGE_PUMP_ADC_REF_V ) / SYRINGE_PUMP_ADC_FULL_SCALE_BITS; Index: firmware/App/Controllers/SyringePump.h =================================================================== diff -u -r19a8bf98a7154e24c35da25225d4b55bf70ddd09 -rfe91ec494378a7df34e3c14853a797f9f8f044e9 --- firmware/App/Controllers/SyringePump.h (.../SyringePump.h) (revision 19a8bf98a7154e24c35da25225d4b55bf70ddd09) +++ firmware/App/Controllers/SyringePump.h (.../SyringePump.h) (revision fe91ec494378a7df34e3c14853a797f9f8f044e9) @@ -94,6 +94,7 @@ BOOL startHeparinBolus( void ); BOOL startHeparinContinuous( void ); BOOL setSyringePumpDACVref( F32 vRef ); +void syringeDetectionRequired( BOOL req ); BOOL isSyringeDetected( void ); BOOL isSyringePumpHome( void ); Index: firmware/App/Modes/ModeFault.c =================================================================== diff -u -r19a8bf98a7154e24c35da25225d4b55bf70ddd09 -rfe91ec494378a7df34e3c14853a797f9f8f044e9 --- firmware/App/Modes/ModeFault.c (.../ModeFault.c) (revision 19a8bf98a7154e24c35da25225d4b55bf70ddd09) +++ firmware/App/Modes/ModeFault.c (.../ModeFault.c) (revision fe91ec494378a7df34e3c14853a797f9f8f044e9) @@ -64,6 +64,9 @@ HD_OP_MODE_T previousOpMode = getPreviousOperationMode(); DG_OP_MODE_T dgOperationMode = getDGOpMode(); + doorClosedRequired( FALSE, FALSE ); + syringeDetectionRequired( FALSE ); + // Set user alarm recovery actions allowed in this mode setAlarmUserActionEnabled( ALARM_USER_ACTION_RESUME, FALSE ); setAlarmUserActionEnabled( ALARM_USER_ACTION_RINSEBACK, FALSE ); Index: firmware/App/Modes/ModePostTreat.c =================================================================== diff -u -r9bf209fc5813b7e806f51f408ece77174a336c9b -rfe91ec494378a7df34e3c14853a797f9f8f044e9 --- firmware/App/Modes/ModePostTreat.c (.../ModePostTreat.c) (revision 9bf209fc5813b7e806f51f408ece77174a336c9b) +++ firmware/App/Modes/ModePostTreat.c (.../ModePostTreat.c) (revision fe91ec494378a7df34e3c14853a797f9f8f044e9) @@ -120,6 +120,8 @@ // Stop any DG fill that may be in progress from an aborted treatment cmdStopDGFill(); + syringeDetectionRequired( FALSE ); + // Set user alarm recovery actions allowed in this mode setAlarmUserActionEnabled( ALARM_USER_ACTION_RESUME, FALSE ); setAlarmUserActionEnabled( ALARM_USER_ACTION_RINSEBACK, FALSE ); @@ -467,29 +469,18 @@ if ( TRUE == isSyringeDetected() ) { #ifndef _RELEASE_ - if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_SYRINGE_PUMP ) != SW_CONFIG_ENABLE_VALUE ) + if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_SYRINGE_PUMP_ALARMS ) != SW_CONFIG_ENABLE_VALUE ) #endif { activateAlarmNoData( ALARM_ID_HD_SYRINGE_DETECTED ); } } - else - { - clearAlarmCondition( ALARM_ID_HD_SYRINGE_DETECTED ); - } // Wait for cartridge and syringe to be removed and for DG to finish any drains/fills. if ( TRUE == isCartridgeRemoved ) { BOOL isSyringePumpDetected = isSyringeDetected(); -#ifndef _RELEASE_ - if ( SW_CONFIG_ENABLE_VALUE == getSoftwareConfigStatus( SW_CONFIG_DISABLE_SYRINGE_PUMP ) ) - { - isSyringePumpDetected = FALSE; - } -#endif - if ( FALSE == isSyringePumpDetected ) { cmdStopDG(); Index: firmware/App/Modes/ModePreTreat.c =================================================================== diff -u -r9bf209fc5813b7e806f51f408ece77174a336c9b -rfe91ec494378a7df34e3c14853a797f9f8f044e9 --- firmware/App/Modes/ModePreTreat.c (.../ModePreTreat.c) (revision 9bf209fc5813b7e806f51f408ece77174a336c9b) +++ firmware/App/Modes/ModePreTreat.c (.../ModePreTreat.c) (revision fe91ec494378a7df34e3c14853a797f9f8f044e9) @@ -91,7 +91,6 @@ static void resetSignalFlags( void ); static void transitionToCartridgeInstallation( void ); static void transitionToPatientConnection( void ); -static void verifySwitchStatus( void ); static HD_PRE_TREATMENT_MODE_STATE_T handleWaterSampleState( void ); static HD_PRE_TREATMENT_MODE_STATE_T handleSelfTestConsumableState( void ); @@ -265,31 +264,6 @@ /*********************************************************************//** * @brief - * The verifySwitchStatus function checks Pump Track and Door switches are closed. - * Verify Syringe is installed if needed. - * Alarm is set if not. Alarms cleared by driver executives. - * @details Inputs: none - * @details Outputs: Alarm - * @return none - *************************************************************************/ -static void verifySwitchStatus( void ) -{ - F32 bolusVol = getTreatmentParameterF32( TREATMENT_PARAM_HEPARIN_BOLUS_VOLUME ); - F32 hepRate = getTreatmentParameterF32( TREATMENT_PARAM_HEPARIN_DISPENSE_RATE ); - -#ifndef _RELEASE_ - if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_SYRINGE_PUMP_ALARMS ) != SW_CONFIG_ENABLE_VALUE ) -#endif - { - if ( ( FALSE == isSyringeDetected() ) && ( ( bolusVol > NEARLY_ZERO ) && ( hepRate > NEARLY_ZERO ) ) ) - { - activateAlarmNoData( ALARM_ID_HD_SYRINGE_PUMP_SYRINGE_REMOVED ); - } - } -} - -/*********************************************************************//** - * @brief * The signalUserConfirmInstallation function handles user confirmation of * disposable installation. * @details Inputs: none @@ -322,6 +296,10 @@ // Everything is properly installed accepted = TRUE; confirmInstallRequested = TRUE; + if ( ( bolusVol > NEARLY_ZERO ) || ( hepRate > NEARLY_ZERO ) ) + { + syringeDetectionRequired( TRUE ); + } } else { @@ -711,14 +689,6 @@ transitionToCartridgeInstallation(); } } - else - { - if ( ( NO_CART_SELF_TESTS_WAIT_FOR_DOOR_CLOSE_STATE <= getNoCartSelfTestsState() ) && - ( NO_CART_SELF_TESTS_STOPPED_STATE != getNoCartSelfTestsState() ) ) - { - verifySwitchStatus(); - } - } return state; } @@ -780,14 +750,6 @@ transitionToPrime(); } } - else - { - if ( ( DRY_SELF_TESTS_WAIT_FOR_DOOR_CLOSE_STATE <= getDrySelfTestsState() ) && - ( DRY_SELF_TESTS_STOPPED_STATE != getDrySelfTestsState() ) ) - { - verifySwitchStatus(); - } - } return state; } @@ -822,13 +784,6 @@ transitionToPreTreatmentRecirc(); } } - else - { - if ( ( HD_PRIME_PAUSE != getPrimeState() ) ) - { - verifySwitchStatus(); - } - } return state; } @@ -853,11 +808,6 @@ execPreTreatmentRecirc(); - if ( PRE_TREATMENT_RECIRC_STOPPED_STATE != getPreTreatmentRecircState() ) - { - verifySwitchStatus(); - } - #ifndef _RELEASE_ if ( SW_CONFIG_ENABLE_VALUE == getSoftwareConfigStatus( SW_CONFIG_DISABLE_UI_INTERACTION ) ) { Index: firmware/App/Modes/ModeService.c =================================================================== diff -u -r19a8bf98a7154e24c35da25225d4b55bf70ddd09 -rfe91ec494378a7df34e3c14853a797f9f8f044e9 --- firmware/App/Modes/ModeService.c (.../ModeService.c) (revision 19a8bf98a7154e24c35da25225d4b55bf70ddd09) +++ firmware/App/Modes/ModeService.c (.../ModeService.c) (revision fe91ec494378a7df34e3c14853a797f9f8f044e9) @@ -16,8 +16,10 @@ ***************************************************************************/ #include "Buttons.h" -#include "OperationModes.h" #include "ModeService.h" +#include "OperationModes.h" +#include "Switches.h" +#include "SyringePump.h" /** * @addtogroup HDServiceMode @@ -48,6 +50,9 @@ *************************************************************************/ U32 transitionToServiceMode( void ) { + doorClosedRequired( FALSE, FALSE ); + syringeDetectionRequired( FALSE ); + // Set user alarm recovery actions allowed in this mode setAlarmUserActionEnabled( ALARM_USER_ACTION_RESUME, FALSE ); setAlarmUserActionEnabled( ALARM_USER_ACTION_RINSEBACK, FALSE ); Index: firmware/App/Modes/ModeStandby.c =================================================================== diff -u -r19a8bf98a7154e24c35da25225d4b55bf70ddd09 -rfe91ec494378a7df34e3c14853a797f9f8f044e9 --- firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision 19a8bf98a7154e24c35da25225d4b55bf70ddd09) +++ firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision fe91ec494378a7df34e3c14853a797f9f8f044e9) @@ -116,6 +116,9 @@ initDGInterface(); resetAirTrap(); + doorClosedRequired( FALSE, FALSE ); + syringeDetectionRequired( FALSE ); + // Set user alarm recovery actions allowed in this mode setAlarmUserActionEnabled( ALARM_USER_ACTION_RESUME, FALSE ); setAlarmUserActionEnabled( ALARM_USER_ACTION_RINSEBACK, FALSE );