Hello Guest it is November 27, 2021, 07:38:42 AM

Author Topic: Keyboard Inputs enabled right after Mach4 starts  (Read 333 times)

0 Members and 1 Guest are viewing this topic.

Keyboard Inputs enabled right after Mach4 starts
« on: March 14, 2021, 01:06:24 AM »
Please forgive my rookie question, since I am new in Mach4.
When I start Mach4, button Keyboard Inputs in Jogging tab is disabled by default (so when I enable drives, screen does obviously something else while pressing arrow keys and Page Up/Down buttons :D )
Please, how to make Keyboard Inputs button enabled right after Mach4 starts?
Thank you!
Re: Keyboard Inputs enabled right after Mach4 starts
« Reply #1 on: March 14, 2021, 02:55:35 PM »
No opinions? Come on... Don't tell me that it's not possible to set a default value for a variable in Mach4...

Offline thosj

*
  •  455 455
    • View Profile
Re: Keyboard Inputs enabled right after Mach4 starts
« Reply #2 on: March 14, 2021, 04:20:47 PM »
Opinions? My opinion is YOU can do it. Might start in the screen editor and see what's in the button that turns on keyboard jogging and duplicate it somehow in the Screen Start Script.
Re: Keyboard Inputs enabled right after Mach4 starts
« Reply #3 on: March 15, 2021, 01:21:15 AM »
Bet that I am pretty sure that I am the one who can do it. But I'd kindly ask at least for an representative example, either in Mach4 documentation or in an YouTube video. Frankly, I am Mach4 lama and I need a start somehow. (nobody was born with detailed Mach4 knowledge)
Re: Keyboard Inputs enabled right after Mach4 starts
« Reply #4 on: March 15, 2021, 03:32:11 AM »
I had this issue. When I put the command in the screen load it wouldn't turn the keyboard inputs on. So, I created a 2 second delay to occur after the screen "loads".

Screen Load Script:
Code: [Select]
loadTimer = 2
waitForScreenLoad = true

PLC Script:
Code: [Select]
if os.clock() > loadTimer and waitForScreenLoad then
waitForScreenLoad = false

local keyboardEnableReg = mc.mcIoGetHandle (inst, "Keyboard/Enable")
mc.mcIoSetState(keyboardEnableReg, 1)
end

To edit the Screen Load and the PLC scripts refer to this video: https://youtu.be/fKGJ3cfiW8s
« Last Edit: March 15, 2021, 03:35:45 AM by compewter_numerical »