From cec0eba79ffd461c08b390b4305aef7337401059 Mon Sep 17 00:00:00 2001 From: Hamish Willee Date: Thu, 30 Oct 2025 16:51:44 +1100 Subject: [PATCH] Purge PROTOCOL_VERSION --- src/modules/mavlink/mavlink_main.cpp | 16 ----- src/modules/mavlink/mavlink_main.h | 4 -- src/modules/mavlink/mavlink_messages.cpp | 4 -- src/modules/mavlink/mavlink_receiver.cpp | 4 -- .../mavlink/streams/PROTOCOL_VERSION.hpp | 63 ------------------- 5 files changed, 91 deletions(-) delete mode 100644 src/modules/mavlink/streams/PROTOCOL_VERSION.hpp diff --git a/src/modules/mavlink/mavlink_main.cpp b/src/modules/mavlink/mavlink_main.cpp index 479fa5a0a9..589856c15b 100644 --- a/src/modules/mavlink/mavlink_main.cpp +++ b/src/modules/mavlink/mavlink_main.cpp @@ -1135,22 +1135,6 @@ Mavlink::send_autopilot_capabilities() return false; } -void -Mavlink::send_protocol_version() -{ - mavlink_protocol_version_t msg = {}; - - msg.version = _protocol_version * 100; - msg.min_version = 100; - msg.max_version = 203; - uint64_t mavlink_lib_git_version_binary = px4_mavlink_lib_version_binary(); - // TODO add when available - //memcpy(&msg.spec_version_hash, &mavlink_spec_git_version_binary, sizeof(msg.spec_version_hash)); - memcpy(&msg.library_version_hash, &mavlink_lib_git_version_binary, sizeof(msg.library_version_hash)); - - mavlink_msg_protocol_version_send_struct(get_channel(), &msg); -} - int Mavlink::configure_stream(const char *stream_name, const float rate) { diff --git a/src/modules/mavlink/mavlink_main.h b/src/modules/mavlink/mavlink_main.h index cdf079f9db..cc9ab7a900 100644 --- a/src/modules/mavlink/mavlink_main.h +++ b/src/modules/mavlink/mavlink_main.h @@ -371,10 +371,6 @@ public: */ bool send_autopilot_capabilities(); - /** - * Send the protocol version of MAVLink - */ - void send_protocol_version(); List &get_streams() { return _streams; } diff --git a/src/modules/mavlink/mavlink_messages.cpp b/src/modules/mavlink/mavlink_messages.cpp index a68c138747..d6d6834586 100644 --- a/src/modules/mavlink/mavlink_messages.cpp +++ b/src/modules/mavlink/mavlink_messages.cpp @@ -108,7 +108,6 @@ #include "streams/PING.hpp" #include "streams/POSITION_TARGET_GLOBAL_INT.hpp" #include "streams/POSITION_TARGET_LOCAL_NED.hpp" -#include "streams/PROTOCOL_VERSION.hpp" #include "streams/RAW_RPM.hpp" #include "streams/RC_CHANNELS.hpp" #include "streams/SCALED_IMU.hpp" @@ -471,9 +470,6 @@ static const StreamListItem streams_list[] = { #if defined(AUTOPILOT_VERSION_HPP) create_stream_list_item(), #endif // AUTOPILOT_VERSION_HPP -#if defined(PROTOCOL_VERSION_HPP) - create_stream_list_item(), -#endif // PROTOCOL_VERSION_HPP #if defined(FLIGHT_INFORMATION_HPP) create_stream_list_item(), #endif // FLIGHT_INFORMATION_HPP diff --git a/src/modules/mavlink/mavlink_receiver.cpp b/src/modules/mavlink/mavlink_receiver.cpp index a54e425d9d..b85cc51f11 100644 --- a/src/modules/mavlink/mavlink_receiver.cpp +++ b/src/modules/mavlink/mavlink_receiver.cpp @@ -444,7 +444,6 @@ MavlinkReceiver::evaluate_target_ok(int command, int target_system, int target_c switch (command) { case MAV_CMD_REQUEST_AUTOPILOT_CAPABILITIES: - case MAV_CMD_REQUEST_PROTOCOL_VERSION: /* broadcast and ignore component */ target_ok = (target_system == 0) || (target_system == mavlink_system.sysid); break; @@ -569,9 +568,6 @@ void MavlinkReceiver::handle_message_command_both(mavlink_message_t *msg, const if (cmd_mavlink.command == MAV_CMD_REQUEST_AUTOPILOT_CAPABILITIES) { result = handle_request_message_command(MAVLINK_MSG_ID_AUTOPILOT_VERSION); - } else if (cmd_mavlink.command == MAV_CMD_REQUEST_PROTOCOL_VERSION) { - result = handle_request_message_command(MAVLINK_MSG_ID_PROTOCOL_VERSION); - } else if (cmd_mavlink.command == MAV_CMD_GET_HOME_POSITION) { result = handle_request_message_command(MAVLINK_MSG_ID_HOME_POSITION); diff --git a/src/modules/mavlink/streams/PROTOCOL_VERSION.hpp b/src/modules/mavlink/streams/PROTOCOL_VERSION.hpp deleted file mode 100644 index a7ee8a0fb3..0000000000 --- a/src/modules/mavlink/streams/PROTOCOL_VERSION.hpp +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** - * - * Copyright (c) 2020 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. - * - ****************************************************************************/ - -#ifndef PROTOCOL_VERSION_HPP -#define PROTOCOL_VERSION_HPP - -class MavlinkStreamProtocolVersion : public MavlinkStream -{ -public: - static MavlinkStream *new_instance(Mavlink *mavlink) { return new MavlinkStreamProtocolVersion(mavlink); } - - static constexpr const char *get_name_static() { return "PROTOCOL_VERSION"; } - static constexpr uint16_t get_id_static() { return MAVLINK_MSG_ID_PROTOCOL_VERSION; } - - const char *get_name() const override { return get_name_static(); } - uint16_t get_id() override { return get_id_static(); } - - unsigned get_size() override - { - return MAVLINK_MSG_ID_PROTOCOL_VERSION_LEN + MAVLINK_NUM_NON_PAYLOAD_BYTES; - } - -private: - explicit MavlinkStreamProtocolVersion(Mavlink *mavlink) : MavlinkStream(mavlink) {} - - bool send() override - { - _mavlink->send_protocol_version(); - return true; - } -}; - -#endif // PROTOCOL_VERSION_HPP