Browse Source

Plane: use labs for int32 values

master
Randy Mackay 10 years ago committed by Andrew Tridgell
parent
commit
4bf36d787b
  1. 2
      ArduPlane/ArduPlane.cpp
  2. 4
      ArduPlane/commands_logic.cpp
  3. 2
      ArduPlane/takeoff.cpp

2
ArduPlane/ArduPlane.cpp

@ -382,7 +382,7 @@ void Plane::airspeed_ratio_update(void) @@ -382,7 +382,7 @@ void Plane::airspeed_ratio_update(void)
// never coming up again
return;
}
if (abs(ahrs.roll_sensor) > roll_limit_cd ||
if (labs(ahrs.roll_sensor) > roll_limit_cd ||
ahrs.pitch_sensor > aparm.pitch_limit_max_cd ||
ahrs.pitch_sensor < pitch_limit_min_cd) {
// don't calibrate when going beyond normal flight envelope

4
ArduPlane/commands_logic.cpp

@ -615,7 +615,7 @@ bool Plane::verify_loiter_to_alt() @@ -615,7 +615,7 @@ bool Plane::verify_loiter_to_alt()
We use 10 degrees of slop so that we can handle 100
degrees/second of yaw
*/
if (abs(heading_err_cd) <= 1000) {
if (labs(heading_err_cd) <= 1000) {
//Want to head in a straight line from _here_ to the next waypoint.
//DON'T want to head in a line from the center of the loiter to
//the next waypoint.
@ -655,7 +655,7 @@ bool Plane::verify_continue_and_change_alt() @@ -655,7 +655,7 @@ bool Plane::verify_continue_and_change_alt()
return true;
}
//don't care if we're climbing or descending
else if (abs(adjusted_altitude_cm() - next_WP_loc.alt) <= 500) {
else if (labs(adjusted_altitude_cm() - next_WP_loc.alt) <= 500) {
return true;
}

2
ArduPlane/takeoff.cpp

@ -61,7 +61,7 @@ bool Plane::auto_takeoff_check(void) @@ -61,7 +61,7 @@ bool Plane::auto_takeoff_check(void)
// Check aircraft attitude for bad launch
if (ahrs.pitch_sensor <= -3000 ||
ahrs.pitch_sensor >= 4500 ||
abs(ahrs.roll_sensor) > 3000) {
labs(ahrs.roll_sensor) > 3000) {
gcs_send_text_fmt(PSTR("Bad Launch AUTO"));
goto no_launch;
}

Loading…
Cancel
Save