The EKF failsafe now captures all failures that could lead to a bad
position including GPS glitches and a bad compass meaning we do not need
this protection in the main flight code.
When throttle/radio failsafe or battery failsafe are triggered, the
vehicle will disarm if it is landed even if the throttle is not at zero.
Auto mode will disarm if landed and mission has not started. This
ensures that the vehicle does not disarm during a mission land command
that appears mid way through a mission.
This resolves issue #880 in which if a GPS failsafe occurred while the
vehicle was already in LAND mode, the LAND would continue to be GPS
controlled LAND instead of pilot-controlled LAND
FS_GPS_ENABLE parameter accepts two new options, 2=AltHold,
3=LandEvenFromStabilize.
If set to 3 the GPS failsafe will trigger and LAND even from manual
flight modes like Stabilize and ACRO. This is useful for users who want
to ensure their copters can never stray outside the circular fence (the
fence only triggers when it knows it is outside the bounds, and it can't
know this if it has no GPS)
Removed redundant checks to GPS_ok before setting flight mode to RTL
(this check is already performed inside the set_mode function)
Removed reset of home distance and bearing when GPS lock is lost, it now
remains at the last known value
Previously if set_mode failed it would return the copter to stabilize
mode. With this commit set_mode returns a true/false indicating whether
it succeeded or not so the caller can make the decision as to the
appropriate response which could be to stay in the current flight mode
or try another flight mode.
This effectively means that an RTL kicked off by a failsafe will
immediately switch to LAND mode only if within 2 meters. Previously the
radius was much wider (15m).
Failsafe events changed to errors so they are more obvious.
Errors recorded to dataflash for failure to init compass and optical flow sensor.
Errors recorded for pwm failure.
Resolved a compile error when dataflash logging is disabled.