Fixed Scaling bug in Sonar mixing

This commit is contained in:
Jason Short 2012-03-16 13:32:18 -07:00
parent 55055fca2b
commit 1ecca36dd0

View File

@ -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;