Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GCS_MAVLink: don't learn a route to the broadcast component #14620

Merged
merged 2 commits into from Oct 21, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 16 additions & 4 deletions libraries/GCS_MAVLink/MAVLink_routing.cpp
Expand Up @@ -177,7 +177,8 @@ bool MAVLink_routing::check_and_forward(mavlink_channel_t in_channel, const mavl
}
}

if (!forwarded && match_system) {
if ((!forwarded && match_system) ||
broadcast_system) {
process_locally = true;
}

Expand Down Expand Up @@ -266,9 +267,20 @@ bool MAVLink_routing::find_by_mavtype(uint8_t mavtype, uint8_t &sysid, uint8_t &
void MAVLink_routing::learn_route(mavlink_channel_t in_channel, const mavlink_message_t &msg)
{
uint8_t i;
if (msg.sysid == 0 ||
(msg.sysid == mavlink_system.sysid &&
msg.compid == mavlink_system.compid)) {
if (msg.sysid == 0) {
// don't learn routes to the broadcast system
return;
}
if (msg.sysid == mavlink_system.sysid &&
msg.compid == mavlink_system.compid) {
// don't learn routes to ourself. We know where we are.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be funnier with "We know who we are" :)

return;
}
if (msg.sysid == mavlink_system.sysid &&
msg.compid == MAV_COMP_ID_ALL) {
// don't learn routes to the broadcast component ID for our
// own system id. We should still broadcast these, but we
// should also process them locally.
return;
}
for (i=0; i<num_routes; i++) {
Expand Down