Skip to content

Commit

Permalink
gimbal: only reset protocol on destruction (#2283)
Browse files Browse the repository at this point in the history
Don't destruct the found protocol on each discovery. Otherwise, we lose
all subscriptions when a timeout occurs.

Longer term, we'll probably just want to remove the v1 logic to simplify
this.

Signed-off-by: Julian Oes <julian@oes.ch>
  • Loading branch information
julianoes committed Apr 16, 2024
1 parent a041ea4 commit f074901
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/mavsdk/plugins/gimbal/gimbal_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ void GimbalImpl::init()
this);
}

void GimbalImpl::deinit() {}
void GimbalImpl::deinit()
{
_gimbal_protocol.reset(nullptr);
_system_impl->unregister_all_mavlink_message_handlers(this);
}

void GimbalImpl::enable()
{
Expand All @@ -50,7 +54,7 @@ void GimbalImpl::enable()

void GimbalImpl::disable()
{
_gimbal_protocol.reset(nullptr);
_system_impl->unregister_timeout_handler(_protocol_cookie);
}

void GimbalImpl::receive_protocol_timeout()
Expand Down

0 comments on commit f074901

Please sign in to comment.