change_operating_state

=change_operating_state=

Owner: Alex

Purpose and Documentation
Calling this function will examine the Settings object, and then decide on the appropriate state (see: state transition diagram) for the system to be in. By performing all the transitions at a single point, we avoid situations where multiple parts of the program attempt to jump to different states at the same time.

Syntax
int change_operating_state(void)

Usage
This function is called as part of the main loop of the program.

Input Arguments

 * void. This function takes no arguments.

Output Arguments

 * None. This function does not make changes to any existing values.

Return Value

 * int. When the state has changed successfully, a 1 is returned. Otherwise, a 0 is returned.

Read

 * int currentState

Write

 * int currentState

Operation
Starting at the current operating state, a series of logic tests is performed on the values of the Settings object to determine the appropriate state to jump to. Then, the relevant function call is made so that the program transitions into that state.

Code
int change_operating_state(void) {

}