Some of our customers met the problem of configuring keys for execution of the frequently used functions (e.g. Feed and Spindle speed override). There is difference between MACH 3 and MACH 4 to do this. In MACH 3 you can change shortcut in the screenset editor but in MACH 4 it will not work.
Here we describe some simple steps for configuration of the keyboard's keys.
STEP 1
Select menu item
Add desired keys
STEP 2
Restart MACH 4! It's important.
Select menu item
Bind keys to free Inputs
STEP 3
Select menu item
STEP 4
Click positions in order
Add this code for Feedrate Override to SigLib section
____________________
[mc.ISIG_INPUT62] = function (state)
if (state == 1) then --
local inst = mc.mcGetInstance()
FROPlus()
end
end,
[mc.ISIG_INPUT63] = function (state)
if (state == 1) then --
local inst = mc.mcGetInstance()
FROMinus()
end
end,
_______________________________
STEP 5
And this code just after SigLib section
_____________________________________
--FRO is read from 0 - 250
--FRO + 10%
function FROPlus()
local inst = mc.mcGetInstance()
local FRO = mc.mcCntlGetFRO(inst)
if FRO == 250 then
mc.mcCntlSetLastError(inst, "Can't increase FRO anymore.")
else
local NewFRO = (FRO + 10)
mc.mcCntlSetFRO(inst, NewFRO)
end
end
--FRO is read from 0 - 250
--FRO - 10%
function FROMinus()
local inst = mc.mcGetInstance()
local FRO = mc.mcCntlGetFRO(inst)
if FRO == 0 then
mc.mcCntlSetLastError(inst, "Can't decrease FRO anymore.")
else
local NewFRO = (FRO - 10)
mc.mcCntlSetFRO(inst, NewFRO)
end
end
____________________
Please note, that we bind Feedrate+ and Feedrate- keys to Input #62 and Input #63
STEP 6
Add this code to SigLib section for Spindle speed override
[mc.ISIG_INPUT60] = function (state)
if (state == 1) then --
local inst = mc.mcGetInstance()
SROPlus()
end
end,
[mc.ISIG_INPUT61] = function (state)
if (state == 1) then --
local inst = mc.mcGetInstance()
SROMinus()
end
end,
STEP 7
And this code after SigLib section
STEP 8
For correct operation don’t forget to switch on this feature.
That's all.
P.S. Thanks to Cbyrdtopper for help in this issue
All configurations were made for our waterproof keyboard (see link below) but they are actual for any keyboard as well.
Waterproof custom keyboards for MACH 3 / MACH 4 CNC
- Fully compatible with MACH 3 / MACH 4
- Waterproof
- Feed and Spindle Speed override encoders
- Programmable key combinations
- Custom labels and keys arrangement