Index: firmware/App/Modes/ModeStandby.c =================================================================== diff -u -r499e5de29e706d09f79ba22511068990c4044e84 -rf267c42c91fd6e22db80e19039b8993582de51e9 --- firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision 499e5de29e706d09f79ba22511068990c4044e84) +++ firmware/App/Modes/ModeStandby.c (.../ModeStandby.c) (revision f267c42c91fd6e22db80e19039b8993582de51e9) @@ -18,10 +18,23 @@ #include "ModeStandby.h" #include "CPLD.h" +// ********** private definitions ********** + +typedef enum Standby_Mode_States +{ + STANDBY_MODE_STATE_START = 0, + STANDBY_MODE_STATE_IDLE, + NUM_OF_STANDBY_MODE_STATES +} STANDBY_MODE_STATE_T; + // ********** private data ********** +static STANDBY_MODE_STATE_T standbyState = STANDBY_MODE_STATE_START; + // ********** private function prototypes ********** +STANDBY_MODE_STATE_T handleStandbyIdleState( void ); + /************************************************************************* * @brief initStandbyMode * The initStandbyMode function initializes the Standby Mode module. @@ -46,6 +59,8 @@ *************************************************************************/ void transitionToStandbyMode( void ) { + // reset to start state each time we transition to standby mode + standbyState = STANDBY_MODE_STATE_START; } /************************************************************************* @@ -59,6 +74,43 @@ *************************************************************************/ void execStandbyMode( void ) { + // execute current Standby state + switch ( standbyState ) + { + case STANDBY_MODE_STATE_START: + standbyState = STANDBY_MODE_STATE_IDLE; + break; + case STANDBY_MODE_STATE_IDLE: + standbyState = handleStandbyIdleState(); + break; + + default: + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_SOFTWARE_FAULT, 0, standbyState ) + standbyState = STANDBY_MODE_STATE_START; + break; + } } +/************************************************************************* + * @brief + * The handleStandbyIdleState function executes the Idle state of the \n + * Standby Mode state machine. + * @details + * Inputs : none + * Outputs : + * @param none + * @return the next state + *************************************************************************/ +STANDBY_MODE_STATE_T handleStandbyIdleState( void ) +{ + STANDBY_MODE_STATE_T result = STANDBY_MODE_STATE_IDLE; + + // go to standby or standby solo mode depending on whether HD is connected +// if ( FALSE == isHDCommunicating() ) +// { +// requestNewOperationMode( MODE_SOLO ); +// } + + return result; +}