diff --git a/ArduPlane/takeoff.cpp b/ArduPlane/takeoff.cpp index 3f18b405ae..740daeaf05 100644 --- a/ArduPlane/takeoff.cpp +++ b/ArduPlane/takeoff.cpp @@ -25,11 +25,13 @@ bool Plane::auto_takeoff_check(void) // Reset states if process has been interrupted, except initial_direction.initialized if set #if MODE_AUTOLAND_ENABLED bool takeoff_dir_initialized = takeoff_state.initial_direction.initialized; + float takeoff_dir = takeoff_state.initial_direction.heading; #endif if (takeoff_state.last_check_ms && (now - takeoff_state.last_check_ms) > 200) { memset(&takeoff_state, 0, sizeof(takeoff_state)); #if MODE_AUTOLAND_ENABLED takeoff_state.initial_direction.initialized = takeoff_dir_initialized; //restore dir init state + takeoff_state.initial_direction.heading = takeoff_dir; #endif return false; }