When switched to RTL copter started to fly away instead back to home

Hello
today I had some time to go and test my copter but got very bad results:
After some time in air, when copter already had 3DFix and successful test of PosHold I flu around 30 meters away from start position and tried switch to RTL. What surprise then happened - instead of yawing back to home position it turned completely opposite and started to flying away. When looking into goggles on OSD I could see the Home-arrow direction is streight down (means “Go Back” when want to return home) but the copter was still flying away. I never had such experience with RTL and it scared me a bit :thinking:
I had to switch back and manually fly back to home. I tested it 2 or 3 times always with the same result.
Looked into log, but didn’t find any clue. Note:
Copter is loaded with last stable SW (4.0.7), already calibrated (compass, accelerators) and auto-tuned.

Here is the log-file
I somebody has hints on it I would appreciate the help.

I can’t take a look at your logs right now, I will do in some hours, but meanwhile I want to ask:
Did you arm the copter before it got 3D lock? If so, don’t so that!! That will not set the home point and it will get confused!

Yes it was so - I did arm not having 3dFix yet as I recall it now. PosHold started to work some time after I was already flying. Anyway I was flying still around me and I thought when it gets 3d Fix in the air then the home position is right at the place where it was right in the moment. And that place had to be close to me, not that far the copter was trying to fly to. Moreover on OSD when switched to RTL I saw the direction to home and this arrow was pointing completely opposite direction that the copter was flying. From this I assume the home position was really set next to me but the copter moved away :open_mouth:
Could I extract somehow the HomePos from the log file?