Browse Source

mavlink: Do not miss a vehicle_command

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().
sbg
José Roberto de Souza 8 years ago committed by Lorenz Meier
parent
commit
66170d1c01
  1. 2
      src/modules/mavlink/mavlink_messages.cpp

2
src/modules/mavlink/mavlink_messages.cpp

@ -461,7 +461,7 @@ protected: @@ -461,7 +461,7 @@ protected:
struct vehicle_command_s cmd;
bool sent = false;
if (_cmd_sub->update(&_cmd_time, &cmd)) {
if (_cmd_sub->update_if_changed(&cmd)) {
if (!cmd.from_external) {
if (_mavlink->verbose()) {

Loading…
Cancel
Save