Index: firmware/App/Controllers/PresOccl.c =================================================================== diff -u -r7499a42cc0f906f9a4a947c82c5b4615217ce7e5 -rb1f086e7cd292d5a97a7265075400274d60d4fbf --- firmware/App/Controllers/PresOccl.c (.../PresOccl.c) (revision 7499a42cc0f906f9a4a947c82c5b4615217ce7e5) +++ firmware/App/Controllers/PresOccl.c (.../PresOccl.c) (revision b1f086e7cd292d5a97a7265075400274d60d4fbf) @@ -22,7 +22,8 @@ #include "NVDataMgmt.h" #include "OperationModes.h" #include "PersistentAlarm.h" -#include "SystemCommMessages.h" +#include "SystemCommMessages.h" +#include "SelfTests.h" #include "TaskGeneral.h" #include "Temperatures.h" #include "Timers.h" @@ -69,6 +70,7 @@ #define PSI_TO_MMHG ( 51.7149F ) ///< 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). @@ -709,7 +711,7 @@ static void checkOcclusions( void ) { U32 bpOccl = getMeasuredBloodPumpOcclusion(); - BOOL outOfRange = ( bpOccl < MIN_OCCLUSION_COUNTS || bpOccl > MAX_OCCLUSION_COUNTS ? TRUE : FALSE ); + BOOL outOfRange = ( bpOccl < MIN_OCCLUSION_COUNTS || bpOccl > MAX_OCCLUSION_COUNTS ? TRUE : FALSE ); #ifndef _RELEASE_ if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_PRESSURE_CHECKS ) != SW_CONFIG_ENABLE_VALUE ) @@ -721,14 +723,37 @@ SET_ALARM_WITH_1_U32_DATA( ALARM_ID_HD_BP_OCCLUSION_OUT_OF_RANGE, bpOccl ); } - // Check for occlusion - if ( bpOccl > ( OCCLUSION_THRESHOLD_OFFSET + bloodPumpOcclusionAfterCartridgeInstall ) ) + // Check for occlusion in PreTreatment modes when the cartridge is installed + // and setOcclusionInstallLevel has been called. + if( MODE_PRET == getCurrentOperationMode() ) { - signalBloodPumpHardStop(); // Stop pump immediately - SET_ALARM_WITH_1_U32_DATA( ALARM_ID_OCCLUSION_BLOOD_PUMP, bpOccl ) + if( getPreTreatmentSubState() > HD_PRE_TREATMENT_CART_INSTALL_STATE && getDrySelfTestsState() > DRY_SELF_TESTS_START_STATE ) + { + // Check for occlusion + if ( bpOccl > ( OCCLUSION_THRESHOLD_OFFSET + bloodPumpOcclusionAfterCartridgeInstall ) ) + { + signalBloodPumpHardStop(); // Stop pump immediately + SET_ALARM_WITH_1_U32_DATA( ALARM_ID_OCCLUSION_BLOOD_PUMP, bpOccl ) + } + } } - else + // Check for occlusion in PreTreatment modes where pumps are moving + else if( MODE_TREA == getCurrentOperationMode() ) { + if( TREATMENT_STOP_STATE != getTreatmentState()) + { + // Check for occlusion + if ( bpOccl > ( OCCLUSION_THRESHOLD_OFFSET + bloodPumpOcclusionAfterCartridgeInstall ) ) + { + signalBloodPumpHardStop(); // Stop pump immediately + SET_ALARM_WITH_1_U32_DATA( ALARM_ID_OCCLUSION_BLOOD_PUMP, bpOccl ) + } + } + } + + // Clear alarm regardless of op mode once conditions are met. + if ( bpOccl <= ( OCCLUSION_CLEAR_THRESHOLD_OFFSET + bloodPumpOcclusionAfterCartridgeInstall ) ) + { clearAlarmCondition( ALARM_ID_OCCLUSION_BLOOD_PUMP ); } }