81
Mach4 General Discussion / Re: Button script
« on: August 07, 2019, 06:15:10 PM »
If it can all be done in Gcode do it all as one string of gcode and do not use wait. It will be executed in order.
If you have to use api calls you might want to consider using a coroutine. See the ref all home button, function in screen load script and PLC of wx6.set.
I would get rid of those sleeps too. Rule of thumb is if you have to use sleep you need to rethink your code.
Maybe you can do it all in a macro (say 127). Then when you want it to run from a button the buttons clicked script looks something like this.
local inst = mc.mcGetInstance()
mc.mcCntlMdiExecute(inst, "M127")
If you have to use api calls you might want to consider using a coroutine. See the ref all home button, function in screen load script and PLC of wx6.set.
I would get rid of those sleeps too. Rule of thumb is if you have to use sleep you need to rethink your code.
Maybe you can do it all in a macro (say 127). Then when you want it to run from a button the buttons clicked script looks something like this.
local inst = mc.mcGetInstance()
mc.mcCntlMdiExecute(inst, "M127")