Posting in lunch break at work so hope I can get the problem described correctly.
Mach3 licensed, on a CNC Plasma cutter, I use a Macro M800.M1s and call this as part of Sheetcam output Gcode before every pierce.
On some occasions, when some piece of metal has decided to jam things up I can find that the head is raised and the probe is already active before I call G31, so I get a message to say Probe input ignored and Mach3 then for some reason starts to move the X, Y or Z erratically which means I then loose position and have to stop the cutter, sort out positions and recommence cutting.
So the idea I has was on my M800.m1s check to see if the probe was active before doing a G31, but I can not get it to work, so not sure where I am going wrong.
Here is my M800 code as it is now and how I thought I could get it to work, can someone point me to my errors?
' APH
Code "G31 Z-30.0 F300" 'probe surface
' Wait for movement to complete
While (IsMoving())
' Sleep, so other threads can run while we wait
Sleep(100)
Wend
ZprobePos = GetVar(2002) 'get contact point
Code "G0 Z" &ZprobePos 'return to point to remove overshoot
' Wait For movement To complete
While (IsMoving())
' Sleep, so other threads can run While we wait
Sleep(100)
Wend
Call SetOEMDRO(802, -1.80) 'Set Z DRO = 0.00
Code "G1 Z 3.0 F300"
' Wait for movement to complete
While (IsMoving())
' Sleep, so other threads can run while we wait
Sleep(100)
Wend
' End
and new attempt is
' APH
' Update 15/06/17
If GetOEMLED(825) = 1 Then ' The digitise LED is already on
Message " Probe input active"
Code "M1" ' Code out the M1 to stop the machine if set to allow
' Wait for movement to complete
While (IsMoving())
' Sleep, so other threads can run while we wait
WEND ' Wait end
ELSE
Code "G31 Z-30.0 F500" 'probe surface
' Wait for movement to complete
While (IsMoving())
' Sleep, so other threads can run while we wait
Sleep(100)
Wend
ZprobePos = GetVar(2002) 'get contact point
Code "G0 Z" &ZprobePos 'return to point to remove overshoot
' Wait For movement To complete
While (IsMoving())
' Sleep, so other threads can run While we wait
Sleep(100)
Wend
Call SetOEMDRO(802, -3.60) 'Set Z DRO = 0.00
Code "G1 Z 2.5 F500"
' Wait for movement to complete
While (IsMoving())
' Sleep, so other threads can run while we wait
Sleep(100)
Wend
' End
End if
Cheers
Adrian