' ----------------------------------------------
'  Commands to Theremino_CNC
' ----------------------------------------------

Button 1 Label CmdRun
Button 2 Label CmdStep
Button 3 Label CmdPause
Button 4 Label CmdRewind
Button 5 Label CmdStop

Button 7 Label Rapid500
Button 8 Label Rapid2000
Button 9 Label Feed100
Button 10 Label Feed1000
Button 11 Label Speed0
Button 12 Label Speed20000

Button 17 Label TestLowZ
Button 18 Label GotoZero
Button 19 Label GotoHome
Button 20 Label GotoBottomLeft
Button 21 Label GotoTopRight

Button 23 Label SetZetaHome
Button 24 Label CalibrateXY
Button 25 Label CalibrateZ
Button 26 Label CalibrateAB

Button 28 Label MoveTo_10_20_30
Button 29 Label MoveTo_20_30_10

Button 33 Label ZeroX
Button 34 Label ZeroY
Button 35 Label ZeroZ
Button 36 Label ZeroA
Button 37 Label ZeroB

Button 39 Label GotoLine5
Button 40 Label GotoLine50
Button 41 Label GotoLine9999

Button 43 Label LoadMaster
Button 44 Label LoadPmtAdapter

Button 46 Label ErrorTest

Variable Numeric Slot_CommandsToCnc = 1
Variable Numeric Slot_Status = 2
Loop
Stop

Label Loop
	Print SlotText(Slot_Status)
Goto Loop

' =============================================================
'  SEND COMMAND (default timeout = 0.5 Sec)
' =============================================================
Label SendCommand
	Variable Numeric SC1       '<-- Parameter Destinat.-Slot
	Variable String  SC2       '<-- Parameter Command-String
	Variable Numeric SC3 = 0.5 '<-- The timeout in seconds
	Variable Numeric SC4
	SlotText SC1 = SC2
	For SC4 = 0.1 To SC3 Step 0.1
		If SlotText(SC1) = ""
			Exit
		EndIf
		Wait Seconds 0.1
	Next
Return

Label CmdRun
	SendCommand(Slot_CommandsToCnc)("CmdRun")
Return
Label CmdStep
	SendCommand(Slot_CommandsToCnc)("CmdStep")
Return
Label CmdPause
	SendCommand(Slot_CommandsToCnc)("CmdPause")
Return
Label CmdRewind
	SendCommand(Slot_CommandsToCnc)("CmdRewind")
Return
Label CmdStop
	SendCommand(Slot_CommandsToCnc)("CmdStop")
Return

Label Rapid500
	SendCommand(Slot_CommandsToCnc)("Rapid 500")
Return
Label Rapid2000
	SendCommand(Slot_CommandsToCnc)("Rapid 2000")
Return
Label Feed100
	SendCommand(Slot_CommandsToCnc)("Feed 100")
Return
Label Feed1000
	SendCommand(Slot_CommandsToCnc)("Feed 1000")
Return
Label Speed0
	SendCommand(Slot_CommandsToCnc)("Speed 0")
Return
Label Speed20000
	SendCommand(Slot_CommandsToCnc)("Speed 20000")
Return

Label TestLowZ
	SendCommand(Slot_CommandsToCnc)("TestLowZ")
Return
Label GotoZero
	SendCommand(Slot_CommandsToCnc)("GotoZero")
Return
Label GotoHome
	SendCommand(Slot_CommandsToCnc)("GotoHome")
Return
Label GotoBottomLeft
	SendCommand(Slot_CommandsToCnc)("GotoBottomLeft")
Return
Label GotoTopRight
	SendCommand(Slot_CommandsToCnc)("GotoTopRight")
Return

Label SetZetaHome
	SendCommand(Slot_CommandsToCnc)("SetZetaHome")
Return
Label CalibrateXY
	SendCommand(Slot_CommandsToCnc)("CalibrateXY")
Return
Label CalibrateZ
	SendCommand(Slot_CommandsToCnc)("CalibrateZ")
Return
Label CalibrateAB
	SendCommand(Slot_CommandsToCnc)("CalibrateAB")
Return

Label MoveTo_10_20_30
	SendCommand(Slot_CommandsToCnc)("MoveTo 10 20 30")
Return
Label MoveTo_20_30_10
	SendCommand(Slot_CommandsToCnc)("MoveTo 20 30 10")
Return

Label ZeroX
	SendCommand(Slot_CommandsToCnc)("ZeroX")
Return
Label ZeroY
	SendCommand(Slot_CommandsToCnc)("ZeroY")
Return
Label ZeroZ
	SendCommand(Slot_CommandsToCnc)("ZeroZ")
Return
Label ZeroA
	SendCommand(Slot_CommandsToCnc)("ZeroA")
Return
Label ZeroB
	SendCommand(Slot_CommandsToCnc)("ZeroB")
Return

Label GotoLine5
	SendCommand(Slot_CommandsToCnc)("GotoLine 5")
Return
Label GotoLine50
	SendCommand(Slot_CommandsToCnc)("GotoLine 50")
Return
Label GotoLine9999
	SendCommand(Slot_CommandsToCnc)("GotoLine 9999")
Return

Label LoadMaster
	SendCommand(Slot_CommandsToCnc)("LoadGcode PCB Large\MasterDIL-V3.gc")
Return
Label LoadPmtAdapter
	SendCommand(Slot_CommandsToCnc)("LoadGcode PCB Large\PmtAdapter.gc")
Return

Label ErrorTest
	SendCommand(Slot_CommandsToCnc)("Error Test")
Return


'WATCH SewTo_Speed
'EXEC Button 5 Text Button5
