diff --git a/src/main/flight/position.c b/src/main/flight/position.c index 9c3bca5851..cbeca23ec2 100644 --- a/src/main/flight/position.c +++ b/src/main/flight/position.c @@ -104,19 +104,19 @@ void calculateEstimatedAltitude(timeUs_t currentTimeUs) #endif #ifdef USE_GPS -if (sensors(SENSOR_GPS) && STATE(GPS_FIX)) { - gpsAlt = gpsSol.llh.altCm; + if (sensors(SENSOR_GPS) && STATE(GPS_FIX)) { + gpsAlt = gpsSol.llh.altCm; #ifdef USE_VARIO - gpsVertSpeed = GPS_verticalSpeedInCmS; + gpsVertSpeed = GPS_verticalSpeedInCmS; #endif - haveGpsAlt = true; + haveGpsAlt = true; - if (gpsSol.hdop != 0) { - gpsTrust = 100.0 / gpsSol.hdop; + if (gpsSol.hdop != 0) { + gpsTrust = 100.0 / gpsSol.hdop; + } + // always use at least 10% of other sources besides gps if available + gpsTrust = MIN(gpsTrust, 0.9f); } - // always use at least 10% of other sources besides gps if available - gpsTrust = MIN(gpsTrust, 0.9f); -} #endif if (ARMING_FLAG(ARMED) && !altitudeOffsetSet) { diff --git a/src/main/target/common_post.h b/src/main/target/common_post.h index 3c9458acb5..a2d0461f63 100644 --- a/src/main/target/common_post.h +++ b/src/main/target/common_post.h @@ -60,7 +60,7 @@ #endif #endif -#if !defined(USE_BARO) && !defined(USE_GPS) +#if !defined(USE_BARO) #undef USE_VARIO #endif