From 19bca47b9ea81a762a3ff01e43685052d150ac56 Mon Sep 17 00:00:00 2001 From: Michael Schaeuble Date: Fri, 18 Nov 2022 17:40:30 +0100 Subject: [PATCH] Preserve gimbal control when receiving updates from an input that is not active The update function of InputMavlinkGimbalV2 returns UpdatedNotActive when receiving control commands from a system or component that doesn't match the primary control. This can happen if a component just sends commands without being in control or when transitioning to a different primary control. If the input is marked as already_active, it will reset last_input_active which in turn resets the primary control in the next iteration. According to the MAVLink gimbal protocol v2, a component needs to send MAV_CMD_DO_GIMBAL_MANAGER_CONFIGURE to start controlling the gimbal and to remove control. However, with the current implementation there are several other commands that would reset the primary control. With this PR, the primary control remains with the component that requested it last if updates from a not active component are received. --- src/modules/gimbal/gimbal.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/modules/gimbal/gimbal.cpp b/src/modules/gimbal/gimbal.cpp index c0666018a6..7f194c0436 100644 --- a/src/modules/gimbal/gimbal.cpp +++ b/src/modules/gimbal/gimbal.cpp @@ -250,11 +250,7 @@ static int gimbal_thread_main(int argc, char *argv[]) break; case InputBase::UpdateResult::UpdatedNotActive: - if (already_active) { - // No longer active - thread_data.last_input_active = -1; - } - + // Ignore, input not active break; }