Brian
i do something like this and then i can run g31 over and over and works
without cntlenable i have to hit the mach4 enable button to run g31 a second time, or i won't get any axis movement
but i am not having any real problems with the scripts setup like this its the ESS register i am reading for errors
rc = mc.mcCntlGcodeExecuteWait(inst, "G91 G31 Z-"..ZMaxTravel.." F"..SlowFeed) -- start the z probe if not hit Show not hit and exit
if mc.mcRegGetValue(hreg) == ProbeState then -- check the probe state if ProbeState error probe not hit
mc.mcCntlSetLastError(inst, "No Probe Hit Aborting try a higher ZMaxTravel, or make sure you are over the part") -- send messsage error
mc.mcCntlEnable(inst, 1)
return false -- now exit and abort
end
-- probe was hit
Gary