From 5209a83e6a46ea5640992d2ae0f8e31887c39e9e Mon Sep 17 00:00:00 2001 From: Tony Cabello Date: Sun, 15 Mar 2020 14:13:55 +0100 Subject: [PATCH] Bug fix: absolute altitude before arming is now correct when using GPS and Baro --- src/main/flight/position.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/flight/position.c b/src/main/flight/position.c index a21ba9660..daa3e1e12 100644 --- a/src/main/flight/position.c +++ b/src/main/flight/position.c @@ -146,7 +146,11 @@ void calculateEstimatedAltitude(timeUs_t currentTimeUs) if (haveGpsAlt && haveBaroAlt && positionConfig()->altSource == DEFAULT) { - estimatedAltitudeCm = gpsAlt * gpsTrust + baroAlt * (1 - gpsTrust); + if (ARMING_FLAG(ARMED)) { + estimatedAltitudeCm = gpsAlt * gpsTrust + baroAlt * (1 - gpsTrust); + } else { + estimatedAltitudeCm = gpsAlt; //absolute altitude is shown before arming, ignore baro + } #ifdef USE_VARIO // baro is a better source for vario, so ignore gpsVertSpeed estimatedVario = calculateEstimatedVario(baroAlt, dTime);