mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-26 01:35:41 +03:00
Bugfix: Vario GPS and 3D Total Distance overflow
This commit is contained in:
parent
2553a4a1f9
commit
1406b068e2
1 changed files with 2 additions and 3 deletions
|
@ -1281,7 +1281,7 @@ void GPS_calc_longitude_scaling(int32_t lat)
|
||||||
static void GPS_calculateDistanceFlownVerticalSpeed(bool initialize)
|
static void GPS_calculateDistanceFlownVerticalSpeed(bool initialize)
|
||||||
{
|
{
|
||||||
static int32_t lastCoord[2] = { 0, 0 };
|
static int32_t lastCoord[2] = { 0, 0 };
|
||||||
static int16_t lastAlt;
|
static int32_t lastAlt;
|
||||||
static int32_t lastMillis;
|
static int32_t lastMillis;
|
||||||
|
|
||||||
int currentMillis = millis();
|
int currentMillis = millis();
|
||||||
|
@ -1303,9 +1303,8 @@ static void GPS_calculateDistanceFlownVerticalSpeed(bool initialize)
|
||||||
GPS_distanceFlownInCm += dist;
|
GPS_distanceFlownInCm += dist;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GPS_verticalSpeedInCmS = (gpsSol.llh.altCm - lastAlt) * 1000 / (currentMillis - lastMillis);
|
GPS_verticalSpeedInCmS = (gpsSol.llh.altCm - lastAlt) * 1000 / (currentMillis - lastMillis);
|
||||||
GPS_verticalSpeedInCmS = constrain(GPS_verticalSpeedInCmS, -1500.0f, 1500.0f);
|
GPS_verticalSpeedInCmS = constrain(GPS_verticalSpeedInCmS, -1500, 1500);
|
||||||
}
|
}
|
||||||
lastCoord[LON] = gpsSol.llh.lon;
|
lastCoord[LON] = gpsSol.llh.lon;
|
||||||
lastCoord[LAT] = gpsSol.llh.lat;
|
lastCoord[LAT] = gpsSol.llh.lat;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue