mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-25 17:25:20 +03:00
Merge pull request #9616 from TonyBlit/fix_alt_before_arm
Absolute altitude before arming is now correct when using GPS and Baro
This commit is contained in:
parent
2f95749523
commit
f6fa0bc89e
1 changed files with 5 additions and 1 deletions
|
@ -146,7 +146,11 @@ void calculateEstimatedAltitude(timeUs_t currentTimeUs)
|
||||||
|
|
||||||
|
|
||||||
if (haveGpsAlt && haveBaroAlt && positionConfig()->altSource == DEFAULT) {
|
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
|
#ifdef USE_VARIO
|
||||||
// baro is a better source for vario, so ignore gpsVertSpeed
|
// baro is a better source for vario, so ignore gpsVertSpeed
|
||||||
estimatedVario = calculateEstimatedVario(baroAlt, dTime);
|
estimatedVario = calculateEstimatedVario(baroAlt, dTime);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue