Improve pilotPosition when internal GPS is available (#5187)

* Update pilotposition when internal GPS does have a fix *** UNTESTED YET ***

* Cosmetics, tested OK
This commit is contained in:
3djc
2017-08-31 19:11:44 +02:00
committed by Bertrand Songis
parent 8e04a6e2e4
commit fdacf83ad0
+11
View File
@@ -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;
}