From 6509e7030646fa6696935d9af1e06872a89a3ec1 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Wed, 30 Oct 2024 10:43:27 +1300 Subject: [PATCH] gimbal: fix device flags for RC gimbals --- src/modules/gimbal/output_rc.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/modules/gimbal/output_rc.cpp b/src/modules/gimbal/output_rc.cpp index 532da32c18ff..113fe71b0d51 100644 --- a/src/modules/gimbal/output_rc.cpp +++ b/src/modules/gimbal/output_rc.cpp @@ -96,10 +96,19 @@ void OutputRC::_stream_device_attitude_status() attitude_status.timestamp = hrt_absolute_time(); attitude_status.target_system = 0; attitude_status.target_component = 0; - attitude_status.device_flags = gimbal_device_attitude_status_s::DEVICE_FLAGS_NEUTRAL | - gimbal_device_attitude_status_s::DEVICE_FLAGS_ROLL_LOCK | - gimbal_device_attitude_status_s::DEVICE_FLAGS_PITCH_LOCK | - gimbal_device_attitude_status_s::DEVICE_FLAGS_YAW_LOCK; + attitude_status.device_flags = 0; + + if (_absolute_angle[0]) { + attitude_status.device_flags |= gimbal_device_attitude_status_s::DEVICE_FLAGS_ROLL_LOCK; + } + + if (_absolute_angle[1]) { + attitude_status.device_flags |= gimbal_device_attitude_status_s::DEVICE_FLAGS_PITCH_LOCK; + } + + if (_absolute_angle[2]) { + attitude_status.device_flags |= gimbal_device_attitude_status_s::DEVICE_FLAGS_YAW_LOCK; + } matrix::Eulerf euler(_angle_outputs[0], _angle_outputs[1], _angle_outputs[2]); matrix::Quatf q(euler);