Cruisers Forum
 

Go Back   Cruisers & Sailing Forums > Seamanship, Navigation & Boat Handling > OpenCPN
Cruiser Wiki Click Here to Login
Register Vendors FAQ Community Calendar Today's Posts Log in

Reply
  This discussion is proudly sponsored by:
Please support our sponsors and let them know you heard about their products on Cruisers Forums. Advertise Here
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 18-09-2018, 03:11   #1
lgj
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
lgj is offline   Reply With Quote
Old 18-09-2018, 11:08   #2
Registered User

Join Date: Nov 2012
Location: Orust Sweden
Boat: Najad 34
Posts: 4,160
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
Hakan is offline   Reply With Quote
Old 18-09-2018, 15:39   #3
lgj
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
lgj is offline   Reply With Quote
Old 18-09-2018, 22:39   #4
Registered User

Join Date: Nov 2012
Location: Orust Sweden
Boat: Najad 34
Posts: 4,160
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.
Hakan is offline   Reply With Quote
Old 19-09-2018, 12:11   #5
Registered User
 
skkeith's Avatar

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 )...
skkeith is offline   Reply With Quote
Old 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?
skipperearly is offline   Reply With Quote
Old 19-09-2018, 23:09   #7
Registered User

Join Date: Apr 2007
Location: Australia
Boat: Island Packet 40
Posts: 6,476
Images: 7
Re: Making a custom keyboard for OpenCPN

Use a mouse.
RaymondR is online now   Reply With Quote
Old 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 View Post
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?
petter5 is offline   Reply With Quote
Old 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?
seandepagnier is offline   Reply With Quote
Old 20-09-2018, 05:10   #10
bcn
Registered User

Join Date: May 2011
Location: underway whenever possible
Boat: Rangeboat 39
Posts: 4,754
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.
bcn is offline   Reply With Quote
Old 20-09-2018, 15:23   #11
Registered User
 
skkeith's Avatar

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...
skkeith is offline   Reply With Quote
Old 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.
seandepagnier is offline   Reply With Quote
Old 26-09-2018, 03:32   #13
lgj
Registered User

Join Date: Jun 2017
Posts: 4
Re: Making a custom keyboard for OpenCPN

Quote:
Originally Posted by skkeith View Post
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.
Attached Images
 
lgj is offline   Reply With Quote
Old 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.
conachair is offline   Reply With Quote
Old 09-10-2018, 16:09   #15
Registered User
 
skkeith's Avatar

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
skkeith is offline   Reply With Quote
Reply

Tags
enc, opencpn


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cool Mini Wireless Keyboard and Trackpad. noelex 77 Marine Electronics 7 03-03-2013 06:27
Weird Keyboard Vasco Forum Tech Support & Site Help 3 18-10-2012 06:52
Want To Buy: JRC keyboard for 5000 series radar Lars Schuy Classifieds Archive 0 30-05-2012 03:04

Advertise Here


All times are GMT -7. The time now is 02:46.


Google+
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Social Knowledge Networks
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2024, vBulletin Solutions, Inc.

ShowCase vBulletin Plugins by Drive Thru Online, Inc.