From fb28d2e75003fd94fa6a5e6d9d81faf59eebe4d5 Mon Sep 17 00:00:00 2001 From: Frankie Arzu <32604366+frankiearzu@users.noreply.github.com> Date: Sun, 7 Jan 2024 18:12:31 -0600 Subject: [PATCH] fix(DSM): Longitude truncated when greater than 99 deg (#4515) --- radio/src/telemetry/spektrum.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/radio/src/telemetry/spektrum.cpp b/radio/src/telemetry/spektrum.cpp index d0e8c9ec175..23021eb5f59 100644 --- a/radio/src/telemetry/spektrum.cpp +++ b/radio/src/telemetry/spektrum.cpp @@ -505,6 +505,10 @@ static void processGPSLocPacket(const uint8_t *packet, const uint16_t pseudoId, min = bcdToInt8(packetData[8]); deg = bcdToInt8(packetData[9]); + if ((gpsFlags & GPS_INFO_FLAGS_LONGITUDE_GREATER_99) != 0) { + deg = deg + 100; + } + // formula from code in gps.cpp value = deg * 1000000UL + (min * 100000UL + fmin * 10UL) / 6; @@ -1020,8 +1024,11 @@ static bool real0x34 = false; // Example 0x16: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 // 16 00 | 97 00 | 54 71 12 28 | 40 80 09 82 | 85 14 | 13 | B9 // Alt: 009.7, LAT: 28o 12'7154, LON: -82 09 8040 Course: 148.5, HDOP 1.3 Flags= B9 +//static char test16data[] = {0x16, 0x00, 0x97, 0x00, 0x54, 0x71, 0x12, 0x28, +// 0x40, 0x80, 0x09, 0x82, 0x85, 0x14, 0x13, 0xB9}; + static char test16data[] = {0x16, 0x00, 0x97, 0x00, 0x54, 0x71, 0x12, 0x28, - 0x40, 0x80, 0x09, 0x82, 0x85, 0x14, 0x13, 0xB9}; + 0x40, 0x80, 0x09, 0x11, 0x85, 0x14, 0x13, 0xBD}; // > 99 Flag // *********** GPS STAT (BCD) ***************************** // Example 0x17: 0 1 2 3 4 5 6 7