Takes no parameters, returns True if an event posted (11/04/11 jec)
Local ReturnVal = False, CurrentFireButtonState, CurrentAbortButtonState Set CurrentFireButtonState to state read from port pin If the CurrentFireButtonState is different from the LastFireButtonState Set ReturnVal = True If the CurrentFireButtonState is down PostEvent FireButtonDown to FireButton queue Else PostEvent FireButtonUp to FireButton queue Endif Endif Set LastFireButtonState to the CurrentFireButtonState Set CurrentAbortButtonState to state read from port pin If the CurrentAbortButtonState is different from the LastAbortButtonState Set ReturnVal = True If the CurrentAbortButtonState is down PostEvent AbortButtonDown to FireButton queue Else PostEvent AbortButtonUp to FireButton queue Endif Endif Set LastAbortButtonState to the CurrentAbortButtonState Return ReturnVal End of CheckFireButtonEvents CheckIRSensorEvents Takes no parameters, returns True if an event posted (11/04/11 jec) Local ReturnVal = False, CurrentTarget1State, CurrentTarget2State, CurrentTarget3State, LastTarget1State, LastTarget2State,LastTarget3State Static Target1Destroyed = False, Target2Destroyed = False, Target3Destroyed = False Set CurrentTarget1State to read from port pin Set CurrentTarget2State to read from port pin Set CurrentTarget2State to read from port pin If CurrentTarget1State is different from the last state set ReturnVal to True If Target1IR sensor is HI (i.e. the laser shark is pointed at it) Post LaserOnDetector event with .EventParam 1 to DDM_SM Else Post LaserOffDetector event with .EventParam 1to DDM_SM Endif Endif Set LastTarget1State to CurrentTarget1State If CurrentTarget2State is different from the last state set ReturnVal to True If Target2IR sensor is HI (i.e. the laser shark is pointed at it) Post LaserOnDetector event with .EventParam 2 to DDM_SM Else Post LaserOffDetector event with .EventParam 2 to DDM_SM Endif Endif Set LastTarget2State to CurrentTarget2State
If CurrentTarget3State is different from the last state
set ReturnVal to True If Target3IR sensor is HI (i.e. the laser shark is pointed at it) Post LaserOnDetector event with .EventParam 3 to DDM_SM Else Post LaserOffDetector event with .EventParam 3 to DDM_SM Endif Endif Set LastTarget3State to CurrentTarget3State End CheckIRSensorEvents