Index: firmware/App/Modes/OperationModes.c =================================================================== diff -u -r1a5efe97f5f39594b45797fded52cafce92afe80 -r6818dafc0839d6e8585f5e6f35013f539ad5a0ed --- firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision 1a5efe97f5f39594b45797fded52cafce92afe80) +++ firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision 6818dafc0839d6e8585f5e6f35013f539ad5a0ed) @@ -47,6 +47,8 @@ static DG_OP_MODE_T lastMode = DG_MODE_INIT; ///< Last operation mode prior to current mode. static DG_OP_MODE_T currentMode = DG_MODE_INIT; ///< The currently active mode. static U32 currentSubMode = 0; ///< The currently active state of the active mode. +/// DG operation mode data publish interval. +static OVERRIDE_U32_T dgOpModePublishInterval = { BROADCAST_DG_OP_MODE_INTERVAL, BROADCAST_DG_OP_MODE_INTERVAL, 0, 0 }; static U32 broadcastModeIntervalCtr = 11; ///< Interval counter used to determine when to broadcast operation mode. Initialize to 11 to stagger broadcast. /// This matrix determines legal transitions from one mode to another. @@ -71,6 +73,7 @@ static DG_OP_MODE_T arbitrateModeRequest( void ); static void transitionToNewOperationMode( DG_OP_MODE_T newMode ); +static U32 getDGOpModePublishInterval( void ); static void broadcastOperationMode( void ); /*********************************************************************//** @@ -345,11 +348,84 @@ *************************************************************************/ static void broadcastOperationMode( void ) { - if ( ++broadcastModeIntervalCtr >= BROADCAST_DG_OP_MODE_INTERVAL ) + if ( ++broadcastModeIntervalCtr >= getDGOpModePublishInterval() ) { broadcastModeIntervalCtr = 0; broadcastDGOperationMode( (U32)currentMode, currentSubMode ); } } +/*********************************************************************//** + * @brief + * The getDGOpModePublishInterval function gets the current DG operation mode + * data publish interval. + * @details Inputs: dgOpModePublishInterval + * @details Outputs: DG operation mode broadcast message sent + * @return none + *************************************************************************/ +static U32 getDGOpModePublishInterval( void ) +{ + U32 result = dgOpModePublishInterval.data; + + if ( OVERRIDE_KEY == dgOpModePublishInterval.override ) + { + result = dgOpModePublishInterval.ovData; + } + + return result; +} + + +/************************************************************************* + * TEST SUPPORT FUNCTIONS + *************************************************************************/ + + +/*********************************************************************//** + * @brief + * The testSetDGOpModePublishIntervalOverride function overrides the + * DG operation mode publish interval. + * @details Inputs: none + * @details Outputs: dgOpModePublishInterval + * @param value override DG operation mode publish interval with (in ms) + * @return TRUE if override successful, FALSE if not + *************************************************************************/ +BOOL testSetDGOpModePublishIntervalOverride( U32 value ) +{ + BOOL result = FALSE; + + if ( TRUE == isTestingActivated() ) + { + U32 intvl = value / TASK_GENERAL_INTERVAL; + + result = TRUE; + dgOpModePublishInterval.ovData = intvl; + dgOpModePublishInterval.override = OVERRIDE_KEY; + } + + return result; +} + +/*********************************************************************//** + * @brief + * The testResetDGOpModePublishIntervalOverride function resets the + * override of the DG operation mode publish interval. + * @details Inputs: none + * @details Outputs: dgOpModePublishInterval + * @return TRUE if override reset successful, FALSE if not + *************************************************************************/ +BOOL testResetDGOpModePublishIntervalOverride( void ) +{ + BOOL result = FALSE; + + if ( TRUE == isTestingActivated() ) + { + result = TRUE; + dgOpModePublishInterval.override = OVERRIDE_RESET; + dgOpModePublishInterval.ovData = dgOpModePublishInterval.ovInitData; + } + + return result; +} + /**@}*/