Index: firmware/App/Controllers/BloodLeak.c =================================================================== diff -u -r0e01a5db1f8bb113b7a45faec25ea661b7418af6 -rc72332b4674a895aed7d56ca37ee5230548da3f6 --- firmware/App/Controllers/BloodLeak.c (.../BloodLeak.c) (revision 0e01a5db1f8bb113b7a45faec25ea661b7418af6) +++ firmware/App/Controllers/BloodLeak.c (.../BloodLeak.c) (revision c72332b4674a895aed7d56ca37ee5230548da3f6) @@ -56,7 +56,8 @@ #define BLOOD_LEAK_WAIT_2_READ_CTRL_U ( 1 * MS_PER_SECOND / TASK_PRIORITY_INTERVAL ) ///< Blood leak wait to read control U in counts. #define BLOOD_LEAK_MAX_SET_POINT_WRITE_TRIALS 3 ///< Blood leak maximum number of trials to write the set point. #define BLOOD_LEAK_MAX_CTRL_U_WRITE_TRIALS 3 ///< Blood leak maximum number of trials to write the control U command. - +#define BLOOD_LEAK_ZERO_CMD_STATUS_READY 0x80 ///< Blood leak zero command status ready value. +#define BLOOD_LEAK_SELF_TEST_CMD_STATUS_READY 0x80 ///< Blood leak self test command status ready value. #define BLOOD_LEAK_MIN_WAIT_TIME_2_GET_CAL_MS ( 2 * MS_PER_SECOND ) ///< Blood leak minimum wait time to get calibration in milliseconds. #define DATA_PUBLISH_COUNTER_START_COUNT 60 ///< Data publish counter start count. @@ -623,7 +624,8 @@ { BLOOD_LEAK_STATE_T state = BLOOD_LEAK_INIT_STATE; - if ( TRUE == bloodLeakZeroRequested ) + if ( ( TRUE == bloodLeakZeroRequested ) && + ( BLOOD_LEAK_ZERO_CMD_STATUS_READY == ( getFPGABloodLeakZeroStatusCounter() & BLOOD_LEAK_ZERO_CMD_STATUS_READY ) ) ) { state = BLOOD_LEAK_ZERO_STATE; bloodLeakZeroRequested = FALSE; @@ -647,25 +649,23 @@ { BLOOD_LEAK_STATE_T state = BLOOD_LEAK_ZERO_STATE; - if ( TRUE == FPGABloodLeakZeroDetected() ) + if ( ( TRUE == FPGABloodLeakZeroDetected() ) && + ( BLOOD_LEAK_SELF_TEST_CMD_STATUS_READY == ( getFPGABloodLeakSelfTestErrorCounter() & BLOOD_LEAK_SELF_TEST_CMD_STATUS_READY ) ) ) { state = BLOOD_LEAK_SELF_TEST_STATE; bloodLeakSelfTestStatus = SELF_TEST_STATUS_IN_PROGRESS; bloodLeakSelfTestStartTime = getMSTimerCount(); - clearFPGABloodLeakZero(); + //clearFPGABloodLeakZero(); // TODO remove once the BLD has been tested setFPGABloodLeakSelfTest(); } - else + else if ( TRUE == didTimeout( bloodLeakZeroStartTime, BLOOD_LEAK_TIMEOUT_MS ) ) { - if ( TRUE == didTimeout( bloodLeakZeroStartTime, BLOOD_LEAK_TIMEOUT_MS ) ) - { #ifndef _RELEASE_ - if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_BLOOD_LEAK_ALARM ) != SW_CONFIG_ENABLE_VALUE ) + if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_BLOOD_LEAK_ALARM ) != SW_CONFIG_ENABLE_VALUE ) #endif - { - activateAlarmNoData( ALARM_ID_HD_BLOOD_LEAK_FAULT ); - } + { + activateAlarmNoData( ALARM_ID_HD_BLOOD_LEAK_FAULT ); } } @@ -689,12 +689,11 @@ if ( FALSE == noFPGABloodLeakDetected() ) // Faked blood leak caused by independent MCU board { bloodLeakSelfTestStatus = SELF_TEST_STATUS_PASSED; - clearFPGABloodLeakSelfTest(); + //clearFPGABloodLeakSelfTest(); // TODO remove this function when the BLD is tested } else if ( TRUE == didTimeout( bloodLeakSelfTestStartTime, BLOOD_LEAK_TIMEOUT_MS ) ) { bloodLeakSelfTestStatus = SELF_TEST_STATUS_FAILED; - activateAlarmNoData( ALARM_ID_HD_BLOOD_LEAK_SELF_TEST_FAILURE ); } }