
Load "Theremino_SignalScope.exe"
Load "Theremino_Hal.exe"
Load "Theremino_SewScope.exe"

Button 2 Text AbortSewing

Variable Numeric SlotX = 1
Variable Numeric SlotY = 3
Variable Numeric SlotZ = 5
Variable Numeric StopAngle = 90
Variable Numeric StartAngle = 270

Variable Numeric Xmax = 900
Variable Numeric Xmin = 0
Variable Numeric Ymax = 900
Variable Numeric Ymin = 0
Variable Numeric MaxPerSec = 20

SewInit SlotX SlotY SlotZ StopAngle StartAngle

SewLimits Xmin Xmax Ymin Ymax MaxPerSec

' ===========================================================

Slot 8 = 1000
Wait Seconds 0.1
Slot 8 = 0
Slot 9 = 1000
Slot(SlotZ) = 0

'SewTo 1 1 500 0 ""
'Gosub WaitSewProgress

v1 = ElapsedTime

'SewTo 101 81 20 5 "zigzag=2"
'Gosub WaitSewProgress

SewTo 30 45 100 0 ""
Gosub WaitSewProgress


SewTo 30 30 20 6 "Radius=15.92"' zigzag=2"
Gosub WaitSewProgress

v2 = ElapsedTime


SewTo 1 1 500 0 ""
Gosub WaitSewProgress

Print Format(v2 - v1, "0.000") + " sec."

Slot 9 = 0
Stop


Label AbortSewing
	SewAbort
Stop

Label WaitSewProgress
	Variable Numeric wsp1
	For wsp1 = 1 To Infinity
		If SewProgress < 0
			wsp1 = SewProgress
			Exit
		EndIf
		Print Int(Abs(SewProgress) * 100) + "%"
		'Print Mod(Slot(Slot_MotorZ),1)
	Next
Return


'WATCH SewTo_Speed
'EXEC Button 5 Text Button5
