mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-03-03 04:03:59 -04:00
Copter: compassmot: use is_positive for float comparison
tridge noted on the DevCall that very, very small numbers could yield numerical errors during divisions further down
This commit is contained in:
parent
adff48c3ea
commit
709679ed60
@ -169,7 +169,7 @@ MAV_RESULT Copter::mavlink_compassmot(const GCS_MAVLINK &gcs_chan)
|
||||
current_amps_max = MAX(current_amps_max, current);
|
||||
|
||||
// if throttle is near zero, update base x,y,z values
|
||||
if (throttle_pct <= 0.0f) {
|
||||
if (!is_positive(throttle_pct)) {
|
||||
for (uint8_t i=0; i<compass.get_count(); i++) {
|
||||
compass_base[i] = compass_base[i] * 0.99f + compass.get_field(i) * 0.01f;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user