From b69d582ff147d2794df9afdca8d659f46adbe68e Mon Sep 17 00:00:00 2001 From: Jacob Dahl Date: Tue, 17 Mar 2026 21:55:34 -0800 Subject: [PATCH] refactor(mavlink): convert params.c to module.yaml Convert 1 parameter file(s) from legacy C format to YAML module configuration. --- src/modules/mavlink/CMakeLists.txt | 1 + src/modules/mavlink/mavlink_params.c | 165 ------------------------ src/modules/mavlink/mavlink_params.yaml | 117 +++++++++++++++++ 3 files changed, 118 insertions(+), 165 deletions(-) delete mode 100644 src/modules/mavlink/mavlink_params.c create mode 100644 src/modules/mavlink/mavlink_params.yaml diff --git a/src/modules/mavlink/CMakeLists.txt b/src/modules/mavlink/CMakeLists.txt index 8f7c696d8b..9c2540686d 100644 --- a/src/modules/mavlink/CMakeLists.txt +++ b/src/modules/mavlink/CMakeLists.txt @@ -126,6 +126,7 @@ px4_add_module( tune_publisher.cpp MODULE_CONFIG module.yaml + mavlink_params.yaml DEPENDS adsb airspeed diff --git a/src/modules/mavlink/mavlink_params.c b/src/modules/mavlink/mavlink_params.c deleted file mode 100644 index 5386c4f080..0000000000 --- a/src/modules/mavlink/mavlink_params.c +++ /dev/null @@ -1,165 +0,0 @@ -/**************************************************************************** - * - * Copyright (c) 2012-2016 PX4 Development Team. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name PX4 nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -/** - * MAVLink system ID - * @group MAVLink - * @min 1 - * @max 250 - * @reboot_required true - */ -PARAM_DEFINE_INT32(MAV_SYS_ID, 1); - -/** - * MAVLink component ID - * @group MAVLink - * @min 1 - * @max 250 - * @reboot_required true - */ -PARAM_DEFINE_INT32(MAV_COMP_ID, 1); - -/** - * MAVLink protocol signing - * @group MAVLink - * @value 0 Message signing disabled - * @value 1 Signing enabled except on USB - * @value 2 Signing always enabled - */ -PARAM_DEFINE_INT32(MAV_SIGN_CFG, 0); - -/** - * MAVLink protocol version - * @group MAVLink - * @value 1 Version 1 with auto-upgrade to v2 if detected - * @value 2 Version 2 - */ -PARAM_DEFINE_INT32(MAV_PROTO_VER, 2); - -/** - * MAVLink SiK Radio ID - * - * When non-zero the MAVLink app will attempt to configure the - * SiK radio to this ID and re-set the parameter to 0. If the value - * is negative it will reset the complete radio config to - * factory defaults. Only applies if this mavlink instance is going through a SiK radio - * - * @group MAVLink - * @min -1 - * @max 240 - */ -PARAM_DEFINE_INT32(MAV_SIK_RADIO_ID, 0); - -/** - * MAVLink airframe type - * - * @min 0 - * @max 22 - * @value 0 Generic micro air vehicle - * @value 1 Fixed wing aircraft - * @value 2 Quadrotor - * @value 3 Coaxial helicopter - * @value 4 Normal helicopter with tail rotor - * @value 7 Airship, controlled - * @value 8 Free balloon, uncontrolled - * @value 10 Ground rover - * @value 11 Surface vessel, boat, ship - * @value 12 Submarine - * @value 13 Hexarotor - * @value 14 Octorotor - * @value 15 Tricopter - * @value 19 VTOL Two-rotor Tailsitter - * @value 20 VTOL Quad-rotor Tailsitter - * @value 21 VTOL Tiltrotor - * @value 22 VTOL Standard (separate fixed rotors for hover and cruise flight) - * @value 23 VTOL Tailsitter - * @group MAVLink - */ -PARAM_DEFINE_INT32(MAV_TYPE, 0); - -/** - * Use/Accept HIL GPS message even if not in HIL mode - * - * If set to 1 incoming HIL GPS messages are parsed. - * - * @boolean - * @group MAVLink - */ -PARAM_DEFINE_INT32(MAV_USEHILGPS, 0); - -/** - * Forward external setpoint messages - * - * If set to 1 incoming external setpoint messages will be directly forwarded - * to the controllers if in offboard control mode - * - * @boolean - * @group MAVLink - */ -PARAM_DEFINE_INT32(MAV_FWDEXTSP, 1); - -/** - * Parameter hash check. - * - * Disabling the parameter hash check functionality will make the mavlink instance - * stream parameters continuously. - * - * @boolean - * @group MAVLink - */ -PARAM_DEFINE_INT32(MAV_HASH_CHK_EN, 1); - -/** - * Heartbeat message forwarding. - * - * The mavlink heartbeat message will not be forwarded if this parameter is set to 'disabled'. - * The main reason for disabling heartbeats to be forwarded is because they confuse dronekit. - * - * @boolean - * @group MAVLink - */ -PARAM_DEFINE_INT32(MAV_HB_FORW_EN, 1); - -/** - * Timeout in seconds for the RADIO_STATUS reports coming in - * - * If the connected radio stops reporting RADIO_STATUS for a certain time, - * a warning is triggered and, if MAV_X_RADIO_CTL is enabled, the software-flow - * control is reset. - * - * @group MAVLink - * @unit s - * @min 1 - * @max 250 - */ -PARAM_DEFINE_INT32(MAV_RADIO_TOUT, 5); diff --git a/src/modules/mavlink/mavlink_params.yaml b/src/modules/mavlink/mavlink_params.yaml new file mode 100644 index 0000000000..10039647cd --- /dev/null +++ b/src/modules/mavlink/mavlink_params.yaml @@ -0,0 +1,117 @@ +module_name: mavlink +parameters: +- group: MAVLink + definitions: + MAV_SYS_ID: + description: + short: MAVLink system ID + type: int32 + default: 1 + min: 1 + max: 250 + reboot_required: true + MAV_COMP_ID: + description: + short: MAVLink component ID + type: int32 + default: 1 + min: 1 + max: 250 + reboot_required: true + MAV_SIGN_CFG: + description: + short: MAVLink protocol signing + type: enum + values: + 0: Message signing disabled + 1: Signing enabled except on USB + 2: Signing always enabled + default: 0 + MAV_PROTO_VER: + description: + short: MAVLink protocol version + type: enum + values: + 1: Version 1 with auto-upgrade to v2 if detected + 2: Version 2 + default: 2 + MAV_SIK_RADIO_ID: + description: + short: MAVLink SiK Radio ID + long: |- + When non-zero the MAVLink app will attempt to configure the + SiK radio to this ID and re-set the parameter to 0. If the value + is negative it will reset the complete radio config to + factory defaults. Only applies if this mavlink instance is going through a SiK radio + type: int32 + default: 0 + min: -1 + max: 240 + MAV_TYPE: + description: + short: MAVLink airframe type + type: enum + values: + 0: Generic micro air vehicle + 1: Fixed wing aircraft + 2: Quadrotor + 3: Coaxial helicopter + 4: Normal helicopter with tail rotor + 7: Airship, controlled + 8: Free balloon, uncontrolled + 10: Ground rover + 11: Surface vessel, boat, ship + 12: Submarine + 13: Hexarotor + 14: Octorotor + 15: Tricopter + 19: VTOL Two-rotor Tailsitter + 20: VTOL Quad-rotor Tailsitter + 21: VTOL Tiltrotor + 22: VTOL Standard (separate fixed rotors for hover and cruise flight) + 23: VTOL Tailsitter + default: 0 + min: 0 + max: 22 + MAV_USEHILGPS: + description: + short: Use/Accept HIL GPS message even if not in HIL mode + long: If set to 1 incoming HIL GPS messages are parsed. + type: boolean + default: 0 + MAV_FWDEXTSP: + description: + short: Forward external setpoint messages + long: |- + If set to 1 incoming external setpoint messages will be directly forwarded + to the controllers if in offboard control mode + type: boolean + default: 1 + MAV_HASH_CHK_EN: + description: + short: Parameter hash check + long: |- + Disabling the parameter hash check functionality will make the mavlink instance + stream parameters continuously. + type: boolean + default: 1 + MAV_HB_FORW_EN: + description: + short: Heartbeat message forwarding + long: |- + The mavlink heartbeat message will not be forwarded if this parameter is set to 'disabled'. + The main reason for disabling heartbeats to be forwarded is because they confuse dronekit. + type: boolean + default: 1 + MAV_RADIO_TOUT: + description: + short: Timeout in seconds for the RADIO_STATUS reports coming in + long: |- + If the connected radio stops reporting RADIO_STATUS for a certain time, + a warning is triggered and, if MAV_X_RADIO_CTL is enabled, the software-flow + control is reset. + type: int32 + default: 5 + unit: s + min: 1 + max: 250