From 2c5b8a94911d31b533af4faf82b60d0cc47601e4 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Fri, 29 May 2020 12:03:22 +0200 Subject: [PATCH] mavlink: handle stream not updated Our answer does not just depend on whether the stream was found but whether we actually were able to send out an update. --- src/modules/mavlink/mavlink_receiver.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/modules/mavlink/mavlink_receiver.cpp b/src/modules/mavlink/mavlink_receiver.cpp index a171b2bfb4..6320261ad0 100644 --- a/src/modules/mavlink/mavlink_receiver.cpp +++ b/src/modules/mavlink/mavlink_receiver.cpp @@ -516,10 +516,12 @@ uint8_t MavlinkReceiver::handle_request_message_command(uint16_t message_id, flo float param5, float param6, float param7) { bool stream_found = false; + bool message_sent = false; for (const auto &stream : _mavlink->get_streams()) { if (stream->get_id() == message_id) { - stream_found = stream->request_message(param2, param3, param4, param5, param6, param7); + stream_found = true; + message_sent = stream->request_message(param2, param3, param4, param5, param6, param7); break; } } @@ -534,14 +536,14 @@ uint8_t MavlinkReceiver::handle_request_message_command(uint16_t message_id, flo // Now we try again to send it. for (const auto &stream : _mavlink->get_streams()) { if (stream->get_id() == message_id) { - stream_found = stream->request_message(param2, param3, param4, param5, param6, param7); + message_sent = stream->request_message(param2, param3, param4, param5, param6, param7); break; } } } } - return (stream_found ? vehicle_command_ack_s::VEHICLE_RESULT_ACCEPTED : vehicle_command_ack_s::VEHICLE_RESULT_DENIED); + return (message_sent ? vehicle_command_ack_s::VEHICLE_RESULT_ACCEPTED : vehicle_command_ack_s::VEHICLE_RESULT_DENIED); }