From 66f0a0f42ba9b515704d170742d80963a21f7e54 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Fri, 4 Mar 2022 14:29:45 +1100 Subject: [PATCH] AC_AutoTune: 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. --- libraries/AC_AutoTune/AC_AutoTune.cpp | 4 +++- libraries/AC_AutoTune/AC_AutoTune_Heli.cpp | 2 ++ libraries/AC_AutoTune/AC_AutoTune_Multi.cpp | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/libraries/AC_AutoTune/AC_AutoTune.cpp b/libraries/AC_AutoTune/AC_AutoTune.cpp index eb1e13a7fb..8257be5543 100644 --- a/libraries/AC_AutoTune/AC_AutoTune.cpp +++ b/libraries/AC_AutoTune/AC_AutoTune.cpp @@ -1,6 +1,8 @@ #include "AC_AutoTune.h" -#include + +#include #include +#include #define AUTOTUNE_PILOT_OVERRIDE_TIMEOUT_MS 500 // restart tuning if pilot has left sticks in middle for 2 seconds #if APM_BUILD_TYPE(APM_BUILD_ArduPlane) diff --git a/libraries/AC_AutoTune/AC_AutoTune_Heli.cpp b/libraries/AC_AutoTune/AC_AutoTune_Heli.cpp index 5267e66269..5cb31d2adb 100644 --- a/libraries/AC_AutoTune/AC_AutoTune_Heli.cpp +++ b/libraries/AC_AutoTune/AC_AutoTune_Heli.cpp @@ -19,6 +19,8 @@ #include "AC_AutoTune_Heli.h" +#include + #define AUTOTUNE_TESTING_STEP_TIMEOUT_MS 5000U // timeout for tuning mode's testing step #define AUTOTUNE_RD_STEP 0.0005f // minimum increment when increasing/decreasing Rate D term diff --git a/libraries/AC_AutoTune/AC_AutoTune_Multi.cpp b/libraries/AC_AutoTune/AC_AutoTune_Multi.cpp index dce6ca01d5..8b9f2982f4 100644 --- a/libraries/AC_AutoTune/AC_AutoTune_Multi.cpp +++ b/libraries/AC_AutoTune/AC_AutoTune_Multi.cpp @@ -1,5 +1,7 @@ #include "AC_AutoTune_Multi.h" +#include + /* * autotune support for multicopters *