Hi,
yes it will be necessary to write a new m5 macro and put it in the macros folder of your profile.
When the Gcode interpreter encounters a macro call like m5() it starts searching for it, first in your macros folder.
If it finds it then Mach will execute the code in it. If it does not find it, it searches in higher folders of the search tree
until it finds Machs built in m5().
If you wish to write your own m5() you will need to include all the functionality of the built in m5() plus whatever
functionality you want.
The trick is trying to discover what the 'original' code is and THEN add to it.
This is the code from the m3/m5 button on the screen and is found in the screen load script:
[---------------------------------------------------------------
-- 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
end
/code]
The spindle is stopped when this instruction is executed:
mc.mcSpindleSetDirection(inst, 0), pretty simple.
You could make your own m5() by using that instruction plus whatever timer you want.
Craig