Index: firmware/App/Controllers/Bubble.c =================================================================== diff -u -r3d30c9829d316b8c5e632c0201a59c8d14b3486e -rcef6b0392becf60c69cf4e517701ba22642f072a --- firmware/App/Controllers/Bubble.c (.../Bubble.c) (revision 3d30c9829d316b8c5e632c0201a59c8d14b3486e) +++ firmware/App/Controllers/Bubble.c (.../Bubble.c) (revision cef6b0392becf60c69cf4e517701ba22642f072a) @@ -177,37 +177,40 @@ { BUBBLE_STATES_T state = BUBBLE_SELF_TEST_STATE; - if ( SELF_TEST_STATUS_IN_PROGRESS == bubblesSelfTestStatus[ bubble ] ) + if ( ( bubble == ADA ) || ( bubble == ADV) ) { - if ( FALSE == noFPGABubbleDetected( bubble ) ) // Faked air bubble caused + if ( SELF_TEST_STATUS_IN_PROGRESS == bubblesSelfTestStatus[ bubble ] ) { - bubblesSelfTestStatus[ bubble ] = SELF_TEST_STATUS_PASSED; - clearFPGABubbleSelfTest( bubble ); - } - else if ( TRUE == didTimeout( bubblesSelfTestStartTime[ bubble ], BUBBLE_TIMEOUT_MS ) ) - { - bubblesSelfTestStatus[ bubble ] = SELF_TEST_STATUS_FAILED; - if ( bubble == ADA ) + if ( FALSE == noFPGABubbleDetected( bubble ) ) // Faked air bubble caused { - activateAlarmNoData( ALARM_ID_HD_ARTERIAL_BUBBLE_SELF_TEST_FAILURE ); + bubblesSelfTestStatus[ bubble ] = SELF_TEST_STATUS_PASSED; + clearFPGABubbleSelfTest( bubble ); } - else if ( bubble == ADV ) + else if ( TRUE == didTimeout( bubblesSelfTestStartTime[ bubble ], BUBBLE_TIMEOUT_MS ) ) { - activateAlarmNoData( ALARM_ID_HD_VENOUS_BUBBLE_SELF_TEST_FAILURE ); + bubblesSelfTestStatus[ bubble ] = SELF_TEST_STATUS_FAILED; + if ( bubble == ADA ) + { + activateAlarmNoData( ALARM_ID_HD_ARTERIAL_BUBBLE_SELF_TEST_FAILURE ); + } + else if ( bubble == ADV ) + { + activateAlarmNoData( ALARM_ID_HD_VENOUS_BUBBLE_SELF_TEST_FAILURE ); + } } - else + } + else + { + // Air bubble self-test finished, wait for self-test faked air bubble detector clear + if ( TRUE == noFPGABubbleDetected( bubble ) ) { - // TODO: Should never reach here + state = BUBBLE_NORMAL_STATE; } } } else { - // Air bubble self-test finished, wait for self-test faked air bubble detector clear - if ( TRUE == noFPGABubbleDetected( bubble ) ) - { - state = BUBBLE_NORMAL_STATE; - } + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_HD_SOFTWARE_FAULT, SW_FAULT_ID_HD_INVALID_BUBBLE_ID, bubble ) } return state; @@ -361,7 +364,7 @@ BUBBLE_STATUS_T statusADA = getBubbleStatus( ADA ); BUBBLE_STATUS_T statusADV = getBubbleStatus( ADV ); - broadcastBubblesData( statusADA, (U32)bubblesState[ ADA ], statusADV, (U32)bubblesState[ ADV ] ); + broadcastBubblesData( (U32)statusADA, (U32)bubblesState[ ADA ], (U32)statusADV, (U32)bubblesState[ ADV ] ); bubblesDataPublicationTimerCounter = 0; } } Index: firmware/App/Services/AlarmMgmt.h =================================================================== diff -u -rf24be7fd135878e6ff28dff56937c31626bd4bc1 -rcef6b0392becf60c69cf4e517701ba22642f072a --- firmware/App/Services/AlarmMgmt.h (.../AlarmMgmt.h) (revision f24be7fd135878e6ff28dff56937c31626bd4bc1) +++ firmware/App/Services/AlarmMgmt.h (.../AlarmMgmt.h) (revision cef6b0392becf60c69cf4e517701ba22642f072a) @@ -248,6 +248,7 @@ SW_FAULT_ID_HD_SYRINGE_INVALID_VREF, SW_FAULT_ID_HD_SYRINGE_INVALID_STATE, SW_FAULT_ID_HD_INVALID_BUBBLE_STATE, // 115 + SW_FAULT_ID_HD_INVALID_BUBBLE_ID, NUM_OF_SW_FAULT_IDS } SW_FAULT_ID_T; Index: firmware/App/Services/FPGA.c =================================================================== diff -u -r3d30c9829d316b8c5e632c0201a59c8d14b3486e -rcef6b0392becf60c69cf4e517701ba22642f072a --- firmware/App/Services/FPGA.c (.../FPGA.c) (revision 3d30c9829d316b8c5e632c0201a59c8d14b3486e) +++ firmware/App/Services/FPGA.c (.../FPGA.c) (revision cef6b0392becf60c69cf4e517701ba22642f072a) @@ -92,8 +92,8 @@ #define FPGA_ADV_BUBBLE_STATUS_MASK 0x0002 ///< Bit mask for venous air bubble detector input status. #define FPGA_ADA_BUBBLE_TEST_STATE_MASK 0x2000 ///< Bit mask for arterial air bubble detector self-test state. #define FPGA_ADV_BUBBLE_TEST_STATE_MASK 0x4000 ///< Bit mask for venous air bubble detector self-test state. -#define FPGA_ADA_BUBBLE_SELF_TEST_CMD 0x01 ///< Bit for arterial air bubble detector self-test command. -#define FPGA_ADV_BUBBLE_SELF_TEST_CMD 0x02 ///< Bit for venous air bubble detector self-test command. +#define FPGA_ADA_BUBBLE_SELF_TEST_CMD 0x04 ///< Bit for arterial air bubble detector self-test command. +#define FPGA_ADV_BUBBLE_SELF_TEST_CMD 0x08 ///< Bit for venous air bubble detector self-test command. // FPGA Sensors Record #pragma pack(push,1) Index: firmware/App/Tasks/TaskPriority.c =================================================================== diff -u -r04f033af4174bf41a7aa0ff9ccaae45b77472e01 -rcef6b0392becf60c69cf4e517701ba22642f072a --- firmware/App/Tasks/TaskPriority.c (.../TaskPriority.c) (revision 04f033af4174bf41a7aa0ff9ccaae45b77472e01) +++ firmware/App/Tasks/TaskPriority.c (.../TaskPriority.c) (revision cef6b0392becf60c69cf4e517701ba22642f072a) @@ -18,7 +18,8 @@ #include "Accel.h" #include "AirTrap.h" #include "BloodFlow.h" -#include "BloodLeak.h" +#include "BloodLeak.h" +#include "Bubble.h" #include "Buttons.h" #include "CPLD.h" #include "DialInFlow.h" @@ -91,6 +92,9 @@ // Monitor blood leak detector execBloodLeak(); + // Monitor air bubble detectors + execBubbles(); + #ifndef DISABLE_ACCELS // Monitor accelerometer execAccel();