Index: firmware/App/Controllers/Bubble.c =================================================================== diff -u -r152e924cfb7f4504d4df7ec44736f27b9257f36c -r8466e63f95f65a3ffb18c3af85ac99328e41167b --- firmware/App/Controllers/Bubble.c (.../Bubble.c) (revision 152e924cfb7f4504d4df7ec44736f27b9257f36c) +++ firmware/App/Controllers/Bubble.c (.../Bubble.c) (revision 8466e63f95f65a3ffb18c3af85ac99328e41167b) @@ -60,7 +60,6 @@ static BUBBLE_STATES_T handleBubbleSelfTestState( BUBBLES_T ); static void publishBubblesData( void ); -static U32 getPublishBubblesDataInterval( void ); /*********************************************************************//** * @brief @@ -181,6 +180,7 @@ static BUBBLE_STATES_T handleBubbleNormalState( BUBBLES_T bubble ) { BUBBLE_STATES_T state = BUBBLE_NORMAL_STATE; + TREATMENT_STATE_T treatmentState = getTreatmentState(); if ( ( bubble == ADA ) || ( bubble == ADV) ) { @@ -193,33 +193,43 @@ bubblesStatus[ bubble ].data = BUBBLE_DETECTED; } +#ifndef DISABLE_BUBBLE_ALARMS // Check status reading and act upon if ( BUBBLE_DETECTED == getBubbleStatus( bubble ) ) { - if ( ( getCurrentOperationMode() == MODE_TREA ) && ( getTreatmentState() != TREATMENT_RINSEBACK_STATE ) ) + if ( getCurrentOperationMode() == MODE_TREA ) { - // TODO: Enable if ADA is ever used to detect air bubble on arterial line during treatment - //if ( bubble == ADA ) - //{ - // activateAlarmNoData( ALARM_ID_HD_ARTERIAL_BUBBLE_DETECTED ); - //} - - if ( bubble == ADV ) + switch ( treatmentState ) { - activateAlarmNoData( ALARM_ID_HD_VENOUS_BUBBLE_DETECTED ); - } - } - else if ( ( getCurrentOperationMode() == MODE_TREA ) && ( getTreatmentState() == TREATMENT_RINSEBACK_STATE ) ) - { - // TODO: Enable if ADA is ever used to detect air bubble on arterial line during rinseback - //if ( bubble == ADA ) - //{ - // activateAlarmNoData( ALARM_ID_HD_ARTERIAL_BUBBLE_DETECTED_RINSEBACK ); - //} + case TREATMENT_BLOOD_PRIME_STATE: + case TREATMENT_DIALYSIS_STATE: + case TREATMENT_END_STATE: + // TODO: Enable if ADA is ever used to detect air bubble on arterial line during treatment + //if ( bubble == ADA ) + //{ + // activateAlarmNoData( ALARM_ID_HD_ARTERIAL_BUBBLE_DETECTED ); + //} + if ( bubble == ADV ) + { + activateAlarmNoData( ALARM_ID_HD_VENOUS_BUBBLE_DETECTED ); + } + break; - if ( bubble == ADV ) - { - activateAlarmNoData( ALARM_ID_HD_VENOUS_BUBBLE_DETECTED_RINSEBACK ); + case TREATMENT_RINSEBACK_STATE: + // TODO: Enable if ADA is ever used to detect air bubble on arterial line during rinseback + //if ( bubble == ADA ) + //{ + // activateAlarmNoData( ALARM_ID_HD_ARTERIAL_BUBBLE_DETECTED_RINSEBACK ); + //} + if ( bubble == ADV ) + { + activateAlarmNoData( ALARM_ID_HD_VENOUS_BUBBLE_DETECTED_RINSEBACK ); + } + break; + + default: + // Ignore other treatment states + break; } } } @@ -233,8 +243,10 @@ if ( bubble == ADV ) { clearAlarmCondition( ALARM_ID_HD_VENOUS_BUBBLE_DETECTED ); + clearAlarmCondition( ALARM_ID_HD_VENOUS_BUBBLE_DETECTED_RINSEBACK ); } } +#endif if ( TRUE == bubblesSelfTestRequested[ bubble ] ) { @@ -291,7 +303,7 @@ { activateAlarmNoData( ALARM_ID_HD_ARTERIAL_BUBBLE_SELF_TEST_FAILURE ); } - else if ( bubble == ADV ) + else // ADV { activateAlarmNoData( ALARM_ID_HD_VENOUS_BUBBLE_SELF_TEST_FAILURE ); } @@ -316,26 +328,6 @@ /*********************************************************************//** * @brief - * The getPublishBubblesDataInterval function gets the air bubbles data - * publication interval. - * @details Inputs: bubblesDataPublishInterval - * @details Outputs: none - * @return the current air bubbles data publication interval (in task intervals). - *************************************************************************/ -static U32 getPublishBubblesDataInterval( void ) -{ - U32 result = bubblesDataPublishInterval.data; - - if ( OVERRIDE_KEY == bubblesDataPublishInterval.override ) - { - result = bubblesDataPublishInterval.ovData; - } - - return result; -} - -/*********************************************************************//** - * @brief * The publishBubblesData function publishes air bubble detectors data at * the set interval. * @details Inputs: status, bubblesState @@ -345,7 +337,7 @@ static void publishBubblesData( void ) { // Publish air bubble detectors data on interval - if ( ++bubblesDataPublicationTimerCounter >= getPublishBubblesDataInterval() ) + if ( ++bubblesDataPublicationTimerCounter >= getU32OverrideValue( &bubblesDataPublishInterval ) ) { BUBBLE_STATUS_T statusADA = getBubbleStatus( ADA ); BUBBLE_STATUS_T statusADV = getBubbleStatus( ADV );