We need to protect access to the param_values array. This is dynamically
allocated and resized (utarray_reserve() calls realloc). If some thread
was iterating the array while another was resizing the array, the first one
would iterate on a freed array, thus accessing invalid memory.
On NuttX this could lead to hardfaults in rare conditions.
Unfortunately we need to initialize the semaphore on startup, by calling
sem_init(). This adds a param_init() method called by every board/config
that uses the params (at least I think I've found all of them)
We buffer the mavlink messages and don't forward them directly
via uORB. This solves an issue where many requests are dropped and
QGC does not start properly in combination with UAVCAN devices.
* If you move in LAND, AUTO or HOLD the sticks the system will give control back to the pilot
* If you do not connect any RC the system will default to HOLD and will allow you tablet control
* If you gain position lock for the first time the system will re-evaluate the mode switch (so if you dropped down to alt hold it will now go into position)
* If the system breaches the Geofence it will now always drop back to POSCTRL if the sticks are moved
We may need to change the baud rate from one version to the other.
Allowing the script to try multiple baud rates makes the transition a
little bit less painful.
This also fixes a bug in which it would go the next port before trying
to identify the board after asking it to reboot.
Since using more than 256 mission items has been tested and fixed, the
limit can now be raised to more than 256 (but smaller than UINT16_MAX).
Since the whole file is allocated in advance on NuttX, the limit there
is (arbitrarily) set to 2000. For POSIX archs such as SITL, we don't
really need to constrain ourselves any longer.