From b570f3b6901a0ae4c47958bd12235fcab736149a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Niccol=C3=B2=20Izzo?= <izzo.niccolo@gmail.com>
Date: Thu, 11 Feb 2021 09:43:51 +0100
Subject: [PATCH] Add GPS altitude parsing

---
 openrtx/include/state.h | 1 +
 openrtx/src/gps.c       | 1 +
 2 files changed, 2 insertions(+)

diff --git a/openrtx/include/state.h b/openrtx/include/state.h
index 54a8793a..a570a856 100644
--- a/openrtx/include/state.h
+++ b/openrtx/include/state.h
@@ -51,6 +51,7 @@ typedef struct
     sat_t satellites[12]; // Details about satellites in view
     float latitude;       // Latitude coordinates
     float longitude;      // Longitude coordinates
+    float altitude;       // Antenna altitude above mean sea level (geoid) in m
     float speed;          // Ground speed in km/h
     float tmg_mag;        // Course over ground, degrees, magnetic
     float tmg_true;       // Course over ground, degrees, true
diff --git a/openrtx/src/gps.c b/openrtx/src/gps.c
index 8cd15c58..bfd3e8e2 100644
--- a/openrtx/src/gps.c
+++ b/openrtx/src/gps.c
@@ -51,6 +51,7 @@ void gps_taskFunc(char *line, int len, gps_t *state)
             if (minmea_parse_gga(&frame, line)) {
                 state->fix_quality = frame.fix_quality;
                 state->satellites_tracked = frame.satellites_tracked;
+                state->altitude = minmea_tofloat(&frame.altitude);
             }
         } break;