Skip to content

Commit

Permalink
Merge pull request #2194 from mavlink/pr-backport-fix-target-check
Browse files Browse the repository at this point in the history
[BACKPORT v1.4] core: fix component ID check
  • Loading branch information
JonasVautherin authored Dec 16, 2023
2 parents 15d4cd9 + 974217b commit b87a21d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/mavsdk/core/mavsdk_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,9 @@ bool MavsdkImpl::send_message(mavlink_message_t& message)
{
if (_message_logging_on) {
LogDebug() << "Sending message " << message.msgid << " from "
<< static_cast<int>(message.sysid) << "/" << static_cast<int>(message.compid);
<< static_cast<int>(message.sysid) << "/" << static_cast<int>(message.compid)
<< " to " << static_cast<int>(get_target_system_id(message)) << "/"
<< static_cast<int>(get_target_component_id(message));
}

std::lock_guard<std::mutex> lock(_connections_mutex);
Expand Down Expand Up @@ -672,7 +674,7 @@ uint8_t MavsdkImpl::get_target_component_id(const mavlink_message_t& message)
return 0;
}

return (_MAV_PAYLOAD(&message))[meta->target_system_ofs];
return (_MAV_PAYLOAD(&message))[meta->target_component_ofs];
}

void MavsdkImpl::set_base_mode(uint8_t base_mode)
Expand Down

0 comments on commit b87a21d

Please sign in to comment.