Machsupport Forum
Mach Discussion => Mach4 General Discussion => Topic started by: YaraAuto on October 03, 2018, 02:37:54 AM
-
Hi
I want to able to override feedrate and spindle speed with keyboard keys but key shorcuts which worked in Mach3 don't work in Mach4. Does anybody know how to fix it or maybe how to set certain keys for correction of feedrate and spindle?
-
Bryanna just put a video on youtube using keyboard signals.
https://www.youtube.com/watch?v=jTzYotLTJkY
-
Thanks, but it is about Probe signal which exitsts in standard list of functions, but there are no Feedrate override + or Feedrate override - functions. So I need to write some script to do it? Is there any simplier way? MACH3 has just keys shortcuts for each button on the screen. Does MACH 4 have the same feature?
-
You can set Keyboard Inputs as inputs in Mach4. Like the video, you can set the keyboard input to an Input# instead of the probe.
http://www.machsupport.com/forum/index.php/topic,38406.0.html
Here are functions to control FRO up and down.
Now, I would assume you should be able to call these from the signal script no problem; but for some reason on my laptop none of my signal scripts are working so I am unable to properly test this. But, you should be able to put this in your signal script and be able to do what you want, once you set up your keyboard inputs and map them to Input#s
I have this one mapped to Input5
Do the same for FRO Minus just put make another signal and put the function FROMinus() in it instead of plus.
[mc.ISIG_INPUT5] = function (state)
if (state == 1) then --
local inst = mc.mcGetInstance()
FROPlus()
mc.mcCntlGcodeExecute(inst, "G91G00X.25")
end
end,
Let me know if this works.
Someone else can chime in and suggest why my signal script isn't working on my laptop as well. Running Sim with hobby license.
I put these functions in the PLC script, if Inputs are fired then call these functions and it works. So I'm not really sure why the signal script isn't working for me.
Actually pretty cool putting this in the PLC Script. I have the (+) and (-) keys set up to FRO and when you hold them it keeps moving up or down.
Potentially dangerous if the keys get stuck, but pretty cool function.
-
Wow! It works! Thanks for that. When I finish I'll make a small manual how I made it.
The last problem with Spindle speed override.
function SROPlus()
local inst = mc.mcGetInstance()
local SRO = mc.mcCntlGetSRO(inst)
if SRO == 250 then
mc.mcCntlSetLastError(inst, "Can't increase SRO anymore.")
else
local NewSRO = (SRO + 10)
mc.mcCntlSetSRO(inst, NewSRO)
end
end
--SRO is read from 0 - 250
--SRO - 10%
function SROMinus()
local inst = mc.mcGetInstance()
local SRO = mc.mcCntlGetSRO(inst)
if SRO == 0 then
mc.mcCntlSetLastError(inst, "Can't decrease SRO anymore.")
else
local NewSRO = (SRO - 10)
mc.mcCntlSetSRO(inst, NewSRO)
end
end,
Very similar code doesn't work and sends error message ( in attachment )
When I write the name of mcCntlGetSRO function if script editor it even doesn't change its color to pink as it was with mcCntlGetFRO. ???
-
The Spindle Override will work the same way; only it reads differently.
local SSO = mc.mcSpindleGetOverride(inst)--Returns: 0.5 - 1.5
mc.mcSpindleSetOverride(inst, NewSRO)
Spindle Override doesn't read from 0-250 like the FRO it is 0.5 - 1.5 and it will increase and decrease by 0.1 increment.
50% is 0.5 and 150% is 1.5
-
Excellent! All works as it should be. Thanks.
-
Great! Glad you got it working!
-
I've made a short instruction about all configuration process. I hope it will help somebody.
https://www.yara-automation.com/keyboard-configuration-in-mach4/ (https://www.yara-automation.com/keyboard-configuration-in-mach4/)