mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-23 09:08:30 -04:00
Fixed Scaling bug in Sonar mixing
This commit is contained in:
parent
55055fca2b
commit
1ecca36dd0
@ -1955,9 +1955,8 @@ static void update_altitude()
|
||||
sonar_alt = (float)sonar_alt * temp;
|
||||
#endif
|
||||
|
||||
scale = (sonar_alt - 400) / 200;
|
||||
scale = constrain(scale, 0, 1);
|
||||
|
||||
scale = (float)(sonar_alt - 400) / 200.0;
|
||||
scale = constrain(scale, 0.0, 1.0);
|
||||
// solve for a blended altitude
|
||||
current_loc.alt = ((float)sonar_alt * (1.0 - scale)) + ((float)baro_alt * scale) + home.alt;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user