canboat / canboatjs

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

B&G display reconciliation issue, missing values after SignalK server reboot #284

Open mrstas opened 3 days ago

mrstas commented 3 days ago

Hi I have B&G Triton2 multi-function display. It has a feature that you can map selected parameter value to specific source. For example if you have multiple GPS sources in nmea2000 network you can select specific device you nominate for reading those values. So there is the issue: in my setup I have position mapped to be received from SignalK server. After mapping it work absolutely fine till I reboot RaspberryPi. After reboot I've got 2 records of SignalK server in the device list (one of them will diapers after a while) and in mapping menu my previously selected Signalk connection is marked as OFFLINE. So B&G Triton2 device can't reconcile (match) two SignalK instances (before and after reboot). This leads to missing values on display. I did a bit of testing and found these 2 issues causing this problem:

  1. When requesting address claim we are passing 999 as manufacturing code But I think it is incorrect, we need to send manufacturer name as a string, just like in this example When value is 999 then B&G reports manufacturer as "Unknown", if value is any text from this list then it display same value, if string is not from that list (f.e. 'canboat') then B&G report it as "internal"
  2. New device unique number is generating every time we are connecting to network This line overwrites previously set value here

So after putting canboat instead of 999 here and commenting out this line that generate new unique id every time I was able to fix issue on B&G display. I think we can set unique number to be equal to serial number as a solution instead of hardcoding fixed value or generating random number. This may fix this issue as well (https://github.com/SignalK/signalk-to-nmea2000/issues/58)

mrstas commented 1 day ago

my bad, Manufacturer Code should be a number, old test is reffering to commented out code. After testing I have found that 0 is acceptable code that appears as "Internal" manufacturer on B&G display, codes outside of codesMfgs.json appears as "Unknown" and does not work. So setting mfg code to 0 instead of 999 partially resolve the issue. As for setting Unique Number I've tried to move that functionality to SignalK server provider configuration (similar to this https://github.com/canboat/canboatjs/pull/267/commits/5c783fd2ae347fcaf5f116c4a5fa16e2bd117fec) and have found that in current code options.uniqueNumber is never passed from SignalK server (even if it set here https://github.com/SignalK/signalk-server/pull/1026/commits) and device serial number is always defaulting to 0000001 @tkurki appreciate any help