Have any of you run into problems when trying to call a custom M command through this method? I can get it to run regular gcode but the moment I put in say M10 (just activates an output signal) m4 locks up. I wonder if it is because of using a function within my new function..?
The code I am using looks like:
function m31() -- Load New Board
local state, rc = mc.mcSignalGetState(mc.mcSignalGetHandle(0, mc.ISIG_INPUT3)) -- obtain loader signal state
local inst = mc.mcGetInstance()
if (state == 1) -- Check States for Board Loader Signal
then
--mc.mcCntlMdiExecute(inst, 'M12') -- used for testing (works for a button), freezes upon use
mc.mcCntlGcodeExecute(inst, 'G00 X1700\nM10\nG00 X0\n') --goes to 1700, then freezes
else
-- do nothing
end
end
m31();
if (mc.mcInEditor() == 1) then
m31();
end
Any insight is greatly appreciated!