I have the following code in the screen script that i want to add to the module i'm writing.
This way all my custom functions are in one place.
So if i have ever to do a rebuild of mach 4 all i have to do is to call the functions in the buttons wanted.
For some reason i can't get the following 2 functions working:
Goto Zero (adapted screen script to module)
function GoToWorkZero() -- Screen script code
local inst = mc.mcGetInstance("GoToWorkZero()")
local val = mc.mcCntlGetPoundVar(inst, mc.SV_MOD_GROUP_3)
local msg = "G0 G53 Z-20 A-20\n G90 X0 Y0\nG" .. val
mc.mcCntlMdiExecute(inst, msg)
end
---------------Goto Work Zero module button -----------------------------------------------------------------
function zControl.GoToZero()
local val = mc.mcCntlGetPoundVar(inst, mc.SV_MOD_GROUP_3)
local msg = "G0 G53 Z-20 A-20\n G90 X0 Y0\nG" .. val
mc.mcCntlGcodeExecute(inst, msg)
mc.mcCntlSetLastError(inst, "GoTO Work Zero")
end
Park position (works directly in a button)
---------------Park position button-----------------------------------------------------------------------
function zControl.Park()
mc.mcCntlSetLastError(inst, "GoTo park position")
mc.mcCntlGcodeExecute(inst, "G00 G53 Z-20 A-20\n G53 X3100 Y1200")
end
Keep Safe!
Adam