Skip to content

Commit

Permalink
core/info: make version request more forgiving
Browse files Browse the repository at this point in the history
Instead of doing too many commands at once, we only do one at a time,
and don't immediately call ourselves again. We don't want to hold up the
plugins' enable() calls for too long.

Also, we can make the request interval slightly longer.

Signed-off-by: Julian Oes <julian@oes.ch>
  • Loading branch information
julianoes committed May 14, 2024
1 parent eb35c80 commit 04dff58
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/mavsdk/core/system_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -504,8 +504,8 @@ void SystemImpl::send_autopilot_version_request()

if (fut.get() == MavlinkCommandSender::Result::Unsupported) {
_old_message_520_supported = false;
LogWarn() << "Trying alternative command (512).";
send_autopilot_version_request();
LogWarn()
<< "Trying alternative command REQUEST_MESSAGE instead of REQUEST_AUTOPILOT_CAPABILITIES next.";
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/mavsdk/plugins/info/info_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void InfoImpl::enable()
{
// We're going to retry until we have the version.
_system_impl->add_call_every(
[this]() { _system_impl->send_autopilot_version_request(); }, 1.0f, &_call_every_cookie);
[this]() { _system_impl->send_autopilot_version_request(); }, 2.0f, &_call_every_cookie);

if (!_flight_info_subscriptions.empty()) {
// We're hoping to get flight information regularly to update flight time.
Expand Down

0 comments on commit 04dff58

Please sign in to comment.