mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 14:38:30 -04:00
AP_Math: fixed build error on PX4
variable set but not used with recent longitude_scale change
This commit is contained in:
parent
099392d3ca
commit
8f41d97548
@ -35,9 +35,9 @@
|
|||||||
|
|
||||||
float longitude_scale(const struct Location &loc)
|
float longitude_scale(const struct Location &loc)
|
||||||
{
|
{
|
||||||
|
#if HAL_CPU_CLASS < HAL_CPU_CLASS_150
|
||||||
static int32_t last_lat;
|
static int32_t last_lat;
|
||||||
static float scale = 1.0;
|
static float scale = 1.0;
|
||||||
#if HAL_CPU_CLASS < HAL_CPU_CLASS_150
|
|
||||||
// don't optimise on faster CPUs. It causes some minor errors on Replay
|
// don't optimise on faster CPUs. It causes some minor errors on Replay
|
||||||
if (labs(last_lat - loc.lat) < 100000) {
|
if (labs(last_lat - loc.lat) < 100000) {
|
||||||
// we are within 0.01 degrees (about 1km) of the
|
// we are within 0.01 degrees (about 1km) of the
|
||||||
@ -45,11 +45,14 @@ float longitude_scale(const struct Location &loc)
|
|||||||
// the same scale factor.
|
// the same scale factor.
|
||||||
return scale;
|
return scale;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
scale = cosf(loc.lat * 1.0e-7f * DEG_TO_RAD);
|
scale = cosf(loc.lat * 1.0e-7f * DEG_TO_RAD);
|
||||||
scale = constrain_float(scale, 0.01f, 1.0f);
|
scale = constrain_float(scale, 0.01f, 1.0f);
|
||||||
last_lat = loc.lat;
|
last_lat = loc.lat;
|
||||||
return scale;
|
return scale;
|
||||||
|
#else
|
||||||
|
float scale = cosf(loc.lat * 1.0e-7f * DEG_TO_RAD);
|
||||||
|
return constrain_float(scale, 0.01f, 1.0f);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user