Hi,
I think that there is some issue about putting a homing command in a macro in mach4. I'm still trying to figure out what that's all about.
The problem with putting a homing command in a macro is that a macro is run by the interpreter whereas the homing command is initiated by the GUI.
There are two Lua chunks that make up Mach. One chunk is contains the Gcode interpreter. If you run a Gcode job it is this chunk of Lua code that does the business
which includes running macros. The common macros in Gcode files are M01, M02,M03,M06 etc. If you write your own macro it might be M120 say, and the Gcode interpreter
would open and run that macro.
The GUI is the other chunk and it is responsible for the screen and all its functions like Homing buttons. Homing functions are initiated from the GUI and passed to the motion
controller. The controller reports back to the calling function in the GUI.
These two chunks of Lua code cannot run at the same time.
When Mach is running control passes back and forth between these two chunks. The mechanisms for doing it are vital to Mach and determine a lot of its 'character'.
A good deal of Mach programming involves having both Lua chunks running their own bits of code and they have to combine to do the job that you want and constitutes
perhaps the biggest challenge in successfully programming complex behavior in Mach.
The simple expedient is 'Have the GUI do GUI things and have the Gcode Interpreter do Gcode Interpreter things', trying to combine them or worse have then swap
roles is likely to be very difficult if not impossible.
Craig