From d4ad655f4bc519cb4f455999f84ff216e9cd28f8 Mon Sep 17 00:00:00 2001 From: Federico Magri Date: Fri, 28 Aug 2026 14:25:42 +0200 Subject: [PATCH] feat(CAN):Add option to center the UAVCAN servo (#28423) --- src/drivers/uavcan/module.yaml | 1 + src/lib/mixer_module/mixer_module.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/drivers/uavcan/module.yaml b/src/drivers/uavcan/module.yaml index 664146ccbf3..f64b1d95d51 100644 --- a/src/drivers/uavcan/module.yaml +++ b/src/drivers/uavcan/module.yaml @@ -114,6 +114,7 @@ actuator_output: standard_params: disarmed: { min: 0, max: 1000, default: 500 } min: { min: 0, max: 1000, default: 0 } + center: { min: 0, max: 1000 } max: { min: 0, max: 1000, default: 1000 } failsafe: { min: 0, max: 1000 } num_channels: *max_num_uavcan_servos diff --git a/src/lib/mixer_module/mixer_module.cpp b/src/lib/mixer_module/mixer_module.cpp index d353cd2e91e..086cded5fa2 100644 --- a/src/lib/mixer_module/mixer_module.cpp +++ b/src/lib/mixer_module/mixer_module.cpp @@ -555,8 +555,8 @@ float MixingOutput::output_limit_calc_single(int i, float value) const || (_function_assignment[i] >= OutputFunction::Gimbal_Roll && _function_assignment[i] <= OutputFunction::Gimbal_Yaw)) && _param_handles[i].center != PARAM_INVALID - && _center_value[i] >= 800 - && _center_value[i] <= 2200) { + && _center_value[i] >= _min_value[i] + && _center_value[i] <= _max_value[i]) { output = math::interpolateNXY(value, {-1.f, 0.f, 1.f}, {(float)_min_value[i], (float)_center_value[i], (float)_max_value[i]}); }