Professional Documents
Culture Documents
RunMotor
Current State is InitPState
If ES_INIT received, change state to Waiting
CurrentState is GameOver
------
Check4FrontWall
If front limit switch position has changed, and is pressed, post ES_FRONTCRASH to MainMasterSM
Update Lastlimitswitch position as currentposition
Check4RearWall
If rear limit switch position has changed, and is pressed, post ES_BACKCRASH to MainMasterSM and MotorService
Update Lastlimitswitch position as currentposition
Check4Tape
If MasterTapeFlag is set, check if any tape sensor senses tape and post ES_TAPEDETECTED to masterservice if Tape is
detected
If TapeLeftFlag is set, check if left sensor detects tape and post ES_TAPE_LEFT to motor service if Tape is detected
If TapeMiddle is set, check if Middle sensor detects tape and post ES_TAPE_MIDDLE to motor service if Tape is detected
If TapeRight is set, check if Right sensor detects tape and post ES_TAPE_RIGHT to motor service if Tape is detected