Hi,
one possibility is to rewrite m3, m4 and m5.
Note the deliberate use of lowercase and without leading zeros. That's how the Gcode interpreter treats all Gcode,
mostly M03 still gets treated as m3 but occasionally it does not too! Real tricky fault to find.
As you know there an m3 already built in to Mach, you can't change it. When Mach encounters an m3 (or m4,m5....)
it in the first instance searches in the macro directory of the current profile. If it finds an m3 there that is what it
uses. If not it will search until it finds one. usually the built in m3.
Thus if you write your own m3 that is what will be executed. You need to include all the functionality of the built in m3
PLUS whatever extra fruity bits you want to include. The best place to see what happens within the existing m3 is to look at
the screen button script.
In the screen editor the function associated with the button is:
SpinCW()
--local inst = mc.mcGetInstance();
--local sigh = mc.mcSignalGetHandle(inst, mc.OSIG_SPINDLEON);
--local sigState = mc.mcSignalGetState(sigh);
--if (sigState == 1) then
-- mc.mcSpindleSetDirection(inst, 0);
--else
-- mc.mcSpindleSetDirection(inst, 1);
--end
The function is just SpinCW(), all the rest of the code is commented out, its just to give you a sample of
the code the function contains, it is not the function definition itself. The actual function
definition is in the screen load script, approximately line 140:
---------------------------------------------------------------
-- Spin CW function.
---------------------------------------------------------------
function SpinCW()
local sigh = mc.mcSignalGetHandle(inst, mc.OSIG_SPINDLEON);
local sigState = mc.mcSignalGetState(sigh);
if (sigState == 1) then
mc.mcSpindleSetDirection(inst, 0);
else
mc.mcSpindleSetDirection(inst, 1);
end
en
So to get your pump running you could modify this code or you could rewrite it including your instructions to get the
pump to run into your own m3() in the macros folder of our profile.
Craig