Do double pythrogoras if altitude is involved (fixes #5280) (#5341)

This commit is contained in:
Arne Schwabe
2017-11-10 16:41:52 +01:00
committed by Andre Bernet
parent f9d5201b0c
commit 2e248e7bc0
+6 -2
View File
@@ -315,12 +315,16 @@ void TelemetryItem::eval(const TelemetrySensor & sensor)
dist = gpsItem.distFromEarthAxis * angle / 1000000;
result += dist*dist;
// Length on ground (ignoring curvature of the earth)
result = isqrt32(result);
if (altItem) {
dist = abs(altItem->value) / g_model.telemetrySensors[sensor.dist.alt-1].getPrecDivisor();
result += dist*dist;
result = dist*dist + result*result;
result = isqrt32(result);
}
setValue(sensor, isqrt32(result), UNIT_METERS);
setValue(sensor, result, UNIT_METERS);
}
break;