From 452dcce004b03b9b4725782dc1d1dd7c19236269 Mon Sep 17 00:00:00 2001 From: Villuton Date: Wed, 26 Mar 2025 16:36:17 +0300 Subject: [PATCH] fix diff --- Solutions/Inc/Nmea_Gga.h | 1 + Solutions/Src/Nmea_Gga.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Solutions/Inc/Nmea_Gga.h b/Solutions/Inc/Nmea_Gga.h index 2cde215..1428a82 100644 --- a/Solutions/Inc/Nmea_Gga.h +++ b/Solutions/Inc/Nmea_Gga.h @@ -13,6 +13,7 @@ #define DGPS_SID_MIN (0000) #define DGPS_SID_MAX (1023) +#define DIFF_GEOID_IS_BELOW '-' /** * GPS Quality indicator: */ diff --git a/Solutions/Src/Nmea_Gga.c b/Solutions/Src/Nmea_Gga.c index c7d7378..257a297 100644 --- a/Solutions/Src/Nmea_Gga.c +++ b/Solutions/Src/Nmea_Gga.c @@ -53,7 +53,9 @@ bool NmeaGga_Parse(char *str, size_t len, tNmeaGGA *result) *front : 0; result->diff = (Nmea0183ParseNextPortion(&front, &nextDivider, end) > 0) ? - Nmea0183ParseDouble(front,nextDivider - front) : 0; + (*front != DIFF_GEOID_IS_BELOW) ? + Nmea0183ParseDouble(front,nextDivider - front) : 0 + : 0; result->diff_units = (Nmea0183ParseNextPortion(&front, &nextDivider, end) > 0) ? *front : 0;