Index: firmware/App/Drivers/BubbleDetector.c =================================================================== diff -u -r0c8ae7b952186d912c77d8c2cfb7dad809fa5225 -r961784c895cb8f551a2623cd02dcbfe42d04b7c2 --- firmware/App/Drivers/BubbleDetector.c (.../BubbleDetector.c) (revision 0c8ae7b952186d912c77d8c2cfb7dad809fa5225) +++ firmware/App/Drivers/BubbleDetector.c (.../BubbleDetector.c) (revision 961784c895cb8f551a2623cd02dcbfe42d04b7c2) @@ -15,68 +15,68 @@ * ***************************************************************************/ -#include "BubbleDetector.h" +#include "BubbleDetector.h" #include "FpgaTD.h" -#include "Messaging.h" - +#include "Messaging.h" + /** * @addtogroup BubbleDetector * @{ */ -// ********** private definitions ********** - +// ********** private definitions ********** -// ********** private data ********** - + +// ********** private data ********** + /// Current bubble detected states (overrideable). static OVERRIDE_U32_T currentBubbleState[ NUM_OF_BUBBLE_DETECTORS ]; - + // ********** private function prototypes ********** -/*********************************************************************//** - * @brief - * The initBubbleDetector function initializes the BubbleDetector unit. - * @details \b Inputs: none - * @details \b Outputs: Bubble Detector unit is initialized. - * @return none - *************************************************************************/ +/*********************************************************************//** + * @brief + * The initBubbleDetector function initializes the BubbleDetector unit. + * @details \b Inputs: none + * @details \b Outputs: Bubble Detector unit is initialized. + * @return none + *************************************************************************/ void initBubbleDetector( void ) { - currentBubbleState[ BUBBLE_DETECTOR_ADV ].data = NO_BUBBLE_DETECTED; - currentBubbleState[ BUBBLE_DETECTOR_ADV ].ovData = NO_BUBBLE_DETECTED; - currentBubbleState[ BUBBLE_DETECTOR_ADV ].ovInitData = NO_BUBBLE_DETECTED; - currentBubbleState[ BUBBLE_DETECTOR_ADV ].override = OVERRIDE_RESET; -} - + currentBubbleState[ H18_BBLD ].data = NO_BUBBLE_DETECTED; + currentBubbleState[ H18_BBLD ].ovData = NO_BUBBLE_DETECTED; + currentBubbleState[ H18_BBLD ].ovInitData = NO_BUBBLE_DETECTED; + currentBubbleState[ H18_BBLD ].override = OVERRIDE_RESET; +} + /*********************************************************************//** * @brief * The readBubbleDetector function gets the current bubble detected state * for a all bubble detector sensors from the FPGA. * @note This function should be called periodically to maintain fresh * sensor readings for all bubble detectors. * @details \b Inputs: FPGA - * @details \b Outputs: none + * @details \b Outputs: currentBubbleState[] * @return none *************************************************************************/ void readBubbleDetectors( void ) { BOOL bubble; - bubble = ADVBubbleDetected(); // read current sensor state from FPGA - currentBubbleState[ BUBBLE_DETECTOR_ADV ].data = (U32)( FALSE == bubble ? NO_BUBBLE_DETECTED : BUBBLE_DETECTED ); + bubble = H18BubbleDetected(); // read current sensor state from FPGA + currentBubbleState[ H18_BBLD ].data = (U32)( FALSE == bubble ? NO_BUBBLE_DETECTED : BUBBLE_DETECTED ); } -/*********************************************************************//** - * @brief +/*********************************************************************//** + * @brief * The getBubbleDetectedState function gets the current bubble detected state * for a given bubble detector sensor. - * @details \b Alarm: ALARM_ID_TD_SOFTWARE_FAULT if given sensor is invalid. - * @details \b Inputs: currentBubbleState - * @details \b Outputs: none - * @param sensor ID of bubble detector sensor to get state for. - * @return The current state of the given bubble detector sensor. - *************************************************************************/ + * @details \b Alarm: ALARM_ID_TD_SOFTWARE_FAULT if given sensor is invalid. + * @details \b Inputs: currentBubbleState[] + * @details \b Outputs: none + * @param sensor ID of bubble detector sensor to get state for. + * @return The current state of the given bubble detector sensor. + *************************************************************************/ BUBBLE_STATE_T getBubbleDetectedState( BUBBLE_DETECTOR_T sensor ) { BUBBLE_STATE_T result = NO_BUBBLE_DETECTED; @@ -94,7 +94,7 @@ SET_ALARM_WITH_2_U32_DATA( ALARM_ID_TD_SOFTWARE_FAULT, SW_FAULT_ID_BUBBLE_DETECTOR_INVALID_SENSOR, sensor ) } - return result; + return result; } @@ -115,39 +115,9 @@ *************************************************************************/ BOOL testBubbleDetectOverride( MESSAGE_T *message ) { - BOOL result = FALSE; - TEST_OVERRIDE_ARRAY_PAYLOAD_T override; - OVERRIDE_TYPE_T ovType = getOverrideArrayPayloadFromMessage( message, &override ); + BOOL result = u32ArrayOverride( message, ¤tBubbleState[0], NUM_OF_BUBBLE_DETECTORS - 1, 0, NUM_OF_BUBBLE_DETECTION_STATES - 1 ); - // Verify tester has logged in with TD and override type is valid - if ( ( TRUE == isTestingActivated() ) && ( ovType != OVERRIDE_INVALID ) && ( ovType < NUM_OF_OVERRIDE_TYPES ) ) - { - U32 sensor = override.index; - - // Verify bubble detector index of override - if ( sensor < NUM_OF_BUBBLE_DETECTORS ) - { - if ( OVERRIDE_OVERRIDE == ovType ) - { - U32 value = override.state.u32; - - if ( value < NUM_OF_BUBBLE_DETECTION_STATES ) - { - result = TRUE; - currentBubbleState[ sensor ].ovData = value; - currentBubbleState[ sensor ].override = OVERRIDE_KEY; - } - } - else - { - result = TRUE; - currentBubbleState[ sensor ].override = OVERRIDE_RESET; - currentBubbleState[ sensor ].ovData = currentBubbleState[ sensor ].ovInitData; - } - } - } - return result; } - + /**@}*/