Plane: fixed fence return point on breach

this was broken by the recent guided mode changes. Thanks to Grant for
noticing!
This commit is contained in:
Andrew Tridgell 2015-05-24 15:23:44 +10:00
parent 8f5c663463
commit 5511140f95

View File

@ -374,6 +374,12 @@ void Plane::geofence_check(bool altitude_check_only)
case FENCE_ACTION_GUIDED:
case FENCE_ACTION_GUIDED_THR_PASS:
// make sure we don't auto trim the surfaces on this mode change
int8_t saved_auto_trim = g.auto_trim;
g.auto_trim.set(0);
set_mode(GUIDED);
g.auto_trim.set(saved_auto_trim);
if (g.fence_ret_rally != 0) { //return to a rally point
guided_WP_loc = rally.calc_best_rally_or_home_location(current_loc, get_RTL_altitude());
@ -401,13 +407,6 @@ void Plane::geofence_check(bool altitude_check_only)
set_guided_WP();
// make sure we don't auto trim the surfaces on this mode change
int8_t saved_auto_trim = g.auto_trim;
g.auto_trim.set(0);
set_mode(GUIDED);
g.auto_trim.set(saved_auto_trim);
if (g.fence_action == FENCE_ACTION_GUIDED_THR_PASS) {
guided_throttle_passthru = true;
}