Skip to content

Commit

Permalink
src: mavlink: Add a filter by source component ID.
Browse files Browse the repository at this point in the history
  • Loading branch information
joaoantoniocardoso committed Mar 14, 2024
1 parent ee56ae7 commit c17f5e2
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/mavlink/manager.rs
Expand Up @@ -104,6 +104,19 @@ impl Manager {

trace!("Message received: {header:?}, {message:?}");

// Early filter non-GCS messages to avoid passing unwanted ones to the camera componenets.
let allowed_component_ids = [
mavlink::common::MavComponent::MAV_COMP_ID_ALL as u8,
mavlink::common::MavComponent::MAV_COMP_ID_SYSTEM_CONTROL as u8,
mavlink::common::MavComponent::MAV_COMP_ID_MISSIONPLANNER as u8,
];
if !allowed_component_ids.contains(&header.component_id) {
trace!("Message dropped: {header:?}, {message:?}");
continue;
}

debug!("Message accepted: {header:?}, {message:?}");

// Send the received message to the cameras
if let Err(error) = inner_guard
.sender
Expand Down

0 comments on commit c17f5e2

Please sign in to comment.