Plane: Soaring, make zero SOAR_MAX_RADIUS always RTL, and -1 never.

This commit is contained in:
Samuel Tabor 2019-06-18 03:44:32 +01:00 committed by Andrew Tridgell
parent 75f772b269
commit 5963164a22

View File

@ -81,7 +81,7 @@ void Plane::update_soaring() {
Vector3f position; Vector3f position;
if (!ahrs.get_relative_position_NED_home(position)) { if (!ahrs.get_relative_position_NED_home(position)) {
return; return;
} else if (g2.soaring_controller.max_radius > 0 && } else if (g2.soaring_controller.max_radius >= 0 &&
powf(position.x,2)+powf(position.y,2) > powf(g2.soaring_controller.max_radius,2) && powf(position.x,2)+powf(position.y,2) > powf(g2.soaring_controller.max_radius,2) &&
previous_mode->mode_number()!=Mode::Number::AUTO) { previous_mode->mode_number()!=Mode::Number::AUTO) {
// Some other loiter status, and outside of maximum soaring radius, and previous mode wasn't AUTO // Some other loiter status, and outside of maximum soaring radius, and previous mode wasn't AUTO