From b004706eff44db32e2a1f048040322876f906e0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Wed, 9 Nov 2022 23:42:52 +0100 Subject: [PATCH] fix #1928 valid NMEA sentences --- src/gps/NMEAWPL.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/gps/NMEAWPL.cpp b/src/gps/NMEAWPL.cpp index 222a2d04..48f528f5 100644 --- a/src/gps/NMEAWPL.cpp +++ b/src/gps/NMEAWPL.cpp @@ -17,7 +17,10 @@ uint32_t printWPL(char *buf, const Position &pos, const char *name) { - uint32_t len = sprintf(buf, "$GNWPL,%07.2f,%c,%08.2f,%c,%s", pos.latitude_i * 1e-5, pos.latitude_i < 0 ? 'S' : 'N', pos.longitude_i * 1e-5, pos.longitude_i < 0 ? 'W' : 'E', name); + uint32_t len = sprintf(buf, "$GNWPL,%07.2f,%c,%08.2f,%c,%s", + abs(pos.latitude_i) * 1e-5, pos.latitude_i < 0 ? 'S' : 'N', + abs(pos.longitude_i) * 1e-5, pos.longitude_i < 0 ? 'W' : 'E', + name); uint32_t chk = 0; for (uint32_t i = 1; i < len; i++) { chk ^= buf[i]; @@ -55,8 +58,8 @@ uint32_t printGGA(char *buf, const Position &pos) uint32_t len = sprintf(buf, "$GNGGA,%06u.%03u,%07.2f,%c,%08.2f,%c,%u,%02u,%04u,%04d,%c,%04d,%c,%d,%04d", pos.time / 1000, pos.time % 1000, - pos.latitude_i * 1e-5, pos.latitude_i < 0 ? 'S' : 'N', - pos.longitude_i * 1e-5, pos.longitude_i < 0 ? 'W' : 'E', + abs(pos.latitude_i) * 1e-5, pos.latitude_i < 0 ? 'S' : 'N', + abs(pos.longitude_i) * 1e-5, pos.longitude_i < 0 ? 'W' : 'E', pos.fix_type, pos.sats_in_view, pos.HDOP,