From fd4a00a6541e8fab00c16ff6b1c5fd9b886eb0e4 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Fri, 4 Mar 2022 14:29:49 +1100 Subject: [PATCH] ArduPlane: stop libraries including AP_Logger.h in .h files AP_Logger.h is a nexus of includes; while this is being improved over time, there's no reason for the library headers to include AP_Logger.h as the logger itself is access by singleton and the structures are in LogStructure.h This necessitated moving The PID_Info structure out of AP_Logger's namespace. This cleans up a pretty nasty bit - that structure is definitely not simply used for logging, but also used to pass pid information around to controllers! There are a lot of patches in here because AP_Logger.h, acting as a nexus, was providing transitive header file inclusion in many (some unlikely!) places. --- ArduPlane/GCS_Mavlink.cpp | 4 ++-- ArduPlane/GCS_Mavlink.h | 2 +- ArduPlane/quadplane.h | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ArduPlane/GCS_Mavlink.cpp b/ArduPlane/GCS_Mavlink.cpp index 07a23adeb3..6a2c762c2b 100644 --- a/ArduPlane/GCS_Mavlink.cpp +++ b/ArduPlane/GCS_Mavlink.cpp @@ -290,7 +290,7 @@ void GCS_MAVLINK_Plane::send_wind() const } // sends a single pid info over the provided channel -void GCS_MAVLINK_Plane::send_pid_info(const AP_Logger::PID_Info *pid_info, +void GCS_MAVLINK_Plane::send_pid_info(const AP_PIDInfo *pid_info, const uint8_t axis, const float achieved) { if (pid_info == nullptr) { @@ -322,7 +322,7 @@ void GCS_MAVLINK_Plane::send_pid_tuning() const Parameters &g = plane.g; - const AP_Logger::PID_Info *pid_info; + const AP_PIDInfo *pid_info; if (g.gcs_pid_mask & TUNING_BITS_ROLL) { pid_info = &plane.rollController.get_pid_info(); #if HAL_QUADPLANE_ENABLED diff --git a/ArduPlane/GCS_Mavlink.h b/ArduPlane/GCS_Mavlink.h index 95fa3bca64..8518baccf5 100644 --- a/ArduPlane/GCS_Mavlink.h +++ b/ArduPlane/GCS_Mavlink.h @@ -41,7 +41,7 @@ protected: private: - void send_pid_info(const AP_Logger::PID_Info *pid_info, const uint8_t axis, const float achieved); + void send_pid_info(const AP_PIDInfo *pid_info, const uint8_t axis, const float achieved); void handleMessage(const mavlink_message_t &msg) override; bool handle_guided_request(AP_Mission::Mission_Command &cmd) override; diff --git a/ArduPlane/quadplane.h b/ArduPlane/quadplane.h index 33bbc2296b..9bd0fa9e27 100644 --- a/ArduPlane/quadplane.h +++ b/ArduPlane/quadplane.h @@ -18,6 +18,7 @@ #include #include #include +#include #include #include "qautotune.h" #include "defines.h"