Index: firmware/App/Drivers/BubbleDetector.c =================================================================== diff -u -raf8485c010085b535a81e9c44426c60eea2535e6 -r37d4284f56e175716ea13ae56c621110fa96e53c --- firmware/App/Drivers/BubbleDetector.c (.../BubbleDetector.c) (revision af8485c010085b535a81e9c44426c60eea2535e6) +++ firmware/App/Drivers/BubbleDetector.c (.../BubbleDetector.c) (revision 37d4284f56e175716ea13ae56c621110fa96e53c) @@ -16,7 +16,8 @@ ***************************************************************************/ #include "BubbleDetector.h" -#include "FpgaTD.h" +#include "FpgaTD.h" +#include "Messaging.h" /** * @addtogroup BubbleDetector @@ -101,6 +102,52 @@ * TEST SUPPORT FUNCTIONS *************************************************************************/ -// TODO - Michael G, please add messaging and handler function for a bubble detector state override + +/*********************************************************************//** + * @brief + * The testBubbleDetectOverride function overrides the bubble detect state + * for a given bubble detector. + * @details \b Inputs: msTimerCount + * @details \b Outputs: alarmStartedAt[] + * @param message Override message from Dialin which includes an ID of + * the sensor to override and the state to override the sensor to. + * @return TRUE if override request is successful, FALSE if not + *************************************************************************/ +BOOL testBubbleDetectOverride( MESSAGE_T *message ) +{ + BOOL result = FALSE; + TEST_OVERRIDE_ARRAY_PAYLOAD_T override; + OVERRIDE_TYPE_T ovType = getOverrideArrayPayloadFromMessage( message, &override ); + + // 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; +} /**@}*/