revert position.c changes

This commit is contained in:
s0up 2018-06-07 13:34:12 -07:00
parent 96692af0f8
commit 1b1837905c
1 changed files with 6 additions and 4 deletions

View File

@ -86,13 +86,15 @@ if (sensors(SENSOR_GPS) && STATE(GPS_FIX)) {
} }
#endif #endif
if (!ARMING_FLAG(ARMED)) { if (ARMING_FLAG(ARMED) && !altitudeOffsetSet) {
baroAltOffset = baroAlt; baroAltOffset = baroAlt;
gpsAltOffset = gpsAlt; gpsAltOffset = gpsAlt;
} else { altitudeOffsetSet = true;
} else if (!ARMING_FLAG(ARMED) && altitudeOffsetSet) {
altitudeOffsetSet = false;
}
baroAlt -= baroAltOffset; baroAlt -= baroAltOffset;
gpsAlt -= gpsAltOffset; gpsAlt -= gpsAltOffset;
}
if (haveGpsAlt && haveBaroAlt) { if (haveGpsAlt && haveBaroAlt) {
estimatedAltitude = gpsAlt * gpsTrust + baroAlt * (1 - gpsTrust); estimatedAltitude = gpsAlt * gpsTrust + baroAlt * (1 - gpsTrust);