Index: firmware/App/Modes/OperationModes.c =================================================================== diff -u -r8a4182663ef6b12e3fd6414c0c14158943cd4ce1 -r1a5efe97f5f39594b45797fded52cafce92afe80 --- firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision 8a4182663ef6b12e3fd6414c0c14158943cd4ce1) +++ firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision 1a5efe97f5f39594b45797fded52cafce92afe80) @@ -44,6 +44,7 @@ // ********** private data ********** static volatile BOOL modeRequest[ NUM_OF_DG_MODES - 1 ]; ///< Array of mode request flags. +static DG_OP_MODE_T lastMode = DG_MODE_INIT; ///< Last operation mode prior to current mode. 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 broadcast operation mode. Initialize to 11 to stagger broadcast. @@ -134,6 +135,7 @@ if ( currentMode != newMode ) { // handle transition to new mode + lastMode = currentMode; transitionToNewOperationMode( newMode ); currentMode = newMode; } @@ -232,6 +234,18 @@ /*********************************************************************//** * @brief + * The getPreviousOperationMode function gets the previous operation mode. + * @details Inputs: lastMode + * @details Outputs: none + * @return the previous operation mode + *************************************************************************/ +DG_OP_MODE_T getPreviousOperationMode( void ) +{ + return lastMode; +} + +/*********************************************************************//** + * @brief * The arbitrateModeRequest function selects highest priority mode request * and clear all requests. * @details Inputs: none