canboat / canboatjs

Native javascript NMEA 2000 decoder and encoder
Apache License 2.0
98 stars 41 forks source link

Fix: Shipmodul MXPGN hex parsing. #191

Closed Sjoerd02 closed 3 months ago

Sjoerd02 commented 2 years ago

Big- Little- Endian issue parsing MXPGN / shipmodul Shipmodul is sending hex from right to left, SK is expecting from left to right.

see also https://signalk-dev.slack.com/archives/C03F1MKQG/p1633812967355500

sbender9 commented 2 years ago

The MXPGN test fails now. But I don't remember where I got that data and it doesn't look valid anyway.

I tested this stuff way back with SeaSmart hardware and the Navico GoFree stuff. I find it very hard to believe that I would have missed this!

I think Shipmodul got it backwards

sbender9 commented 2 years ago

Where did you get this:

"one CAN frame (a NMEA 2000 Single Frame message) as one 64-bit 'little endian' word."

Sjoerd02 commented 2 years ago

Where did you get this:

"one CAN frame (a NMEA 2000 Single Frame message) as one 64-bit 'little endian' word."

The statement I got in a mail from Shipmodul asking how to read the MXPGN.

Possibly the 64 bit is pointing to my example explicitly.

http://www.shipmodul.com/downloads/manuals/MiniPlex-3_3.14_EN.pdf - page 92:

2022-03-28_21h46_11

Sjoerd02 commented 2 years ago

To me it looks like the encodeMXPGN is also have some code to invert the Hex. We tested the same code in the parseMXPGN but it did not actually store buff.

Checking the history, it looks like the MXPGN was introduced 8 Feb '21 and corrected on 3 Mar'21 corrected. I did not test the encoding part of the code.

I tested this stuff way back with SeaSmart hardware and the Navico GoFree stuff. I find it very hard to believe that I would have missed this!

I was not aware MXPGN was used by other devices as well, it did not pop-up in Google search.

sbender9 commented 3 months ago

Sorry for the horrible delay: https://github.com/canboat/canboatjs/pull/277