Cruisers Forum
 


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 11-06-2017, 03:42   #1
Registered User

Join Date: May 2017
Location: Las Palmas de Gran Canaria
Boat: DUFOUR 31
Posts: 5
OpenCPN instrument

Hello,
I am making a little instrument for my sailboat.
The core is a RPI 3 with Raspbian and OpenCPN using Bluetooth to communicate with the NMEA 2000 bus that is in my sailboat. I am also developing one plugin for OpenCPN to control the buttons and the joystick of this instrument. I have some questions about this:
· All times I start OpenCPN it gives me one error telling me that this is not one serial device. Does not OpenCPN recognise that /dev/rfcomm0 is a serial device? .
· How could I send a command from the plugin to OpenCPN to set OpenCPN in fullscreen mode?.
· Could I modify global parameters of OpenCPN from the plugin? I want to change some parameters, but only when the plugin is active.
I attach one picture of the instrument.
Thanks.
Attached Thumbnails
Click image for larger version

Name:	20170322_102615.jpg
Views:	157
Size:	403.9 KB
ID:	149723  
uberiain is offline   Reply With Quote
Old 11-06-2017, 06:41   #2
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 7,401
Re: OpenCPN instrument

uberiain...

Looks like a fun project.

The changes you require will need to be performed in the OpenCPN main program, and also in your Plugin. You will need to expand the Plugin API to include some new interfaces for your buttons, fullscreen, etc. We could add these interfaces to the base source code after you develop and test them...

About RFCOMM: take a look at source code chart1.cpp, method
Code:
EnumerateSerialPorts( void )
If you can build a Plugin for rPI3, you should also be able to build a custom OCPN core to suit your needs.

Good Luck
Dave
bdbcat is offline   Reply With Quote
Old 11-06-2017, 10:17   #3
Registered User

Join Date: Aug 2009
Location: oriental
Boat: crowther trimaran 33
Posts: 4,417
Re: OpenCPN instrument

You can edit global settings from a plugin but it's not recommended. Also the changes won't apply unless opencpn restarts

I think you need to expand the plugin api to allow a plugin to set fullscreen.

This is yet another case where programmable keybindings would have already solved this, as plugins would have the ability to invoke any action that a keypress can.
seandepagnier is offline   Reply With Quote
Old 11-06-2017, 11:57   #4
Registered User

Join Date: May 2017
Location: Las Palmas de Gran Canaria
Boat: DUFOUR 31
Posts: 5
Re: OpenCPN instrument

Hello,

I have found this in EnumerateSerialPorts( void ):
Code:
  if( devPatern[0] == NULL ) {
 paternAdd ( "ttyUSB" );
 paternAdd ( "ttyACM" );
 paternAdd ( "ttyGPS" );
 paternAdd ( "refcom" );
Maybe “refcom” must be “rfcomm”?. I am testing this on my RPI and I will share the result.

The buttons and the joystick are working as keyboard and mouse input, so no problem with OpenCPN.

I have added one entry in ocpn_plugin.h with:
Code:
extern "C" DECL_EXP void ShowFullScreen(bool show, long style = wxFULLSCREEN_NOBORDER | wxFULLSCREEN_NOCAPTION);
and added this method to pluginmanager.cpp
Code:
 void ShowFullScreen(bool show, long style )
{
if(s_ppim)
{
s_ppim->GetParentFrame()->ShowFullScreen(show,style);

}
}
With that I can control Fullscreen from the plugin.

uberiain is offline   Reply With Quote
Old 11-06-2017, 13:07   #5
Registered User
 
xslim's Avatar

Join Date: Oct 2013
Location: South Atlantic
Boat: Ovni 395
Posts: 153
Re: OpenCPN instrument

Hi uberiain,

what kind of Bluetooth device you use to communicate with the NMEA 2000?
xslim is offline   Reply With Quote
Old 11-06-2017, 14:17   #6
Registered User

Join Date: May 2017
Location: Las Palmas de Gran Canaria
Boat: DUFOUR 31
Posts: 5
Re: OpenCPN instrument

I am using Actisense NGW-1-USB with AIS support connected to one USB host and HC-05. You can see this products on hobbytronics

The RPI sees as a rfcomm port.
uberiain is offline   Reply With Quote
Old 12-06-2017, 11:06   #7
Registered User

Join Date: May 2017
Location: Las Palmas de Gran Canaria
Boat: DUFOUR 31
Posts: 5
Re: OpenCPN instrument

Hi David,
The problem with the serial port not found is not only in EnumerateSerialPorts() method, but in CheckSerialAccess() method.
In CheckSerialAccess() method only tests for access to :
/dev/ttyS0
/dev/ttyUSB0
/dev/ttyACM0
And only for defined(__UNIX__) && !defined(__OCPN__ANDROID__), for other system it returns true.
I changed EnumerateSerialPorts():
refcom by rfcomm
and modified CheckSerialAccess() to use EnumerateSerialPorts() and these changes areworking for me.
Do you think that those changes can be applied to OpenCPN?
Thanks
uberiain is offline   Reply With Quote
Old 12-06-2017, 11:28   #8
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 7,401
Re: OpenCPN instrument

uberiain...

Sure, we can apply these changes.

Simplest way (for me, anyway) would be for you to post a Pull Request to the github master branch. I'll bring it into the current master immediately.

Or, start a task on Flyspray. Document your suggested changes, so that the info is captured and will flow into the next release smoothly.

By far the bast approach is through github. It sounds like you will have other ideas as you move ahead with your project, and I look forward to them.


Thanks
Dave
bdbcat is offline   Reply With Quote
Old 13-06-2017, 05:40   #9
Registered User

Join Date: May 2017
Location: Las Palmas de Gran Canaria
Boat: DUFOUR 31
Posts: 5
Re: OpenCPN instrument

Hello Dave,

I have published a patch in Flyspray with the modifications for ShowFullScreen and for CheckSerialAccess() methods.

What methods in ocpn_plugin.h can I use to measure the distance between the boat and the cursor position?

Where can I find more information about the use of methods in ocpn_plugin.h?

Thanks
uberiain is offline   Reply With Quote
Reply

Tags
enc, men, opencpn, rum


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
Requesting OpenCPN support for the new Sailtimer Wind Instrument RhythmDoctor OpenCPN 29 29-01-2017 10:55
OpenCPN Instrument Addition nerd OpenCPN 2 06-03-2014 10:26
Instrument Data on OpenCPN Via NMEA SV Demeter OpenCPN 1 01-03-2012 12:13
Virtual OpenCPN - 'OpenCPN on a Stick' r.fairman OpenCPN 23 16-10-2011 19:51

Advertise Here


All times are GMT -7. The time now is 08:48.


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.