This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Fix for port control button "429426" bug
All credit to forum member johnm for this bug-fix, which came up in this thread:

It's puzzled me that when the pypilot plug-in was activated/engaged on my Ubuntu 18.4 x64 laptop the port course change buttons would not read -110/-10/-1 , but instead read 429426 in all three positions.  This bug did not show up in opencpn pypilot running on my RPi-3b+ OpenPlotter box.

JohnM hunted up and fixed the code, and posted the change in that thread. Sean has seen it, and will test and update the plugin eventually. I made the change on my system, and it fixed things nicely. Here's JohnM's  code change if you have this same problem. (I've added the steps to locate and modify the code):

Think I may have got it.

In AddButton changed %ld to %i.
Now angles buttons all display properly :-)
Not boat tested and may break 32 bit version.

cd /usr/local/include/pypilot_pi/src
sudo nano pypilotDialog.cpp

Locate this section (try ctl-w and search for 'void pypilotDialog::AddButton'):

void pypilotDialog::AddButton(int angle, wxSizer *sizer)
        angle = -angle;

    wxButton *button = new wxButton( this, wxID_ANY, wxString::Format("%ld", angle));
    button->Connect( wxEVT_COMMAND_BUTTON_CLICKED,
                     wxCommandEventHandler( pypilotDialog::OnControlAngle ), NULL, this );
    button->SetMaxSize(wxSize(60, -1));
    sizer->Add( button, 0, wxALL, 5 );

Now edit the above to comment out one line, and replace it thus. It will look like this:

/*    wxButton *button = new wxButton( this, wxID_ANY, wxString::Format("%ld", angle)); */

    wxButton *button = new wxButton( this, wxID_ANY, wxString::Format("%i", angle));

All this does is change one element from "%ld"  to become "%i" . Doing it this way makes it very easy to undo if you encounter problems.

Now, you must rebuild the plug-in for the change to take place:

cd /usr/local/include/pypilot_pi/build

sudo cmake ..

sudo make

sudo make install

Then restart OpenCPN and test it with your autopilot.

Again, big thanks to JohnM for finding this, and as always to Sean for all his work.


Forum Jump:

Users browsing this thread: 1 Guest(s)