There is a race with the cleanup thread. While thin, it only has to
happen once. After this patch the race would have to happen... a lot.
Co-authored-by: jasclarke308 <jasclarke308@gmail.com>
In the case that you:
- have previously done a successful SmartRTL flight
- get a mid-air gcs failsafe and enter SmartRTL
- recover from that gcs failsafe but remain in SmartRTL
- get another mid-air failsafe
then without this patch you will enter LAND mode.
When determining our failsafe action, we were looking at whether we
should just continue landing. To do that, we ask the current mode if we
are landing. Problem is that SmartRTL was handing back the wrong answer
- it was handing back ModeRTL's answer rather than its own, and
ModeRTL's answer was "yes, I'm landing", as that's the last state that
step 1 in the above list leaves that mode in.
This patch simply hands back the correct answer for, "am I landing"
Fixes this compiler error:
In file included from ../../ArduCopter/sensors.cpp:1:
In file included from ../../ArduCopter/Copter.h:195:
../../ArduCopter/mode.h:1291:9: fatal error: declaration shadows a variable in the global namespace [-Wshadow]
AUTO, // after A and B defined, pilot toggle the switch from one side to the other, vehicle flies autonomously
^
../../ArduCopter/defines.h:38:5: note: previous declaration is here
AUTO = 3, // fully automatic waypoint control using mission commands
^
1 error generated.
This makes us look like Rover and Plane in terms of namespacing for the
Mode classes, and removes a wart where we #include mode.h in the middle
of the Mode class.
This was done mechanically for the most part.
I've had to remove the convenience reference for ap as part of this.