From fdacf83ad019c0f3b4fec107358fb7a349b19571 Mon Sep 17 00:00:00 2001 From: 3djc Date: Thu, 31 Aug 2017 19:11:44 +0200 Subject: [PATCH] Improve pilotPosition when internal GPS is available (#5187) * Update pilotposition when internal GPS does have a fix *** UNTESTED YET *** * Cosmetics, tested OK --- radio/src/telemetry/telemetry_sensors.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/radio/src/telemetry/telemetry_sensors.cpp b/radio/src/telemetry/telemetry_sensors.cpp index c321cb8de..64544b90f 100644 --- a/radio/src/telemetry/telemetry_sensors.cpp +++ b/radio/src/telemetry/telemetry_sensors.cpp @@ -93,6 +93,12 @@ void TelemetryItem::setValue(const TelemetrySensor & sensor, int32_t val, uint32 newVal = 0; } else if (unit == UNIT_GPS_LATITUDE) { +#if defined(INTERNAL_GPS) + if (gpsData.fix) { + pilotLatitude = gpsData.latitude; + distFromEarthAxis = getDistFromEarthAxis(pilotLatitude); + } +#endif if (!pilotLatitude) { pilotLatitude = newVal; distFromEarthAxis = getDistFromEarthAxis(newVal); @@ -102,6 +108,11 @@ void TelemetryItem::setValue(const TelemetrySensor & sensor, int32_t val, uint32 return; } else if (unit == UNIT_GPS_LONGITUDE) { +#if defined(INTERNAL_GPS) + if (gpsData.fix) { + pilotLongitude = gpsData.longitude; + } +#endif if (!pilotLongitude) { pilotLongitude = newVal; }