Index: firmware/App/Controllers/PresOccl.c =================================================================== diff -u -r35396d8fe531506b5c89bb0003744782ea168b93 -r57f1d00b88a2d93b2fee426b1418882c5664f57c --- firmware/App/Controllers/PresOccl.c (.../PresOccl.c) (revision 35396d8fe531506b5c89bb0003744782ea168b93) +++ firmware/App/Controllers/PresOccl.c (.../PresOccl.c) (revision 57f1d00b88a2d93b2fee426b1418882c5664f57c) @@ -67,6 +67,7 @@ #define PSI_TO_MMHG ( 51.7149 ) ///< Conversion factor for converting PSI to mmHg. +// The new arterial pressure sensor is the same as the venous pressure sensor #define VENOUS_PRESSURE_NORMAL_OP 0 ///< Venous pressure status bits indicate normal operation. #define VENOUS_PRESSURE_CMD_MODE 1 ///< Venous pressure status bits indicate sensor in command mode. #define VENOUS_PRESSURE_STALE_DATA 2 ///< Venous pressure status bits indicate data is stale (no new data since last fpga read). @@ -78,11 +79,12 @@ #define ARTERIAL_PRESSURE_STALE_DATA 2 ///< Arterial pressure status bits indicate data is stale (no new data since last fpga read). #define ARTERIAL_PRESSURE_DIAG_CONDITION 3 ///< Arterial pressure status bits diagnostic condition (alarm). -#define OCCLUSION_THRESHOLD_OFFSET 10000 ///< Threshold offset. Combined with initial reading after cartridge install, a threshold is derived above which an occlusion is detected. -#define OCCLUSION_CLEAR_THRESHOLD_OFFSET 6000 ///< Threshold offset. Combined with initial reading after cartridge install, a threshold is derived below which an occlusion is cleared. +#define OCCLUSION_THRESHOLD_OFFSET 4000 ///< Threshold offset. Combined with initial reading after cartridge install, a threshold is derived above which an occlusion is detected. +#define OCCLUSION_CLEAR_THRESHOLD_OFFSET 4000 ///< Threshold offset. Combined with initial reading after cartridge install, a threshold is derived below which an occlusion is cleared. #define CARTRIDGE_LOADED_THRESHOLD 5000 ///< Threshold above which a cartridge is considered loaded. -/// Occlusion sensors maximum pressure reading limit when cartridge is considered loaded. -#define OCCLUSION_CARTRIDGE_LOADED_PRESSURE_READING_MAX 20000 +#define MIN_OCCLUSION_COUNTS 2000 ///< Minimum occlusion sensor reading for range check. +#define MAX_OCCLUSION_COUNTS 32766 ///< Maximum occlusion sensor reading for range check. +#define OCCLUSION_CARTRIDGE_LOADED_PRESSURE_READING_MAX 26000 ///< Occlusion sensors maximum pressure reading limit when cartridge is considered loaded. #define EMPTY_SALINE_BAG_THRESHOLD_MMHG -300.0 ///< Threshold below which the saline bag is considered empty (in mmHg). TODO - get real threshold from Systems static const U32 EMPTY_SALINE_BAG_PERSISTENCE = ( 250 / TASK_GENERAL_INTERVAL ); ///< Time that saline bag looks empty before saying it is empty. @@ -445,7 +447,7 @@ } else { - SET_ALARM_WITH_1_U32_DATA( ALARM_ID_HD_ARTERIAL_PRESSURE_READ_TIMEOUT_ERROR, (U32)artErrorCtr ); + //SET_ALARM_WITH_1_U32_DATA( ALARM_ID_HD_ARTERIAL_PRESSURE_READ_TIMEOUT_ERROR, (U32)artErrorCtr ); } // Record arterial pressure sensor read counter for next time around lastArterialPressureReadCtr = artReadCtr; @@ -541,7 +543,9 @@ { F32 artPres = getFilteredArterialPressure(); +#ifndef _RELEASE_ if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_ARTERIAL_PRESSURE_CHECK ) != SW_CONFIG_ENABLE_VALUE ) +#endif { // Check arterial pressure is in range if ( TRUE == isPersistentAlarmTriggered( ALARM_ID_HD_ARTERIAL_PRESSURE_OUT_OF_RANGE, @@ -652,12 +656,13 @@ *************************************************************************/ static void checkOcclusions( void ) { - U32 bpOccl = getMeasuredBloodPumpOcclusion(); + U32 bpOccl = getMeasuredBloodPumpOcclusion(); + BOOL outOfRange = ( bpOccl < MIN_OCCLUSION_COUNTS || bpOccl > MAX_OCCLUSION_COUNTS ? TRUE : FALSE ); if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_PRESSURE_CHECKS ) != SW_CONFIG_ENABLE_VALUE ) { // Range check occlusion sensor - if ( TRUE == isPersistentAlarmTriggered( ALARM_ID_HD_BP_OCCLUSION_OUT_OF_RANGE, bpOccl < MIN_OCCLUSION_COUNTS ) ) + if ( TRUE == isPersistentAlarmTriggered( ALARM_ID_HD_BP_OCCLUSION_OUT_OF_RANGE, outOfRange ) ) { SET_ALARM_WITH_1_U32_DATA( ALARM_ID_HD_BP_OCCLUSION_OUT_OF_RANGE, bpOccl ); } @@ -668,7 +673,7 @@ signalBloodPumpHardStop(); // Stop pump immediately SET_ALARM_WITH_1_U32_DATA( ALARM_ID_OCCLUSION_BLOOD_PUMP, bpOccl ) } - else if ( bpOccl < ( OCCLUSION_CLEAR_THRESHOLD_OFFSET + bloodPumpOcclusionAfterCartridgeInstall ) ) + else if ( bpOccl <= ( OCCLUSION_CLEAR_THRESHOLD_OFFSET + bloodPumpOcclusionAfterCartridgeInstall ) ) { clearAlarmCondition( ALARM_ID_OCCLUSION_BLOOD_PUMP ); }