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

Fix system discovery #1774

Merged
merged 1 commit into from
May 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions src/mavsdk/core/mavsdk_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,13 +300,10 @@ void MavsdkImpl::receive_message(mavlink_message_t& message, Connection* connect

std::lock_guard<std::recursive_mutex> lock(_systems_mutex);

// The only situation where we create a system with sysid 0 is when we initialize the connection
// to the remote.
// If we have a system with sysid 0, it is the "fake" system we built to initialize the
// connection to the remote. We can remove it now that a remote system is discovered.
if (_systems.size() == 1 && _systems[0].first == 0) {
LogDebug() << "New: System ID: " << static_cast<int>(message.sysid)
<< " Comp ID: " << static_cast<int>(message.compid);
_systems[0].first = message.sysid;
_systems[0].second->system_impl()->set_system_id(message.sysid);
_systems.clear();
}

bool found_system = false;
Expand Down