The debug messages are too verbose to be run in a production vehicle and inherently were something that should only be run in SITL / debug sessions on hardware. Switching the flag to the PX4_DEBUG() macro does not only make this more explicit, but also saves a lot of flash space that otherwise was consumed by the strings.
If 2 or more vehicle_command are queued a call to update() will
return the oldest vehicle_command and set the _cmd_time to the
timestamp of the last vehicle_command queued losing it.
Using update_if_changed() fix this causing all item being consumed
one at each call of send().
This will initialize those structs with zero in all fields not set
and all fields set will only be change once to the final value not
wasting CPU time zeroing it.
This will guarantee that no non-unitialized structs will have
a trash value on from_external causing it to be sent to the
MAVLink channel without need it.
The previous approach was checking system id and component id but it
will not work in 100% of cases as external devices can send MAVLink
message with the right system id but with broadcast component id.
The message handling was not obeying action focused messages and high-rate messages properly before. With this change update rates track the desired rates closely. Critical high-rate messages such as ADS-B are queued additionally to guarantee that all received packets are being correctly forwarded.
- change/add a few printfs so they make more sense
- don't accidentally ignore command_acks
- don't forward commands to the same component id, and don't forward
commands that are broadcast to all components (target component 0)
This adds a class to allow for retransmission of outgoing commands.
The sent commands are kept in a timestamped list to check if they are
acked as required by the mavlink protocol.
If they are not acked within a timeout, they can be retransmitted.
The MAVLink app was logging the status to a file on the SD card, however, this has been integrated into the ulog format since. Having these in multiple locations is unnecessarily confusing to the user and induces load to the system.
_global_pos_sub->update(&_global_pos_time, &global_pos); could return
false and in that case global_pos was not set but still accessed.
This is prevented by checking if timestamp == 0.