Skip to content

Commit

Permalink
Mavlink: Fix forwarding of messages with target system/component id
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Owen <maowen801@gmail.com>
  • Loading branch information
maowen committed Jul 25, 2019
1 parent 71613ac commit 62bfd6c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/modules/mavlink/mavlink_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -441,12 +441,12 @@ Mavlink::forward_message(const mavlink_message_t *msg, Mavlink *self)
// might be nullptr if message is unknown
if (meta) {
// Extract target system and target component if set
if (meta->target_system_ofs != 0) {
target_system_id = ((uint8_t *)msg)[meta->target_system_ofs];
if (meta->flags & MAV_MSG_ENTRY_FLAG_HAVE_TARGET_SYSTEM) {
target_system_id = (_MAV_PAYLOAD(msg))[meta->target_system_ofs];
}

if (meta->target_component_ofs != 0) {
target_component_id = ((uint8_t *)msg)[meta->target_component_ofs];
if (meta->flags & MAV_MSG_ENTRY_FLAG_HAVE_TARGET_COMPONENT) {
target_component_id = (_MAV_PAYLOAD(msg))[meta->target_component_ofs];
}
}

Expand Down

0 comments on commit 62bfd6c

Please sign in to comment.