Index: firmware/App/Modes/OperationModes.c =================================================================== diff -u -rb77808c306061c4ee874ddb6608a7da803d26ee4 -r164e1a3ffca18c703676bc7f57f5903c76050600 --- firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision b77808c306061c4ee874ddb6608a7da803d26ee4) +++ firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision 164e1a3ffca18c703676bc7f57f5903c76050600) @@ -7,8 +7,8 @@ * * @file OperationModes.c * -* @author (last) Dara Navaei -* @date (last) 29-May-2023 +* @author (last) Sean Nash +* @date (last) 30-Sep-2023 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 @@ -143,7 +143,6 @@ { DG_OP_MODE_T newMode; U32 priorSubMode = currentSubMode; - U32 priorOpMode = currentMode; U32 priorSubState = currentSubState; // any new mode requests? @@ -169,6 +168,10 @@ lastMode = currentMode; transitionToNewOperationMode( newMode ); currentMode = newMode; + // Set the last sub mode to 0 + // to ensure events cover the transition from submode 0 -> 1 -> 2 + priorSubMode = 0; + sendOperationStatusEvent(); } // mode specific processing to be done continuously @@ -238,7 +241,7 @@ } // Send operation status event when appropriate - if ( ( priorOpMode != currentMode ) || ( priorSubMode != currentSubMode ) || ( priorSubState != currentSubState ) ) + if ( ( priorSubMode != currentSubMode ) || ( priorSubState != currentSubState ) ) { sendOperationStatusEvent(); SEND_EVENT_WITH_2_U32_DATA( DG_EVENT_SUB_MODE_CHANGE, priorSubMode, currentSubMode ) @@ -296,6 +299,18 @@ /*********************************************************************//** * @brief + * The getCurrentOperationSubMode function gets the current operation submode. + * @details Inputs: currentSubMode + * @details Outputs: none + * @return the current operation submode + *************************************************************************/ +U32 getCurrentOperationSubMode( void ) +{ + return currentSubMode; +} + +/*********************************************************************//** + * @brief * The arbitrateModeRequest function selects highest priority mode request * and clear all requests. * @details Inputs: none @@ -466,12 +481,10 @@ * status event. * @details Inputs: currentMode, currentSubMode, currentSubState * @details Outputs: dat1, dat2. - * @param none * @return none *************************************************************************/ static void sendOperationStatusEvent() { - EVENT_DATA_T dat1; EVENT_DATA_T dat2; U32 opData = ( (U08)currentMode +