Index: firmware/App/Modes/OperationModes.c =================================================================== diff -u -r4d7d40a27130dc813d653f044cbb856b1b7d8481 -r0bf1c0824844ed4c227eef0323238daedf505dc7 --- firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision 4d7d40a27130dc813d653f044cbb856b1b7d8481) +++ firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision 0bf1c0824844ed4c227eef0323238daedf505dc7) @@ -17,9 +17,6 @@ #include "gio.h" -#include "SystemCommMessages.h" -#include "TaskGeneral.h" -#include "OperationModes.h" #include "ModeChemicalDisinfect.h" #include "ModeDrain.h" #include "ModeFault.h" @@ -31,6 +28,9 @@ #include "ModeService.h" #include "ModeSolo.h" #include "ModeStandby.h" +#include "OperationModes.h" +#include "SystemCommMessages.h" +#include "TaskGeneral.h" /** * @addtogroup DGOperationModes @@ -39,18 +39,17 @@ // ********** private definitions ********** -#define BROADCAST_DG_OP_MODE_INTERVAL ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ///< interval (ms/task time) at which the op mode is published on the CAN bus. +#define BROADCAST_DG_OP_MODE_INTERVAL ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ///< interval (ms/task time) at which the operation mode is published on the CAN bus. // ********** private data ********** -static volatile BOOL modeRequest[NUM_OF_DG_MODES - 1]; ///< Array of mode request flags. +static volatile BOOL modeRequest[ NUM_OF_DG_MODES - 1 ]; ///< Array of mode request flags. 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. -static U32 broadcastModeIntervalCtr = 11; ///< Interval counter used to determine when to broadcase operation mode. Initialize to 11 to stagger broadcast. -static U32 dgOpModePublicationTimerCounter = 0; ///< Timer counter for DG operation mode publication +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. -static const DG_OP_MODE_T MODE_TRANSITION_TABLE[NUM_OF_DG_MODES - 1][NUM_OF_DG_MODES - 1] = +static const DG_OP_MODE_T MODE_TRANSITION_TABLE[ NUM_OF_DG_MODES - 1 ][ NUM_OF_DG_MODES - 1 ] = { // from to-> FAULT SERVICE INIT STANBY STBY-SOLO RE-CIRC FILL DRAIN FLUSH HEAT DIS CHEM DIS /* FAUL */{ DG_MODE_FAUL, DG_MODE_SERV, DG_MODE_NLEG, DG_MODE_NLEG, DG_MODE_NLEG, DG_MODE_NLEG, DG_MODE_NLEG, DG_MODE_NLEG, DG_MODE_NLEG, DG_MODE_NLEG, DG_MODE_NLEG }, @@ -107,9 +106,6 @@ initFlushMode(); initHeatDisinfectMode(); initChemicalDisinfectMode(); - - // initialize broadcast timer counter - dgOpModePublicationTimerCounter = 0; } /*********************************************************************//** @@ -125,7 +121,7 @@ // any new mode requests? newMode = arbitrateModeRequest(); // will return current mode if no pending requests - newMode = MODE_TRANSITION_TABLE[currentMode][newMode]; + newMode = MODE_TRANSITION_TABLE[ currentMode ][ newMode ]; // is requested new mode valid and legal at this time? if ( newMode >= DG_MODE_NLEG ) @@ -194,7 +190,7 @@ currentMode = DG_MODE_FAUL; currentSubMode = 0; break; - } // end switch + } // publish op mode on interval broadcastOperationMode();