mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-26 01:35:41 +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 timeUs_t previousTimeUs = 0;
|
||||||
static int32_t baroAltOffset = 0;
|
static int32_t baroAltOffset = 0;
|
||||||
static int32_t gpsAltOffset = 0;
|
static int32_t gpsAltOffset = 0;
|
||||||
static bool altitudeOffsetSet = false;
|
|
||||||
|
|
||||||
const uint32_t dTime = currentTimeUs - previousTimeUs;
|
const uint32_t dTime = currentTimeUs - previousTimeUs;
|
||||||
if (dTime < BARO_UPDATE_FREQUENCY_40HZ) {
|
if (dTime < BARO_UPDATE_FREQUENCY_40HZ) {
|
||||||
|
@ -87,13 +86,11 @@ if (sensors(SENSOR_GPS) && STATE(GPS_FIX)) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (ARMING_FLAG(ARMED) && !altitudeOffsetSet) {
|
if (!ARMING_FLAG(ARMED)) {
|
||||||
baroAltOffset = baroAlt;
|
baroAltOffset = baroAlt;
|
||||||
gpsAltOffset = gpsAlt;
|
gpsAltOffset = gpsAlt;
|
||||||
altitudeOffsetSet = true;
|
|
||||||
} else if (!ARMING_FLAG(ARMED) && altitudeOffsetSet) {
|
|
||||||
altitudeOffsetSet = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
baroAlt -= baroAltOffset;
|
baroAlt -= baroAltOffset;
|
||||||
gpsAlt -= gpsAltOffset;
|
gpsAlt -= gpsAltOffset;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue