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 ); } } Index: firmware/App/Services/FPGA.c =================================================================== diff -u -rd558c3058a027d8f4407c7bb882505e30225a7f9 -rc72332b4674a895aed7d56ca37ee5230548da3f6 --- firmware/App/Services/FPGA.c (.../FPGA.c) (revision d558c3058a027d8f4407c7bb882505e30225a7f9) +++ firmware/App/Services/FPGA.c (.../FPGA.c) (revision c72332b4674a895aed7d56ca37ee5230548da3f6) @@ -242,6 +242,9 @@ U08 bloodLeakRxErrorCount; ///< Reg 447. Blood leak receive error count. U16 bloodLeakRxFIFOCount; ///< Reg 448. Blood leak receive FIFO count. U08 bloodLeakRxFIFODataOut; ///< Reg 450. Blood leak receive FIFO data out. + U08 dummyByte; ///< Reg 451. Dummy byte to meet the even of the data. + U08 bloodLeakSelfTestErrorCounter; ///< Reg 452. Blood leak self test error counter. + U08 bloodLeakZeroErrorCounter; ///< Reg 453. Blood leak zero error counter. } FPGA_SENSORS_T; /// Record structure for FPGA continuous priority writes. @@ -2228,6 +2231,32 @@ /*********************************************************************//** * @brief + * The getFPGABloodLeakSelfTestErrorCounter function returns the blood leak + * self test error counter. + * @details Inputs: none + * @details Outputs: none + * @return fpgaSensorReadings.bloodLeakSelfTestErrorCounter + *************************************************************************/ +U08 getFPGABloodLeakSelfTestErrorCounter( void ) +{ + return fpgaSensorReadings.bloodLeakSelfTestErrorCounter; +} + +/*********************************************************************//** + * @brief + * The getFPGABloodLeakZeroErrorCounter function returns the blood leak + * zero error counter. + * @details Inputs: none + * @details Outputs: none + * @return fpgaSensorReadings.bloodLeakZeroErrorCounter + *************************************************************************/ +U08 getFPGABloodLeakZeroErrorCounter( void ) +{ + return fpgaSensorReadings.bloodLeakZeroErrorCounter; +} + +/*********************************************************************//** + * @brief * The noFPGABubbleDetected function returns TRUE if no air bubble has been * detected and FALSE if an air bubble has been detected. * @details Inputs: fpgaSensorReadings Index: firmware/App/Services/FPGA.h =================================================================== diff -u -rd558c3058a027d8f4407c7bb882505e30225a7f9 -rc72332b4674a895aed7d56ca37ee5230548da3f6 --- firmware/App/Services/FPGA.h (.../FPGA.h) (revision d558c3058a027d8f4407c7bb882505e30225a7f9) +++ firmware/App/Services/FPGA.h (.../FPGA.h) (revision c72332b4674a895aed7d56ca37ee5230548da3f6) @@ -144,6 +144,8 @@ U16 getFPGABloodLeakRxFIFOCount( void ); U08 getFPGABloodLeakRxErrorCount( void ); U08 getFPGABloodLeakRxFIFODataOut( void ); +U08 getFPGABloodLeakSelfTestErrorCounter( void ); +U08 getFPGABloodLeakZeroErrorCounter( void ); BOOL noFPGABubbleDetected( U32 bubble ); void setFPGABubbleSelfTest( U32 bubble );