Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: Ya-Nvr-No on May 03, 2014, 02:58:32 PM

Title: Mach4 Keyboard Emulation
Post by: Ya-Nvr-No on May 03, 2014, 02:58:32 PM
Was asked about Keyboard emulation setup.

Thought Id show everyone how to setup and use the Keyboard as inputs.

Disable Mach4 first
Menu -- Configure Plugins
Make sure it is Enabled
Press Configure button
Press Add Button
Highlight each box from left to right
Input a New InputName
Press the Key you want to use
Shift Alt & Ctrl key options will have to be hit twice to set
when done mach4 will have to be restarted to save the these new settings

Menu -- Configure Mach
Input Signals Tab
Enable Input
Select Device from a pull down list
Select Input Name you created in the Keyboard Plugin from its pull down list
Set Input Active High or Low

that's about all there is to it.


Title: Re: Mach4 Keyboard Emulation
Post by: Brian Barker on May 03, 2014, 03:07:39 PM
Nice job! you are the first one that has figured out the keyboard inputs can be used for anything!

Thanks
Brian
Title: Re: Mach4 Keyboard Emulation
Post by: Fastest1 on May 03, 2014, 04:34:52 PM
Fantastic! I have been wondering how this was done. Except there isnt the plugin you have?
Title: Re: Mach4 Keyboard Emulation
Post by: BR549 on May 03, 2014, 04:48:54 PM
Craig Here is an example of an early plasma screen with teh Row of function buttons on teh right. The working screen had a row of 24 Function buttons F1-F24 they controlled all teh MAIN CNC functions from teh Fkeys.

WOrks VERY well on a control panel with NO MOUSE. It does have a thumb stick but that is clumsy as well but better than a mouse(;-).

Title: Re: Mach4 Keyboard Emulation
Post by: BR549 on May 03, 2014, 04:53:50 PM



HIYA" Fastest1" press the disable button at the lower left of your screen THEN the Mach plugin config is accessable. That got me as well untill Steve explained it.

(;-)TP

Title: Re: Mach4 Keyboard Emulation
Post by: BR549 on May 03, 2014, 05:15:42 PM
OK I have several buttons on teh screen now that control functions like Load gcode edit gcode and cycle start.  They are labeled F1 F2 F3 AND they do work when selected with a mouse

HOW do I link them to a Hotkey {Fkey}.  so that when I press {F1} it does what the F1 button on the screen controls .

(;-) TP
Title: Re: Mach4 Keyboard Emulation
Post by: BR549 on May 03, 2014, 05:18:55 PM
Sorry Fastest1 that was for the WRONG config.

(;-) TP
Title: Re: Mach4 Keyboard Emulation
Post by: Fastest1 on May 03, 2014, 07:14:59 PM
TP, The plugins I have are different than those shown. I do have an earlier version of M4 I am tinkering with. The downloadable M4Hobby has the plugins. Oddly enough I was able to drag them from M4 Hobby to my older M4 on 1 PC and it worked fine. However the machine with an M4 copy wont accept those plugins in the folder. It actually accepts them fine, they just dont show up in the config plugins window.
Title: Re: Mach4 Keyboard Emulation
Post by: Overloaded on May 03, 2014, 08:17:54 PM
Hey Craig,
Enabled as you instructed.
Keyboard jogging works but notice now slight pauses during long jogs that I did not notice earlier.
So, I disabled the plugin thinking the jitter would go away, restarted M4 and kybd STILL jogs. And still jitters.
Double checked and there is a red X in the enable box. Weird.

Also, kybd jog does not respond to the Jog STEP inc., like the screen button does. Continuous only from kybd.

Keyboard Jog Off button does nothing.

Will try to empty the key assignments to see if that disables the plugin.

And, with it enabled, and M4 open, the up/dn arrows will do nothing on any other open pages of other programs/files OR scroll through the gcode file when cursor is put in the gcode window.
Looks like focus is fixed to jog only ... or something.

Care to verify ?

Thanks for the info,
Russ
Title: Re: Mach4 Keyboard Emulation
Post by: BR549 on May 03, 2014, 08:37:11 PM
Just off teh top of the head but would not setting up screen button to  HotKeys be better done from the screen editor. It sure worked well for Mach3. and very easy to do.

UNLESS someone can explain how to do it in MACH4.

(;-) TP
Title: Re: Mach4 Keyboard Emulation
Post by: Ya-Nvr-No on May 03, 2014, 08:38:30 PM
Your correct Russ I started having all kind of issues.
I took out the keyboard emulation keys.

Guess they have some more work to fix that problem.
They do work, just nothing else works with them.

The 8 jog arrow keys worked fine for me till I added the last three features, then had to remove them (just the last three).
Title: Re: Mach4 Keyboard Emulation
Post by: Overloaded on May 03, 2014, 08:39:57 PM
One other notice.

left and right arrows are already assigned to toggle through the TAB groups.

ANY key assigned in the plugin won't work Anywhere else while M4 is running, even in the background.

Tried to empty the plugin assignments, got all empty EXCEPT for the KEY box. It goes RED then takes whatever key you hit (as intended) but can't leave it empty.  OH ... just figured how to clear all.
Double click the Input Name box, right click and delete. Nothing will disappear but do this to ALL Input Name boxes, close that window and reopen and they will all go away except for the original line....with all entries empty.

Weird.
Thanks !
Russ

Title: Re: Mach4 Keyboard Emulation
Post by: Overloaded on May 03, 2014, 08:43:22 PM
Just off teh top of the head but would not setting up screen button to  HotKeys be better done from the screen editor. It sure worked well for Mach3. and very easy to do.

UNLESS someone can explain how to do it in MACH4.

(;-) TP

HI TP,
I never checked the button much, was just banging on it while fighting the kybd jog issue ... and seen that it didn't help.
But I'll bet you are spot on ... again !
Thanks,
Russ :)
Title: Re: Mach4 Keyboard Emulation
Post by: Overloaded on May 03, 2014, 08:47:15 PM
I took out the keyboard emulation keys.

This stumped me for a bit, care to tell exactly how you did it ?

I probably abused it a bit unnecessarily, but it worked  ;D

Thanks,
Russ
Title: Re: Mach4 Keyboard Emulation
Post by: Ya-Nvr-No on May 03, 2014, 08:55:02 PM
Removed both the "mach4 inputs enabled for the three" and then "deleted the three names in the Mach4 keyboard config", seems to be working again for me.

Mine starting crashing everytime I tried to use the spindle start button, but would work running a gcode program.
Title: Re: Mach4 Keyboard Emulation
Post by: Overloaded on May 04, 2014, 01:38:30 PM
UP/DN arrows are still locked to M4 Hobby and work NO where else as long as M4 is running.
Not like this in earlier dwnlds and pretty sure it was not like this before enabling, then disabling "Kybd Jog" plugin as they work in the earlier releases.
Something is stuck.

Might try to un- and re-install Hobby to see if it clears up.

Title: Re: Mach4 Keyboard Emulation
Post by: Overloaded on May 04, 2014, 01:41:29 PM
Pg UP and DN as well as lt and rt arrows are now the same way.
Seems every key i assigned in the plugin are useless elsewhere as long as M4 is running.
Although deleted and disabled, the plugin and M4 STILL have a grip.
How to clear ?

Thanks,
Russ
Title: Re: Mach4 Keyboard Emulation
Post by: Overloaded on May 04, 2014, 02:10:37 PM

Something is stuck.

Might try to un- and re-install Hobby to see if it clears up.


Yup, that cleared it up. (Steve was right .. as usual . it ain't ready :) )
Thanks,
Russ
Title: Re: Mach4 Keyboard Emulation
Post by: Brian Barker on May 04, 2014, 09:30:34 PM
If you would like to disable the plugin for the keyboard you can also click on the icon in the task bar and it will no longer take the key presses. The keyboard plugin was designed to take all the keys that it was asked to use.. The idea is that your KB would become a Machine Tool input device when it was enabled.. When it is out of that mode you can use it like a normal keyboard without the machine trying to move if you type something.

Title: Re: Mach4 Keyboard Emulation
Post by: Overloaded on May 04, 2014, 09:37:32 PM
I did notice that little guy down there in the corner, but never thought to click on it.
Anxious to try it out next time.

Still curious why disabling the plugin and deleting all key entries STILL left M4 in control of the keys.

Only thing that cleared it up was the reload.

Thanks,
Russ
Title: Re: Mach4 Keyboard Emulation
Post by: Ya-Nvr-No on May 09, 2014, 11:11:01 AM
Update: notice under the Diagnostic menu there is a Keyboard inputs option, lets you test your keys.

Title: Re: Mach4 Keyboard Emulation
Post by: awander on August 02, 2015, 01:11:39 AM
Is there a way to have the keyboard plugin automatically disabled when the focus is not in the Mach4 window, and re-enabled when the focus goes back to Mach4 window?
Title: Re: Mach4 Keyboard Emulation
Post by: cncman172 on October 01, 2015, 09:51:42 AM
I tried this in the latest release of MACH4, version 4.2.0.2703 and you can do as you suggest go into Configure Keyboard Plugin and assign the arrow keys and page up and page down keys for the jogging of axis movement.  Then exit and close MACH4, so you can restart.  But, when you come back in it never saves the assignments, they are always gone.  I do see the keyboard icon at the task bar at the bottom and you can click it and the X turns red when the keyboard is disabled but regardless the keyboard can't be used for jogging.  The diagnostic screen for keyboard shows no assignments as well.  I thought maybe the Pokeys plugin was causing this issue and I disabled that plugin which is also having various problems.

Does this still work for you in the latest release?  Very Strange the basic included keyboard plugin does not work correctly?  Also they still do not have the enable keyboard button enabled on the jog tab, that does nothing.

Thanks
Russ
Title: Re: Mach4 Keyboard Emulation
Post by: marktaft on October 07, 2015, 07:14:04 AM
Have just studied all the posting and wish to make my own pendant.

I like the idea of using the electronics from an old usb  pc keyboard, putting them in a box with a switch pad of my own design.

However , I am being a thick ?

 Can mach4 and windows support more then one keyboard at the same time ?


Title: Re: Mach4 Keyboard Emulation
Post by: DazTheGas on October 07, 2015, 02:27:55 PM
yes they can, on the second that u want to use as a pendant you can configure your keys such as shft alt cntrl plus another key, you wouldnt normaly use this combination in everyday life so shouldnt interfere with anything else.

DazTheGas
Title: Re: Mach4 Keyboard Emulation
Post by: TDAY on September 06, 2016, 02:31:45 PM
So how do you add another function to the Key Board Plugin. All i see is Jogging functions. Would like to add a keyboard key for CycleStart and Cycle Stop.
Troy
Title: Re: Mach4 Keyboard Emulation
Post by: DazTheGas on September 06, 2016, 02:48:40 PM
Have a look in the video subforum at quicky #2 although for feedhold you should get the gist.

DazTheGas
Title: Re: Mach4 Keyboard Emulation
Post by: TDAY on September 06, 2016, 07:08:52 PM
Awesome tutorial. One step i was missing was the restart of Mach4.
I got your example working for feed hold, but where do i find the command for CycleStart? Is there a list of these somewhere like Mach3s list of OEM codes?

Thanks,
Troy
Title: Re: Mach4 Keyboard Emulation
Post by: dude1 on September 06, 2016, 08:28:07 PM
mc.mcCntlCycleStart(inst) have a look at the scripting manual and the mach4 core api
Title: Re: Mach4 Keyboard Emulation
Post by: TommyG on September 07, 2016, 08:46:55 AM
Is there a way to have the keyboard plugin automatically disabled when the focus is not in the Mach4 window, and re-enabled when the focus goes back to Mach4 window?
+1 for this
Title: Re: Mach4 Keyboard Emulation
Post by: TDAY on September 07, 2016, 12:29:54 PM
Is there a way to have the keyboard plugin automatically disabled when the focus is not in the Mach4 window, and re-enabled when the focus goes back to Mach4 window?
+1 for this

Same here.

Or at least when you open the Gcode editor. Anyone know if this is possible?
Title: Re: Mach4 Keyboard Emulation
Post by: peu on September 13, 2016, 09:34:36 AM
+1 about freeing the keyboard when mach4 is not in focus.

Also, how do I map the ESCAPE key as STOP like it was configured in mach3?


Pablo
Title: Re: Mach4 Keyboard Emulation
Post by: DazTheGas on September 13, 2016, 09:50:31 AM
It is possible from a plugin to do this, however this can only be done by disabling the keyboard plugin when mach4 loses focus, if the keyboard was enabled when in focus you will not be able to use the mdi panel as the windows event for onFocus will keep enabling the plugin.

Have a look at the function for enable/disable in the startup script, this can be adapted and used within the tabs when choosing between GCode and Mdi screens.

DazTheGas
Title: Re: Mach4 Keyboard Emulation
Post by: TommyG on September 13, 2016, 09:58:18 AM
It is possible from a plugin to do this, however this can only be done by disabling the keyboard plugin when mach4 loses focus, if the keyboard was enabled when in focus you will not be able to use the mdi panel as the windows event for onFocus will keep enabling the plugin.

Have a look at the function for enable/disable in the startup script, this can be adapted and used within the tabs when choosing between GCode and Mdi screens.

DazTheGas
Daz

I've experimented with this and it doesn't seem to work for me. Is this something you have working on your own setup?

Also, is there some sort of WindowLostFocus() type event that you can tie a script to in order to achieve this?

tommy
Title: Re: Mach4 Keyboard Emulation
Post by: DazTheGas on September 13, 2016, 01:40:01 PM
Perhaps this quicky will help.

http://www.machsupport.com/forum/index.php/topic,33270

DazTheGas