Copter does not go into RTL in Auto mission

Hi,

Lately my quad is acting weird when I end my mission with RTL. When the copter is reaching that last point in the mission, the copter acts as though it is on RTL mode (going back to home and lands), but it is still in auto mode.
Normally this wouldn’t matter, but I’m using a sensor that is running only when in Auto and shouldn’t operate in RTL.

The problem replicates in several missions and in several locations.
Log of this flight is attached, and a example mission that has this issue.

Waypoints File:
TestMission.3ds (Change to txt) (1.2 KB)

Log File (From today, but on a different mission than what I’ve attached):

On the code side: rtl_init() checks the EKF position - Which looks okay from the log. Other than that I couldn’t find anything that could stop the quad from going into RTL mode.
IMPORTANT NOTE: This version is has some changes over the 3.3.3 code - Although as far as I checked there isn’t any change that should affect the RTL mode.

What could cause the quad to not go into RTL?
(I’m not saying my code hasn’t caused a problem in RTL, but I’d appricate some pointers as of to where should I search for problems.)

Thanks
Nitay

are you saying you command RTL, and the vehicle comes home but the mode never changes out of auto? Or are you saying the last command in your mission is to RTL?

uh, I think both?

The last command in the mission is RTL.
When the quad reaches the last command it comes back home and lands, but the mode does not switch to RTL - Stays on Auto.

If I switch to RTL manually (either through RC or through Mission Planner) the quad changes mode to RTL.

Also, if I let the quad to start landing (on the last command in the mission) and then switch to RTL manually - The quad goes back up to RTL height, and starts landing again.

Nothing to be worried, because even the copter performs RTL at the end of an AUTO mission, it shows the mode as AUTO