Index: firmware/App/Modes/OperationModes.c =================================================================== diff -u -r138efd92a8645e0d2fe422409ef5a33dd2929a25 -r5ff39fd6948ae3656b4035c85325bd8fca0a37f3 --- firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision 138efd92a8645e0d2fe422409ef5a33dd2929a25) +++ firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision 5ff39fd6948ae3656b4035c85325bd8fca0a37f3) @@ -16,6 +16,7 @@ #include "gio.h" +#include "TaskGeneral.h" #include "OperationModes.h" #include "ModeChemicalDisinfect.h" #include "ModeDisinfect.h" @@ -34,6 +35,10 @@ * @{ */ +// ********** private definitions ********** + +#define DG_OP_MODE_BROADCAST_INTERVAL ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ///< interval (ms/task time) at which the op mode is published on the CAN bus. + // ********** private data ********** static volatile BOOL modeRequest[NUM_OF_MODES - 1]; ///< Array of mode request flags. @@ -56,6 +61,8 @@ /* CHEM */{ MODE_FAUL, MODE_NLEG, MODE_NLEG, MODE_STAN, MODE_NLEG, MODE_NLEG, MODE_NLEG, MODE_NLEG, MODE_NLEG, MODE_NLEG, MODE_CHEM } }; +static U32 dgOpModePublicationTimerCounter = 0; + // ********** private function prototypes ********** static OP_MODE arbitrateModeRequest( void ); @@ -96,6 +103,9 @@ initFlushMode(); initDisinfectMode(); initChemicalDisinfectMode(); + + // initialize broadcast timer counter + dgOpModePublicationTimerCounter = 0; } /*********************************************************************//** @@ -182,6 +192,13 @@ // TODO - trigger s/w fault break; } // end switch + + // publish op mode on interval + if ( ++dgOpModePublicationTimerCounter >= DG_OP_MODE_BROADCAST_INTERVAL ) + { + broadcastDGOpMode( (U32)currentMode ); + dgOpModePublicationTimerCounter = 0; + } } /*********************************************************************//****