Skip to content

Commit

Permalink
drivers: gnss: Add geoid separation to gnss_info
Browse files Browse the repository at this point in the history
Currently altitude is only provided above MSL. Adding
geoid seperation allows for ellipsoidal height to be
determined.

Signed-off-by: Maxmillion McLaughlin <[email protected]>
  • Loading branch information
maxmclau committed Jan 29, 2025
1 parent 6894fce commit 1639fe5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
10 changes: 10 additions & 0 deletions drivers/gnss/gnss_nmea0183.c
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,16 @@ int gnss_nmea0183_parse_gga(const char **argv, uint16_t argc, struct gnss_data *
}

data->nav_data.altitude = (int32_t)tmp64;

/* Parse geoid separation */
if ((gnss_parse_dec_to_milli(argv[11], &tmp64) < 0) ||
(tmp64 > INT32_MAX) ||
(tmp64 < INT32_MIN)) {
return -EINVAL;
}

data->info.geoid_separation = (int32_t)tmp64;

return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion include/zephyr/data/navigation.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ struct navigation_data {
uint32_t bearing;
/** Speed in millimeters per second */
uint32_t speed;
/** Altitude in millimeters */
/** Altitude above MSL in millimeters */
int32_t altitude;
};

Expand Down
2 changes: 2 additions & 0 deletions include/zephyr/drivers/gnss.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ struct gnss_info {
uint16_t satellites_cnt;
/** Horizontal dilution of precision in 1/1000 */
uint32_t hdop;
/** Geoid separation in millimeters */
int32_t geoid_separation;
/** The fix status */
enum gnss_fix_status fix_status;
/** The fix quality */
Expand Down

0 comments on commit 1639fe5

Please sign in to comment.