Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: KMX on October 19, 2016, 04:53:11 PM

Title: Mach4 freezes while executing mcCntlGcodeExecuteWait
Post by: KMX on October 19, 2016, 04:53:11 PM
Hello!

I am trying to do tool length probing button script, but have some problems with mcCntlGcodeExecuteWait function. The function executes, but in the mean time Mach4 freezes and position DROs are not updating.

How to solve it?

Regards, Denis
Title: Re: Mach4 freezes while executing mcCntlGcodeExecuteWait
Post by: DazTheGas on October 19, 2016, 05:18:03 PM
Post the code to check, but does sound like you have an infinite  loop somewhere

DazTheGas
Title: Re: Mach4 freezes while executing mcCntlGcodeExecuteWait
Post by: KMX on October 20, 2016, 01:48:06 AM
Hello!

This is the code (very simple):

Code: [Select]
--Measure
inst = mc.mcGetInstance()
local rc

function GCodeExecute(GCode)
    local rc = mc.mcCntlGcodeExecuteWait(inst, GCode)
    if rc ~= mc.MERROR_NOERROR then
        return 'Error', false
    else
        return 'OK', true
    end
end


local a, b
a, b = GCodeExecute('G0 G53 Z0 X-200 Y-300')  
  
if b == true then
    mc.mcCntlSetLastError(inst, 'test move.')
else
    mc.mcCntlSetLastError(inst, a)
end  

At this time I'm using simulation device for motion tests. The code is executed on button "LeftUp"  event.

Denis
Title: Re: Mach4 freezes while executing mcCntlGcodeExecuteWait
Post by: KMX on October 20, 2016, 03:34:02 AM
I have just tried to do it as Macro script and there is no problem with freezing...

Denis
Title: Re: Mach4 freezes while executing mcCntlGcodeExecuteWait
Post by: GerdS on November 05, 2016, 08:23:21 AM
Hello Denis,
i also had this problems. It looks like there is a problem ore a new behavior of the mcCntlGcodeExecuteWait() function.
Try to use mcCntlGcodeExecute() instead of mcCntlGcodeExecuteWait() when ever possible.
I used the whole day yesterday  to debug an fix most of problems after update to newest mach4 version.
Now it works so far.