Index: firmware/App/Modes/OperationModes.c =================================================================== diff -u -ra7821aff3dc204a060233b0753253ec04d020557 -r33172fb03fd33afef26de13c343480c62cfa1a3c --- firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision a7821aff3dc204a060233b0753253ec04d020557) +++ firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision 33172fb03fd33afef26de13c343480c62cfa1a3c) @@ -61,7 +61,8 @@ static HD_OP_MODE_T currentMode; ///< Current operation mode. static U32 currentSubMode; ///< The currently active state of the active mode. static U32 broadcastModeIntervalCtr; ///< Interval counter used to determine when to broadcast operation mode. Initialize to 11 to stagger broadcast. -static U32 currentSubState; +static U32 currentSubState; ///< current sub state. +static U32 current4thLevelState; ///< current 4th level state. /// 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 }; /// Local structure init for saving confirmation requests @@ -112,7 +113,8 @@ lastMode = MODE_INIT; currentMode = MODE_INIT; currentSubMode = 0; - currentSubState = 0xFF; + currentSubState = NO_SUB_STATE; + current4thLevelState = NO_SUB_STATE; broadcastModeIntervalCtr = DATA_PUBLISH_COUNTER_START_COUNT; transitionToNewOperationMode( MODE_INIT ); @@ -141,6 +143,7 @@ U32 priorSubMode = currentSubMode; U32 priorSubState = currentSubState; U32 priorOpMode = (U32)currentMode; + U32 prior4thLevelState = current4thLevelState; // Any new mode requests? newMode = arbitrateModeRequest(); // Will return current mode if no pending requests @@ -215,7 +218,8 @@ } // End switch // Send operation status event when appropriate - if ( priorOpMode != currentMode || priorSubMode != currentSubMode || priorSubState != currentSubState ) + if ( priorOpMode != currentMode || priorSubMode != currentSubMode || + priorSubState != currentSubState || prior4thLevelState != current4thLevelState ) { sendOperationStatusEvent(); SEND_EVENT_WITH_2_U32_DATA( HD_EVENT_SUB_MODE_CHANGE, priorSubMode, currentSubMode ) @@ -593,6 +597,19 @@ /*********************************************************************//** * @brief + * The setCurrentSubState function sets the current subState. + * @details Inputs: subState + * @details Outputs: currentSubState + * @param subState the enumerated sub state. + * @return none + *************************************************************************/ +void setCurrent4thLevelState( U32 state ) +{ + current4thLevelState = state; +} + +/*********************************************************************//** + * @brief * The sendOperationStatusEvent function constructs and sends an HD operation * status event. * @details Inputs: currentMode, currentSubMode, currentSubState @@ -606,7 +623,8 @@ EVENT_DATA_T dat2; U32 opData = ( (U08)currentMode + ( (U08)currentSubMode << SHIFT_8_BITS_FOR_BYTE_SHIFT ) + - ( (U08)currentSubState << SHIFT_16_BITS_FOR_WORD_SHIFT ) ); + ( (U08)currentSubState << SHIFT_16_BITS_FOR_WORD_SHIFT ) + + ( (U08)current4thLevelState << SHIFT_24_BITS ) ); dat2.dataType = EVENT_DATA_TYPE_U32; dat2.data.uInt.data = 0;