mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-24 16:55:36 +03:00
always set offset when not armed. OSD should never show > 0 values when not armed
This commit is contained in:
parent
7936fb07d5
commit
8a9869b4fd
1 changed files with 2 additions and 5 deletions
|
@ -49,7 +49,6 @@ void calculateEstimatedAltitude(timeUs_t currentTimeUs)
|
|||
static timeUs_t previousTimeUs = 0;
|
||||
static int32_t baroAltOffset = 0;
|
||||
static int32_t gpsAltOffset = 0;
|
||||
static bool altitudeOffsetSet = false;
|
||||
|
||||
const uint32_t dTime = currentTimeUs - previousTimeUs;
|
||||
if (dTime < BARO_UPDATE_FREQUENCY_40HZ) {
|
||||
|
@ -87,13 +86,11 @@ if (sensors(SENSOR_GPS) && STATE(GPS_FIX)) {
|
|||
}
|
||||
#endif
|
||||
|
||||
if (ARMING_FLAG(ARMED) && !altitudeOffsetSet) {
|
||||
if (!ARMING_FLAG(ARMED)) {
|
||||
baroAltOffset = baroAlt;
|
||||
gpsAltOffset = gpsAlt;
|
||||
altitudeOffsetSet = true;
|
||||
} else if (!ARMING_FLAG(ARMED) && altitudeOffsetSet) {
|
||||
altitudeOffsetSet = false;
|
||||
}
|
||||
|
||||
baroAlt -= baroAltOffset;
|
||||
gpsAlt -= gpsAltOffset;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue