Permalink
Browse files

revert position.c changes

  • Loading branch information...
s0up committed Jun 7, 2018
1 parent 96692af commit 1b1837905c86aa8131d257d1a2ea4239ff01f2ba
Showing with 6 additions and 4 deletions.
  1. +6 −4 src/main/flight/position.c
View
@@ -86,13 +86,15 @@ if (sensors(SENSOR_GPS) && STATE(GPS_FIX)) {
}
#endif
if (!ARMING_FLAG(ARMED)) {
if (ARMING_FLAG(ARMED) && !altitudeOffsetSet) {
baroAltOffset = baroAlt;
gpsAltOffset = gpsAlt;
} else {
baroAlt -= baroAltOffset;
gpsAlt -= gpsAltOffset;
altitudeOffsetSet = true;
} else if (!ARMING_FLAG(ARMED) && altitudeOffsetSet) {
altitudeOffsetSet = false;
}
baroAlt -= baroAltOffset;
gpsAlt -= gpsAltOffset;
if (haveGpsAlt && haveBaroAlt) {
estimatedAltitude = gpsAlt * gpsTrust + baroAlt * (1 - gpsTrust);

0 comments on commit 1b18379

Please sign in to comment.