From 3f89f177d172f8dfa5a5a08f6815d74dba76f93d Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Thu, 29 Aug 2024 13:40:47 +1200 Subject: [PATCH] mavlink/lib: move open_drone_id helpers to mavlink I could not extract the open_drone_id helpers to a separate lib because it would require the mavlink headers while the mavlink library would also depend on it, so it ended up being a circular dependency. Instead, I'm now just using the headers from within the mavlink module as well as from the uavcan driver. --- src/drivers/uavcan/remoteid.cpp | 2 +- src/lib/CMakeLists.txt | 1 - src/lib/open_drone_id/CMakeLists.txt | 41 ------------------- src/modules/mavlink/CMakeLists.txt | 2 +- .../mavlink}/open_drone_id_translations.cpp | 0 .../mavlink}/open_drone_id_translations.hpp | 0 .../streams/OPEN_DRONE_ID_BASIC_ID.hpp | 2 +- 7 files changed, 3 insertions(+), 45 deletions(-) delete mode 100644 src/lib/open_drone_id/CMakeLists.txt rename src/{lib/open_drone_id => modules/mavlink}/open_drone_id_translations.cpp (100%) rename src/{lib/open_drone_id => modules/mavlink}/open_drone_id_translations.hpp (100%) diff --git a/src/drivers/uavcan/remoteid.cpp b/src/drivers/uavcan/remoteid.cpp index 1b473e8d96fc..a2f373b767b0 100644 --- a/src/drivers/uavcan/remoteid.cpp +++ b/src/drivers/uavcan/remoteid.cpp @@ -32,7 +32,7 @@ ****************************************************************************/ #include "remoteid.hpp" -#include +#include #include using namespace time_literals; diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt index 942c2dcad853..7a7b5973fd4a 100644 --- a/src/lib/CMakeLists.txt +++ b/src/lib/CMakeLists.txt @@ -60,7 +60,6 @@ add_subdirectory(mathlib EXCLUDE_FROM_ALL) add_subdirectory(mixer_module EXCLUDE_FROM_ALL) add_subdirectory(motion_planning EXCLUDE_FROM_ALL) add_subdirectory(npfg EXCLUDE_FROM_ALL) -add_subdirectory(open_drone_id EXCLUDE_FROM_ALL) add_subdirectory(perf EXCLUDE_FROM_ALL) add_subdirectory(fw_performance_model EXCLUDE_FROM_ALL) add_subdirectory(pid EXCLUDE_FROM_ALL) diff --git a/src/lib/open_drone_id/CMakeLists.txt b/src/lib/open_drone_id/CMakeLists.txt deleted file mode 100644 index 2090d159250e..000000000000 --- a/src/lib/open_drone_id/CMakeLists.txt +++ /dev/null @@ -1,41 +0,0 @@ -############################################################################ -# -# Copyright (c) 2024 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. -# -############################################################################ - -px4_add_library(open_drone_id - open_drone_id_translations.cpp - open_drone_id_translations.hpp -) - -add_dependencies(open_drone_id mavlink_c_generate) - -target_compile_options(open_drone_id PRIVATE -Wno-cast-align -Wno-address-of-packed-member) diff --git a/src/modules/mavlink/CMakeLists.txt b/src/modules/mavlink/CMakeLists.txt index 4a29a6eb0b34..45aa9b1cc82f 100644 --- a/src/modules/mavlink/CMakeLists.txt +++ b/src/modules/mavlink/CMakeLists.txt @@ -120,6 +120,7 @@ px4_add_module( mavlink_timesync.cpp mavlink_ulog.cpp MavlinkStatustextHandler.cpp + open_drone_id_translations.cpp tune_publisher.cpp MODULE_CONFIG module.yaml @@ -135,7 +136,6 @@ px4_add_module( sensor_calibration geo mavlink_c - open_drone_id timesync tunes variable_length_ringbuffer diff --git a/src/lib/open_drone_id/open_drone_id_translations.cpp b/src/modules/mavlink/open_drone_id_translations.cpp similarity index 100% rename from src/lib/open_drone_id/open_drone_id_translations.cpp rename to src/modules/mavlink/open_drone_id_translations.cpp diff --git a/src/lib/open_drone_id/open_drone_id_translations.hpp b/src/modules/mavlink/open_drone_id_translations.hpp similarity index 100% rename from src/lib/open_drone_id/open_drone_id_translations.hpp rename to src/modules/mavlink/open_drone_id_translations.hpp diff --git a/src/modules/mavlink/streams/OPEN_DRONE_ID_BASIC_ID.hpp b/src/modules/mavlink/streams/OPEN_DRONE_ID_BASIC_ID.hpp index dcc77c660a53..b51d3e79d148 100644 --- a/src/modules/mavlink/streams/OPEN_DRONE_ID_BASIC_ID.hpp +++ b/src/modules/mavlink/streams/OPEN_DRONE_ID_BASIC_ID.hpp @@ -35,7 +35,7 @@ #define OPEN_DRONE_ID_BASIC_ID_HPP #include -#include +#include class MavlinkStreamOpenDroneIdBasicId : public MavlinkStream {