antipole2 / WhoGoesThere

For WhoGoesThere JavaScript
GNU General Public License v3.0
0 stars 0 forks source link

PGN59904 not being sent successfully through some channels #6

Open antipole2 opened 1 month ago

antipole2 commented 1 month ago

The script sends PGN59904 to request PGN126996 from all stations.

Some setups are not receiving the response, presumably because PGN59904 is not actually being sent out.

Working:

Not working:

@TwoCanPlugIn For information, the JavaScript plugin keeps a record of PGNs sent and registers them before the first send.

torrmundi commented 1 month ago

I'm now getting the 126996 responses SOMETIMES when using Actisense NGT-1, with WhoGoesThere v0.2 and Javascript plugin v3.05c. 1) There's still some script timeout issue. 2) Data for uniqueNumber is 10506209 exceeds maximum issue. 3) Compared to Actisense NGT-1 Network View in NMEAreader, there are 2 devices not listed by WhoGoesThere: 1 Actisense PC Gateway 254945..., NGT-1 170 Yacht Devices Bus Traffic Logger (140)..., YDVR-04 4) The first time I run the script after starting OpenCPN, no 126996 responses. Works 2nd try onwards.

Active connections nmea2000!@!COM3 {"protocol":"nmea2000","canAddress":"-1"}

Listening for 10 seconds.........

OpenCPN messages received since plugin started OCPN_CORE_SIGNALK OCPN_OPENGL_CONFIG OpenCPN Config WMM_VARIATION_BOAT

NMEA0183 samples (None)

SignalK samples (None)

NMEA2000 stations responding to PGN126996 request Source ProdCode ModelId SoftwareVersionCode ModelSerialCode Certification LoadEquivalency 3 undefined NF80 _Pilot controller 1100 130200 007968# 1 3 4 20010 AP44 Autopilot Control 01000_E 2.2.57.3.163 108342749 2 4 6 16891 W12 Pilot Controller 01000_E 18.3.61.1.15 001680# 2 0 11 16891 W12 Echo (BSM-1 v1.2. 01000_E 18.3.61.1.15 001680# 2 0 12 13233 Precision-9 Compass 2.0.3-0 118774501 1 1 14 16891 W12 iGPS 01000_E 18.3.61.1.15 001680# 2 0 17 16891 W12 Navigator 01000_E 18.3.61.1.15 001680# 2 0 20 16593 RF25 _Rudder feedback 1100 120100 008235# 1 1 21 3741 IS40 Display 01000_E 2.9.0 RR205 007213# 0 3 22 3741 IS40 Display 01000_E 2.9.0 RR205 007616# 0 3 24 16891 W12 MFD 01000_E 18.3.61.1.15 001680# 2 1 35 19371 D200 1.004,1.022 3592608 1 4 36 14367 DST200 3.105,3.100 60144873 undefined 4 37 29528 WX Series WeatherStation S 2.006,2.302,2.003,2. 60312155 1 4 41 4429 iKommunicate 2018060100 IKR20160713004 0 1 64 6538 YDWG-02 1.72 18/04/2024 00600364 1 1

NMEA2000 samples Counts Source PGN 3 22 59904 ISO Request Data for uniqueNumber is 10506209 exceeds maximum 20 170 60928 ISO Address Claim 41 24 65280 Furuno: Heave 99 12 65350 Simnet: Magnetic Field 20 37 126992 System Time 1 41 126993 Heartbeat 16 6 126996 Product Information 202 20 127245 Rudder 299 12 127250 Vessel Heading 300 12 127251 Rate of Turn 99 12 127252 Heave 218 12 127257 Attitude 51 17 127258 Magnetic Variation Script timed out

antipole2 commented 1 month ago
  1. There's still some script timeout issue.
  2. Data for uniqueNumber is 10506209 exceeds maximum issue.
  3. Compared to Actisense NGT-1 Network View in NMEAreader, there are 2 devices not listed by WhoGoesThere:
  4. 1 Actisense PC Gateway 254945..., NGT-1 170 Yacht Devices Bus Traffic Logger (140)..., YDVR-04
  5. The first time I run the script after starting OpenCPN, no 126996 responses. Works 2nd try onwards.

(1) Line 182 is 'timeAlloc(2000);`, which gives it 2000ms for all the decoding. You can increase this or even move the allocation into the start of each loop after line 184, although allocating more time within a loop is a bit risky if it gets stuck.

(2) See this issue

Re (3) to (4), I am sailing and only have a mobile signal etc. so limited capacity to investigate at the moment.

(5) Interesting. The first time the plugin is asked to transmit a PGN it registers it through OCPN as required and then remembers it is registered for future send requests of that PGN. The Tools>Diagnostics>Dump includes a list of the PGNs it has registered - worth looking at that. It is just before the first ------- Console section. You could try disabling the plugin and then re-enabling it, which will cause it to forget the list of previously registered PGNs. Does that have the same effect?

torrmundi commented 1 month ago

5) If I disable/reenable Javascript PI, clicking on the {JS} icon no longer brings up my console. Nothing happens, except the icon goes grey (on) or black (off) on succcessive clicks. I have to stop/restart OpenCPN to regain a working console. Then it behaves as before: 1st try no responses, 2nd and onward gets responses.

Dump after 1st try: JavaScript plugin version 3.0 JavaScript patch 5 JavaScript tools window DPI scaling factor 1.250000 Platform Windows 11 (build 22631), 64-bit edition Architecture x64 wxWidgets version 3.2.4.0 or 3204 OCPN API version 1.18 Duktape version 20700 Not using svg pJavaScript_pi->m_pconfig 0x0001c3e3d0 pJavaScript_pi->m_parent_window 0x0003eecc78 pJavaScript_pi->m_floatOnTop false pJavaScript_pi->mRememberToggleStatus false favouriteFiles: recentFiles: C:\Users....\Downloads\OpenCPN\whogoesthere.js C:\Users....\Downloads\OpenCPN\SignalK_msgs.js N2K pgn registrations: Handle nmea2000!@!COM3 59904 pJavaScript_pi->mpFirstConsole 0x0001bb86e8

Dump after 2nd try: JavaScript plugin version 3.0 JavaScript patch 5 JavaScript tools window DPI scaling factor 1.250000 Platform Windows 11 (build 22631), 64-bit edition Architecture x64 wxWidgets version 3.2.4.0 or 3204 OCPN API version 1.18 Duktape version 20700 Not using svg pJavaScript_pi->m_pconfig 0x00016fb4a0 pJavaScript_pi->m_parent_window 0x0003762040 pJavaScript_pi->m_floatOnTop false pJavaScript_pi->mRememberToggleStatus false favouriteFiles: recentFiles: C:\Users...\Downloads\OpenCPN\whogoesthere.js C:\Users...\Downloads\OpenCPN\SignalK_msgs.js N2K pgn registrations: Handle nmea2000!@!COM3 59904 pJavaScript_pi->mpFirstConsole 0x00016786e8

antipole2 commented 1 month ago

@torrmundi Looks like you have uncovered an unrelated issue. Please see new plugin issue I have opened here: https://github.com/antipole2/JavaScript_pi/issues/102#issue-2329835454

antipole2 commented 1 month ago

@torrmundi said:

The first time I run the script after starting OpenCPN, no 126996 responses. Works 2nd try onwards

Possibly a timing issue on your platform.

Please

  1. Restart OCPN
  2. Run the script below first once (you may like to do so in a separate test console). Suspect you will see received count of zero.
  3. Run WhoGoesThere for the first time since restart

Hypothesis: If a timing issue, the extra script may register the outgoing PGN so that WhoGoesThere works first time.

NMEA2000 = require("NMEA2000");
count = 0;
//setup listening to responses to PGN59904
pgnToSend = 59904;
nmeaSend = new NMEA2000(pgnToSend);
pgnToReceive = 126996;
nmeaSend.pgn = pgnToReceive;    // pgn to request
OCPNonAllNMEA2000(receive126996, pgnToReceive); // listen out
nmeaSend.push();
onSeconds(finish, 2);

function receive126996(payload){
    count++;
    }

function finish(){
    stopScript("Received " + count);
    }

.