Plane: prevent mode switch changes changing WP tracking

this fixes a bug where a mode switch change during an AUTO mission
which does not change the flight mode would cause cross tracking to be
reset, so the plane will not correctly follow the desired track

Many thanks to Michael Du Breuil for the log that showed this bug
This commit is contained in:
Andrew Tridgell 2015-08-12 14:42:28 +10:00 committed by Randy Mackay
parent 587a38b42a
commit 5da21d2bb2
2 changed files with 3 additions and 1 deletions

View File

@ -44,7 +44,6 @@ void Plane::read_control_switch()
set_mode((enum FlightMode)(flight_modes[switchPosition].get())); set_mode((enum FlightMode)(flight_modes[switchPosition].get()));
oldSwitchPosition = switchPosition; oldSwitchPosition = switchPosition;
prev_WP_loc = current_loc;
} }
if (g.reset_mission_chan != 0 && if (g.reset_mission_chan != 0 &&

View File

@ -363,6 +363,9 @@ void Plane::set_mode(enum FlightMode mode)
// disable taildrag takeoff on mode change // disable taildrag takeoff on mode change
auto_state.fbwa_tdrag_takeoff_mode = false; auto_state.fbwa_tdrag_takeoff_mode = false;
// start with previous WP at current location
prev_WP_loc = current_loc;
switch(control_mode) switch(control_mode)
{ {
case INITIALISING: case INITIALISING: