Index: firmware/App/Modes/OperationModes.c =================================================================== diff -u -re5d1d67106a93a6cd1b5692b586625d715732e2f -r8466e63f95f65a3ffb18c3af85ac99328e41167b --- firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision e5d1d67106a93a6cd1b5692b586625d715732e2f) +++ firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision 8466e63f95f65a3ffb18c3af85ac99328e41167b) @@ -38,7 +38,7 @@ // ********** private data ********** /// HD operation mode broadcast interval (in task interval/sec). -static const U32 BROADCAST_HD_OP_MODE_INTERVAL = ( 250 / TASK_GENERAL_INTERVAL ); +#define BROADCAST_HD_OP_MODE_INTERVAL ( 250 / TASK_GENERAL_INTERVAL ) // ********** private data ********** @@ -47,6 +47,8 @@ static HD_OP_MODE_T currentMode = MODE_INIT; ///< Current operation mode. static U32 currentSubMode = 0; ///< The currently active state of the active mode. static U32 broadcastModeIntervalCtr = 11; ///< Interval counter used to determine when to broadcast operation mode. Initialize to 11 to stagger broadcast. +/// Interval (in task intervals) at which to publish operation mode data to CAN bus. +static OVERRIDE_U32_T opModePublishInterval = { BROADCAST_HD_OP_MODE_INTERVAL, BROADCAST_HD_OP_MODE_INTERVAL, BROADCAST_HD_OP_MODE_INTERVAL, 0 }; /// This matrix determines legal transitions from one mode to another static const HD_OP_MODE_T MODE_TRANSITION_TABLE[ NUM_OF_MODES - 1 ][ NUM_OF_MODES - 1 ] = { @@ -358,7 +360,7 @@ *************************************************************************/ static void broadcastOperationMode( void ) { - if ( ++broadcastModeIntervalCtr >= BROADCAST_HD_OP_MODE_INTERVAL ) + if ( ++broadcastModeIntervalCtr >= getU32OverrideValue( &opModePublishInterval ) ) { broadcastModeIntervalCtr = 0; broadcastHDOperationMode( (U32)currentMode, currentSubMode ); @@ -399,4 +401,51 @@ return result; } +/*********************************************************************//** + * @brief + * The testSetOpModePublishIntervalOverride function sets the override of the + * operation mode publication interval. + * @details Inputs: none + * @details Outputs: opModePublishInterval + * @param ms milliseconds between operation mode broadcasts + * @return TRUE if override set successful, FALSE if not + *************************************************************************/ +BOOL testSetOpModePublishIntervalOverride( U32 ms ) +{ + BOOL result = FALSE; + + if ( TRUE == isTestingActivated() ) + { + U32 intvl = ms / TASK_GENERAL_INTERVAL; + + result = TRUE; + opModePublishInterval.ovData = intvl; + opModePublishInterval.override = OVERRIDE_KEY; + } + + return result; +} + +/*********************************************************************//** + * @brief + * The testResetOpModePublishIntervalOverride function resets the override of the + * operation mode data publication interval. + * @details Inputs: none + * @details Outputs: opModePublishInterval + * @return TRUE if override reset successful, FALSE if not + *************************************************************************/ +BOOL testResetOpModePublishIntervalOverride( void ) +{ + BOOL result = FALSE; + + if ( TRUE == isTestingActivated() ) + { + result = TRUE; + opModePublishInterval.override = OVERRIDE_RESET; + opModePublishInterval.ovData = opModePublishInterval.ovInitData; + } + + return result; +} + /**@}*/