Index: firmware/App/Modes/OperationModes.c =================================================================== diff -u -r025612ad77fe630889a364586de54bffe5262d56 -r9490539a39d2bfd8d40558f3c05b09b48f041e6c --- firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision 025612ad77fe630889a364586de54bffe5262d56) +++ firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision 9490539a39d2bfd8d40558f3c05b09b48f041e6c) @@ -40,7 +40,9 @@ // ********** private definitions ********** -#define BROADCAST_DG_OP_MODE_INTERVAL ( 250 / TASK_GENERAL_INTERVAL ) ///< interval (ms/task time) at which the operation mode is published on the CAN bus. +#define BROADCAST_DG_OP_MODE_INTERVAL ( 250 / TASK_GENERAL_INTERVAL ) ///< interval (ms/task time) at which the operation mode is published on the CAN bus. +// The data publish counter offset is a lower number to make sure DG is sending its status to the HD from the beginning and alarm 140 is not raised +#define DATA_PUBLISH_COUNTER_START_COUNT 2 ///< Data publish counter start count. // ********** private data ********** @@ -50,7 +52,7 @@ 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. +static U32 dataPublishCounter; ///< Interval counter used to determine when to broadcast operation mode. Initialize to 11 to stagger broadcast. static U32 priorSubMode = 0; ///< The prior submode state. /// This matrix determines legal transitions from one mode to another. @@ -99,6 +101,8 @@ currentMode = DG_MODE_INIT; currentSubMode = 0; priorSubMode = 0; + dataPublishCounter = DATA_PUBLISH_COUNTER_START_COUNT; + transitionToNewOperationMode( DG_MODE_INIT ); // call initializers for the individual modes @@ -369,7 +373,7 @@ *************************************************************************/ static void broadcastOperationMode( void ) { - if ( ++broadcastModeIntervalCtr >= getDGOpModePublishInterval() ) + if ( ++dataPublishCounter >= getDGOpModePublishInterval() ) { OP_MODES_DATA_T data; @@ -378,7 +382,7 @@ broadcastData( MSG_ID_DG_OP_MODE, COMM_BUFFER_OUT_CAN_DG_BROADCAST, (U08*)&data, sizeof( OP_MODES_DATA_T ) ); - broadcastModeIntervalCtr = 0; + dataPublishCounter = 0; } }