|
|
18-09-2018, 03:11
|
#1
|
Registered User
Join Date: Jun 2017
Posts: 4
|
Making a custom keyboard for OpenCPN
I am working on a custom usb-keyboard for OpenCPN.
It is implemented as a HID input device using an Arduino Pro Micro (Leonardo).
At the moment I am just testing then concept, which is quite simple, as it "just" sends keypresses.
But I have one problem. I can't get the arrow-keys work for paning.
If I open a dialog, I can move the cursor, but I can't move the chart....
I have also tested sending keypresses from a VB-program, and it behaves the same way.
So I suspect those keys are handled special for paning....
Other keys, like zooming with PageUp/PageDown, with or without 'Alt', works as expected.
Does anyone have a thought about this?
-Leon
|
|
|
18-09-2018, 11:08
|
#2
|
Registered User
Join Date: Nov 2012
Location: Orust Sweden
Boat: Najad 34
Posts: 4,187
|
Re: Making a custom keyboard for OpenCPN
leon..
The left, right, up and down keys are handled as any other keys. Are you sure you're sending the correct key-codes?
Compare O-code for hotkeys: chcanv.cpp rows around 1380
|
|
|
18-09-2018, 15:39
|
#3
|
Registered User
Join Date: Jun 2017
Posts: 4
|
Re: Making a custom keyboard for OpenCPN
Thank you for the hint!
I thougt of keycodes, but since the arrow-keys worked in all other programs I tested, I didn't pay any attention to it. But it seems as the library is using the key-codes for the arrows on the numeric keypad.
To verify this I connected a fullsize USB-keyboard to my laptop, and this behaves the same way. Arrows on the numeric keypad works in all tested programs, but not in OpenCPN.
I will check the Arduino kyeborad labrary and see if I can modify it.
-Leon
|
|
|
18-09-2018, 22:39
|
#4
|
Registered User
Join Date: Nov 2012
Location: Orust Sweden
Boat: Najad 34
Posts: 4,187
|
Re: Making a custom keyboard for OpenCPN
Leon..
Yes, correct! The only numeric pad key codes I can find prepared for in O are the "+" and "-" keys for zoom in and out.
|
|
|
19-09-2018, 12:11
|
#5
|
Registered User
Join Date: Mar 2013
Location: Santa Cruz
Boat: 1975 Isander 28
Posts: 132
|
Re: Making a custom keyboard for OpenCPN
I am glad you are doing this project. I am planning similar. Please post your source code when it is done. Have you thought about having a 'slow mode' when you send alt+arrow keys instead. Have it toggleable with an led ( like caps lock ). You can also do an HID mouse with the same buttons, even switch back and forth between keyboard and mouse on the fly ( my plans )...
|
|
|
19-09-2018, 22:44
|
#6
|
Registered User
Join Date: Feb 2012
Location: Austria
Posts: 320
|
Re: Making a custom keyboard for OpenCPN
A dedicated keyboard sounds like a good idea but does it have to be a physical device? How about a little app for android ( or even tolino ) with large enough buttons to cover the ocpn functions. Alternatively any programmable remote control may do.
How many keys do users need?
|
|
|
19-09-2018, 23:09
|
#7
|
Registered User
Join Date: Apr 2007
Location: Australia
Boat: Island Packet 40
Posts: 6,497
|
Re: Making a custom keyboard for OpenCPN
Use a mouse.
|
|
|
20-09-2018, 03:51
|
#8
|
Marine Service Provider
Join Date: May 2013
Location: Norway
Posts: 719
|
Re: Making a custom keyboard for OpenCPN
From my point of view: A dedicated physical operation keyboard/pad is the "MOST WANTED" feature - it's what makes the difference between extremely expensive professional plotters and opencpn. If a watertight dedicated keyboard was available, function able and of decent quality, I would purchase !!
Quote:
Originally Posted by skipperearly
A dedicated keyboard sounds like a good idea but does it have to be a physical device? How about a little app for android ( or even tolino ) with large enough buttons to cover the ocpn functions. Alternatively any programmable remote control may do.
How many keys do users need?
|
|
|
|
20-09-2018, 05:09
|
#9
|
Registered User
Join Date: Aug 2009
Location: oriental
Boat: crowther trimaran 33
Posts: 4,419
|
Re: Making a custom keyboard for OpenCPN
You could use an existing usb keyboard circuit board which is cheaper than arduino that has usb support.
In either case, unfortunately opencpn is somewhat difficult to use without a mouse.
How will the keyboard work when it is wet?
|
|
|
20-09-2018, 05:10
|
#10
|
Registered User
Join Date: May 2011
Location: underway whenever possible
Boat: Rangeboat 39
Posts: 4,767
|
Re: Making a custom keyboard for OpenCPN
Something like this?
https://www.raidsonic.de/products/in..._objectID=3047
Seen that at Amazon and other sites.
|
|
|
20-09-2018, 15:23
|
#11
|
Registered User
Join Date: Mar 2013
Location: Santa Cruz
Boat: 1975 Isander 28
Posts: 132
|
Re: Making a custom keyboard for OpenCPN
I am definitely doing this also. I am using an adafruit teensy or similar usb enabled uC. Forget the Arduino crap just write a simple C program and overwrite the boot loader.
With the arrow keys you can have a mode to turn it into a mouse where you hold the button and the mouse moves, or set it back to keypress mode. Also you want a 'alt+keypress' mode. You can encase the entire thing in epoxy. Powered by the usb cable. The switches are also doable waterproof...
|
|
|
21-09-2018, 08:43
|
#12
|
Registered User
Join Date: Aug 2009
Location: oriental
Boat: crowther trimaran 33
Posts: 4,419
|
Re: Making a custom keyboard for OpenCPN
I have been playing with capacitive touch. This you can do easily from arduino for buttons, but as well as sliders, and possibly even touchpad (2 axis)
I think this would be an advantage because it can be completely waterproof very easily, but not sure about wet fingers.
|
|
|
26-09-2018, 03:32
|
#13
|
Registered User
Join Date: Jun 2017
Posts: 4
|
Re: Making a custom keyboard for OpenCPN
Quote:
Originally Posted by skkeith
I am glad you are doing this project. I am planning similar. Please post your source code when it is done. Have you thought about having a 'slow mode' when you send alt+arrow keys instead. Have it toggleable with an led ( like caps lock ). You can also do an HID mouse with the same buttons, even switch back and forth between keyboard and mouse on the fly ( my plans )...
|
This is exactly what I have been thinking of
I am using an Arduino Pro Micro, which has USB HID functionality, and for now I have a 4x4 key matrix working with basic functions: Pan
Zoom
Mouse/keyboard toggle
Mouse cursor movement
Left/right click
Slow/fast toggle (pan, zoom, mouse)
Wish-/todo-list...: Support multiple keypresses (arrows)
Configurable shortcuts for the remaing keys
LED backlit keys (background light, keypress, status togglekeys)
Code cleanup.....
But time is limited, so progress is a bit slow at the moment.
|
|
|
26-09-2018, 05:04
|
#14
|
cruiser
Join Date: Nov 2007
Location: Probably in an anchorage or a boatyard..
Boat: Ebbtide 33' steel cutter
Posts: 5,030
|
Re: Making a custom keyboard for OpenCPN
Thought about using an ESP32 microprocessor? They have 10 capacitive touch pins built in. Then if using openplotter on a Pi mqtt is pre loaded so easy to send the commends over wifi then node-red can convert that data into whatever commands you want.
I've done similar the other way round, sending data to a ESP based remote display to carry around with SOG, COG etc.
|
|
|
09-10-2018, 16:09
|
#15
|
Registered User
Join Date: Mar 2013
Location: Santa Cruz
Boat: 1975 Isander 28
Posts: 132
|
Re: Making a custom keyboard for OpenCPN
I am making progress on mine. I am using a Teensy++ board but not arduino, just straight C using the LUFA library (starting from KeyboardMouse demo in LUFA). Eventually it should be possible to make it idle in standby mode using almost no power.
I have 3 nav modes:
mouse mode,
fast key mode,
slow key mode
In mouse mode the nav buttons move the mouse.
In fast key mode the nav buttons send arrow key presses.
In slow key mode I send Alt + arrow keys with the nav buttons.
I have a radial encoder hooked up for zoom as well which is why I did this in the first place because I just had to have that zoom knob.
I am setting up some number of 'hot key' buttons, but I don't know how many to have yet. I am writing the firmware to store sequences up to 4 key strokes per button, I think, in eeprom so you can customize it. I cannot think of any use for multiple keypresses per button at this time, but might as well use the eeprom space. Anyone ideas of necessary buttons for the cockpit instrumentation? I think at least:
* route start, add, end
* follow boat
* toggle tracks
* drop marker
* man overboard
* screen dim
|
|
|
|
|
Thread Tools |
Search this Thread |
|
|
Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
Advertise Here
Recent Discussions |
|
|
|
|
|
|
|
|
|
|
|
|
Vendor Spotlight |
|
|
|
|
|