From 9c492f4a9be362598b3726cd5dda61d9a8050786 Mon Sep 17 00:00:00 2001 From: Chris LaFlash Date: Sat, 20 Apr 2024 09:57:08 -0700 Subject: [PATCH] drivers: gnss: Use correct GGA Elevation field Switching from using Geoid seperation to Elevation MSL field. Signed-off-by: Chris LaFlash --- drivers/gnss/gnss_nmea0183.c | 2 +- tests/drivers/gnss/gnss_nmea0183/src/main.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gnss/gnss_nmea0183.c b/drivers/gnss/gnss_nmea0183.c index 9bce7a443a2..515606fbefe 100644 --- a/drivers/gnss/gnss_nmea0183.c +++ b/drivers/gnss/gnss_nmea0183.c @@ -538,7 +538,7 @@ int gnss_nmea0183_parse_gga(const char **argv, uint16_t argc, struct gnss_data * data->info.hdop = (uint16_t)tmp64; /* Parse altitude */ - if ((gnss_parse_dec_to_milli(argv[11], &tmp64) < 0) || + if ((gnss_parse_dec_to_milli(argv[9], &tmp64) < 0) || (tmp64 > INT32_MAX) || (tmp64 < INT32_MIN)) { return -EINVAL; diff --git a/tests/drivers/gnss/gnss_nmea0183/src/main.c b/tests/drivers/gnss/gnss_nmea0183/src/main.c index 680382f7dbc..43cd6a2e53f 100644 --- a/tests/drivers/gnss/gnss_nmea0183/src/main.c +++ b/tests/drivers/gnss/gnss_nmea0183/src/main.c @@ -330,7 +330,7 @@ ZTEST(gnss_nmea0183, test_parse_gga_fix) "Incorrectly parsed number of satelites"); zassert_equal(data.info.hdop, 1410, "Incorrectly parsed HDOP"); - zassert_equal(data.nav_data.altitude, 42371, "Incorrectly parsed altitude"); + zassert_equal(data.nav_data.altitude, 15234, "Incorrectly parsed altitude"); } ZTEST(gnss_nmea0183, test_snprintk)