The result from `!get_freefall_state()` was always true because
`get_freefall_state()` is already called before `get_landed_state()` is
called. Only if we're not in a freefall, we check if we are landed.
The hysteresis was not properly implemented in the land detector and is
therefore replaced by the library call, both for the freefall detector
and the land detector.
There have been two cases where a hysteresis function wasn't working
correctly. It is therefore a good idea to abstract the hysteresis
functionality into a library.
The override checking was scattered across two places and is now unified
in controls_tick(). The part in mixer_tick only decides which mixer (or
none) to use give the override flag.
This fixes a bug where multirotors got into override mode when the FMU
is dead/not responding.
The main bug was that the check was for FMU_OK || MANUAL_OVERRIDE_OK
in order to get further in the override checks.
Also a mixer_tick was called inside the controls_tick even though these
are called in px4io.c after each other anyway.
* logger: prevent logpath buffer overflows
The handling of the log path had the potential to cause buffer
overflows, especially on POSIX platforms where the paths are often much
longer than just 64 chars.
* sdlog2: prevent logpath buffer overflows
When the log folder path was created, this was done with the unsafe
sprintf function instead of snprintf. This caused buffer overflows in
SITL but the overflow was usually not detected until recent testing of
some work in progress.
- attitude setpoint generation for stabilized mode was shifted back
to the fw attitude controller. since the fw position controller is polling
on global position attitude setpoints were not generated when global
position was not published.
Signed-off-by: Roman <bapstroman@gmail.com>