From 66170d1c010df69807b053eb7f4aed7fee749da8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Roberto=20de=20Souza?= Date: Thu, 13 Jul 2017 16:37:28 -0700 Subject: [PATCH] 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(). --- src/modules/mavlink/mavlink_messages.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/mavlink/mavlink_messages.cpp b/src/modules/mavlink/mavlink_messages.cpp index eef12c3e87..7da967948d 100644 --- a/src/modules/mavlink/mavlink_messages.cpp +++ b/src/modules/mavlink/mavlink_messages.cpp @@ -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()) {