Hello Guest it is May 06, 2021, 08:07:03 PM

Author Topic: MACH4 feedrate and spindle override keys  (Read 900 times)

0 Members and 1 Guest are viewing this topic.

MACH4 feedrate and spindle override keys
« 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?
Re: MACH4 feedrate and spindle override keys
« Reply #1 on: October 03, 2018, 04:24:42 PM »
Bryanna just put a video on youtube using keyboard signals.

https://www.youtube.com/watch?v=jTzYotLTJkY
Chad Byrd
Re: MACH4 feedrate and spindle override keys
« Reply #2 on: October 03, 2018, 06:14:46 PM »
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?
Re: MACH4 feedrate and spindle override keys
« Reply #3 on: October 03, 2018, 09:14:49 PM »
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.
« Last Edit: October 03, 2018, 09:18:34 PM by Cbyrdtopper »
Chad Byrd
Re: MACH4 feedrate and spindle override keys
« Reply #4 on: October 04, 2018, 05:23:56 AM »
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.  ???
Re: MACH4 feedrate and spindle override keys
« Reply #5 on: October 04, 2018, 08:21:10 AM »
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
Chad Byrd
Re: MACH4 feedrate and spindle override keys
« Reply #6 on: October 05, 2018, 05:43:26 AM »
Excellent! All works as it should be. Thanks.
Re: MACH4 feedrate and spindle override keys
« Reply #7 on: October 05, 2018, 07:53:09 AM »
Great!   Glad you got it working!
Chad Byrd
Re: MACH4 feedrate and spindle override keys
« Reply #8 on: October 24, 2018, 06:51:56 AM »
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/