mbof / hxsync

MIT License
4 stars 0 forks source link

Reading waypoint with no MMSI fails #21

Closed johannessen closed 6 months ago

johannessen commented 6 months ago

It seems that the position decoding subroutine doesn’t account for the fact that degrees of latitude only have two digits.

On the hx870 branch, given the following waypoint definition in the HX870 device:

00004300: ffff ffff ff11 0600 004e 0010 0060 0045  .........N...`.E
00004310: 3030 3157 5054 ffff ffff ffff ffff ff01  001WPT..........

Expected output: 001WPT (1, 4300) 11° 06.0000’ N 10° 00.6000’ E

Actual output: 001WPT (1, 4300) NaN° 06.0000’ N 10° 00.6000’ E

mbof commented 6 months ago

Thanks for the report!

It seems like the waypoint latitude, in the case of your device, is left-padded with a 0xF instead. My device seems to use 0x0 as left-padding. The fix should handle 0xF now.

johannessen commented 6 months ago

The HX870 puts fffffffff0 into the DSC address field for waypoints manually created in the device. But the UI for editing waypoint coordinates on the device itself is a bit masochistic … most people would probably use YCE15 instead, which fills the DSC address with ffffffffff. The latter behaviour is consistent with how ff is generally used as padding and as marker for missing data on the device.

I did mention this briefly in https://johannessen.github.io/hx870/#wpt-def, but reading that again now, I agree it isn't very clear at all. 🙂

I propose a slightly different fix here. See the commit comment.

mbof commented 6 months ago

Thanks! I've addressed this in follow-ups 523115e and e1b520b