Skip to content

Commit

Permalink
Fix system discovery
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasVautherin committed May 17, 2022
1 parent bb6941d commit 2137ee0
Showing 1 changed file with 3 additions and 6 deletions.
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

0 comments on commit 2137ee0

Please sign in to comment.