State Diagrams
There are 10 state machines/services involved:
- Arcade FSM: Controls what interactions are to occur.
- Global Timer Service: Monitors time for the user to complete game.
- Reset Service: Monitors for user interactions with device.
- Welcome FSM: Executes welcome mode.
- Air Leaks SM: User interaction where the user needs to plug air leaks before oxygen runs out.
- Power Crank SM: User interaction where the user needs to turn a crank to generate power for the dome and be able to use the cannon.
- Meteor SM: User interaction where the user needs to shoot down meteors.
- Cannon SM: Moves the cannon based on an analog input, and gives vibratory feedback when meteor is destroyed.
- Button Debounce: Debounces button for firing the cannon.
- End Game FSM: Controls the sequence of events for winning or losing the game. Returns the TOT.
There are 5 event checkers:
- Pot Checker: Posts New_Pot_Value to Reset_SM and Cannon_SM when user moves the cannon positioning knob.
- Button Checker: Posts Button_Down to Debounce when user presses button to fire the cannon.
- Crank Checker: Posts Falling_edge or Rising_Edge to Reset_SM and PowerCrank_SM if the user begins or stops moving the crank for power generation.
- Air plug Checker: Posts AirflowPlugged to Reset_SM and AirLeak_SM when the user plugs an air leak.
- Tot Checker: Checks if TOT was inserted. Posts Tot_Inserted to all.
Diagrams notation: Each box corresponds to a state, the arrows are transitions. The transition notation: Event_name(event_parameter)[Conditions]/ Actions.
Arcade FSM
Global timer
Reset Service
Welcome mode
Air Leak SM
Meteor SM
Cannon SM
Button Debouncer
Power Crank
End of Game FSM