this is what I have ended up with so far what's commented out is because it crashes M4
-laser zero
local inst = mc.mcGetInstance();
mc.mcCntlGcodeExecute(inst, "G1 X10 Y10 F500");--run some g-code
wx.wxMilliSleep(18); --it need to be set to this
mcState = mc.mcCntlGetState(inst);
--while (mcState ~= mc.MC_STATE_IDLE) do
--mcState = mc.mcCntlGetState(inst);
--wx.wxMilliSleep(30);
--end
mc.mcAxisSetPos(inst, 0, 0.000)
mc.mcAxisSetPos(inst, 1, 0.000)
--wx.wxMilliSleep (20)
so it looks like this so far to get it to work I have to home all first
-laser zero
local inst = mc.mcGetInstance();
mc.mcCntlGcodeExecute(inst, "G1 X10 Y10 F500");--run some g-code
wx.wxMilliSleep(18);--it needed to be set to this
mcState = mc.mcCntlGetState(inst);
mc.mcAxisSetPos(inst, 0, 0.000)
mc.mcAxisSetPos(inst, 1, 0.000)