Question about keyboard for cnc build

More
5 years 7 months ago #202543 by robertspark
trying to find (and understand) the on-screen keyboard as I would have thought that they use keypress / keyup/ keydown combination with mouse down and up....

Please Log in or Create an account to join the conversation.

More
5 years 7 months ago #202544 by andypugh

robertspark wrote: thanks Andy, I can create the pins (all 112) no problem and change their status from true to false.


It probably makes sense to read a config file, which is a list of rows and columns, and create HAL pins or keystrokes accordingly.
Something like:
Code:
r1c1 pin coolant r1c2 pin run r1c3 key 44 r1c4 r1c5 ...
Which would create HAL pins called "coolant" and "run" and send a 44 key event (KEY_Z) for the third. And do nothing for the blanks.


I am looking for is simple means to input keypresses into the MDI.


I think that python-evdev looks like the best way:
python-evdev.readthedocs.io/en/latest/
This seems a close match to the way that my sendkeys component does it in C.
The keycodes are here: wiki.linuxcnc.org/cgi-bin/wiki.pl?Scancodes
The following user(s) said Thank You: robertspark

Please Log in or Create an account to join the conversation.

More
5 years 7 months ago #202545 by robertspark
thanks very much, off to study

Please Log in or Create an account to join the conversation.

More
5 years 7 months ago - 5 years 7 months ago #202546 by andypugh

andypugh wrote:

robertspark wrote: thanks Andy, I can create the pins (all 112) no problem and change their status from true to false.


It probably makes sense to read a config file, which is a list of rows and columns, and create HAL pins or keystrokes accordingly.
Something like:
Code:
r1c1 pin coolant r1c2 pin run r1c3 key 44 r1c4 r1c5 ...
Which would create HAL pins called "coolant" and "run" and send a 44 key event (KEY_Z) for the third. And do nothing for the blanks or for rows/columns omitted.
Parsing in Python can be done with regexes, to parse the above format:
Code:
import re ... [row, column, type, val] = re.split("r(\d*)c(\d*) (.*?) (.*)", "r1c2 pin hello")[1:5]


I find this web site invaluable for experimenting with regexes: regexr.com

I am looking for is simple means to input keypresses into the MDI.


I think that python-evdev looks like the best way:
python-evdev.readthedocs.io/en/latest/
This seems a close match to the way that my sendkeys component does it in C.
The keycodes are here: wiki.linuxcnc.org/cgi-bin/wiki.pl?Scancodes

Last edit: 5 years 7 months ago by andypugh.
The following user(s) said Thank You: robertspark

Please Log in or Create an account to join the conversation.

More
5 years 7 months ago #202552 by andypugh
Also look at PanelUI. That can also respond to key codes, and does a lot more too.

linuxcnc.org/docs/2.8/html/gui/panelui.html
The following user(s) said Thank You: robertspark

Please Log in or Create an account to join the conversation.

More
5 years 7 months ago #202663 by robertspark
thanks andy, penny has (finally) dropped..... sendkeys it is!

I see an easy way forward using pins in sendkeys

thank you very much

Please Log in or Create an account to join the conversation.

Time to create page: 0.347 seconds
Powered by Kunena Forum