From 99e314f49affdfcb96c87b1b2bf19dcc275e16c9 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Sat, 9 Nov 2024 10:29:06 +1100 Subject: [PATCH] AP_Mount: tidy header includes our pattern is to include the config file and then use the relevant define, with nothing in between --- libraries/AP_Mount/AP_Mount.cpp | 6 ++++-- libraries/AP_Mount/AP_Mount_Alexmos.cpp | 5 ++++- libraries/AP_Mount/AP_Mount_Alexmos.h | 5 ++++- libraries/AP_Mount/AP_Mount_Backend.cpp | 6 +++++- libraries/AP_Mount/AP_Mount_Backend_Serial.cpp | 5 ++++- libraries/AP_Mount/AP_Mount_Gremsy.cpp | 4 +++- libraries/AP_Mount/AP_Mount_Gremsy.h | 4 +++- libraries/AP_Mount/AP_Mount_SToRM32.cpp | 5 ++++- libraries/AP_Mount/AP_Mount_SToRM32.h | 4 +++- libraries/AP_Mount/AP_Mount_SToRM32_serial.cpp | 5 ++++- libraries/AP_Mount/AP_Mount_SToRM32_serial.h | 4 +++- libraries/AP_Mount/AP_Mount_Scripting.cpp | 5 ++++- libraries/AP_Mount/AP_Mount_Scripting.h | 6 ++++-- libraries/AP_Mount/AP_Mount_Servo.cpp | 5 ++++- libraries/AP_Mount/AP_Mount_Servo.h | 4 +++- libraries/AP_Mount/AP_Mount_Siyi.cpp | 5 ++++- libraries/AP_Mount/AP_Mount_Siyi.h | 6 ++++-- libraries/AP_Mount/AP_Mount_Topotek.cpp | 4 +++- libraries/AP_Mount/AP_Mount_Viewpro.cpp | 5 ++++- libraries/AP_Mount/AP_Mount_Viewpro.h | 4 +++- libraries/AP_Mount/AP_Mount_Xacti.cpp | 5 ++++- libraries/AP_Mount/AP_Mount_Xacti.h | 4 +++- libraries/AP_Mount/AP_Mount_config.h | 2 ++ libraries/AP_Mount/SoloGimbal.cpp | 6 ++++-- libraries/AP_Mount/SoloGimbalEKF.cpp | 5 ++++- libraries/AP_Mount/SoloGimbal_Parameters.cpp | 5 ++++- 26 files changed, 95 insertions(+), 29 deletions(-) diff --git a/libraries/AP_Mount/AP_Mount.cpp b/libraries/AP_Mount/AP_Mount.cpp index fe7f29f7ea..8dc31bbfa3 100644 --- a/libraries/AP_Mount/AP_Mount.cpp +++ b/libraries/AP_Mount/AP_Mount.cpp @@ -1,9 +1,11 @@ +#include "AP_Mount_config.h" + +#if HAL_MOUNT_ENABLED + #include #include #include "AP_Mount.h" -#if HAL_MOUNT_ENABLED - #include "AP_Mount_Backend.h" #include "AP_Mount_Servo.h" #include "AP_Mount_SoloGimbal.h" diff --git a/libraries/AP_Mount/AP_Mount_Alexmos.cpp b/libraries/AP_Mount/AP_Mount_Alexmos.cpp index 7db333f6b7..79a8a5eaf0 100644 --- a/libraries/AP_Mount/AP_Mount_Alexmos.cpp +++ b/libraries/AP_Mount/AP_Mount_Alexmos.cpp @@ -1,6 +1,9 @@ -#include "AP_Mount_Alexmos.h" +#include "AP_Mount_config.h" #if HAL_MOUNT_ALEXMOS_ENABLED + +#include "AP_Mount_Alexmos.h" + #include //definition of the commands id for the Alexmos Serial Protocol diff --git a/libraries/AP_Mount/AP_Mount_Alexmos.h b/libraries/AP_Mount/AP_Mount_Alexmos.h index a8765e1743..10225afa72 100644 --- a/libraries/AP_Mount/AP_Mount_Alexmos.h +++ b/libraries/AP_Mount/AP_Mount_Alexmos.h @@ -3,9 +3,12 @@ */ #pragma once -#include "AP_Mount_Backend.h" +#include "AP_Mount_config.h" #if HAL_MOUNT_ALEXMOS_ENABLED + +#include "AP_Mount_Backend.h" + #include #include #include diff --git a/libraries/AP_Mount/AP_Mount_Backend.cpp b/libraries/AP_Mount/AP_Mount_Backend.cpp index 94f9e7e31b..531d01c30a 100644 --- a/libraries/AP_Mount/AP_Mount_Backend.cpp +++ b/libraries/AP_Mount/AP_Mount_Backend.cpp @@ -1,5 +1,9 @@ -#include "AP_Mount_Backend.h" +#include "AP_Mount_config.h" + #if HAL_MOUNT_ENABLED + +#include "AP_Mount_Backend.h" + #include #include #include diff --git a/libraries/AP_Mount/AP_Mount_Backend_Serial.cpp b/libraries/AP_Mount/AP_Mount_Backend_Serial.cpp index ec27051057..35fe60265b 100644 --- a/libraries/AP_Mount/AP_Mount_Backend_Serial.cpp +++ b/libraries/AP_Mount/AP_Mount_Backend_Serial.cpp @@ -1,6 +1,9 @@ -#include "AP_Mount_Backend_Serial.h" +#include "AP_Mount_config.h" #if HAL_MOUNT_ENABLED + +#include "AP_Mount_Backend_Serial.h" + #include // Default init function for every mount diff --git a/libraries/AP_Mount/AP_Mount_Gremsy.cpp b/libraries/AP_Mount/AP_Mount_Gremsy.cpp index 631acc8778..9e88a32417 100644 --- a/libraries/AP_Mount/AP_Mount_Gremsy.cpp +++ b/libraries/AP_Mount/AP_Mount_Gremsy.cpp @@ -1,7 +1,9 @@ -#include "AP_Mount_Gremsy.h" +#include "AP_Mount_config.h" #if HAL_MOUNT_GREMSY_ENABLED +#include "AP_Mount_Gremsy.h" + #include #include diff --git a/libraries/AP_Mount/AP_Mount_Gremsy.h b/libraries/AP_Mount/AP_Mount_Gremsy.h index 79bd42af77..581eda3690 100644 --- a/libraries/AP_Mount/AP_Mount_Gremsy.h +++ b/libraries/AP_Mount/AP_Mount_Gremsy.h @@ -3,10 +3,12 @@ */ #pragma once -#include "AP_Mount_Backend.h" +#include "AP_Mount_config.h" #if HAL_MOUNT_GREMSY_ENABLED +#include "AP_Mount_Backend.h" + #include #include #include diff --git a/libraries/AP_Mount/AP_Mount_SToRM32.cpp b/libraries/AP_Mount/AP_Mount_SToRM32.cpp index bd638fa42a..71875ad159 100644 --- a/libraries/AP_Mount/AP_Mount_SToRM32.cpp +++ b/libraries/AP_Mount/AP_Mount_SToRM32.cpp @@ -1,6 +1,9 @@ -#include "AP_Mount_SToRM32.h" +#include "AP_Mount_config.h" #if HAL_MOUNT_STORM32MAVLINK_ENABLED + +#include "AP_Mount_SToRM32.h" + #include #include diff --git a/libraries/AP_Mount/AP_Mount_SToRM32.h b/libraries/AP_Mount/AP_Mount_SToRM32.h index 33aef375c4..6ff1a1ad1a 100644 --- a/libraries/AP_Mount/AP_Mount_SToRM32.h +++ b/libraries/AP_Mount/AP_Mount_SToRM32.h @@ -3,10 +3,12 @@ */ #pragma once -#include "AP_Mount_Backend.h" +#include "AP_Mount_config.h" #if HAL_MOUNT_STORM32MAVLINK_ENABLED +#include "AP_Mount_Backend.h" + #include #include diff --git a/libraries/AP_Mount/AP_Mount_SToRM32_serial.cpp b/libraries/AP_Mount/AP_Mount_SToRM32_serial.cpp index 9b003de0fe..ace8903663 100644 --- a/libraries/AP_Mount/AP_Mount_SToRM32_serial.cpp +++ b/libraries/AP_Mount/AP_Mount_SToRM32_serial.cpp @@ -1,6 +1,9 @@ -#include "AP_Mount_SToRM32_serial.h" +#include "AP_Mount_config.h" #if HAL_MOUNT_STORM32SERIAL_ENABLED + +#include "AP_Mount_SToRM32_serial.h" + #include #include #include diff --git a/libraries/AP_Mount/AP_Mount_SToRM32_serial.h b/libraries/AP_Mount/AP_Mount_SToRM32_serial.h index 895143e80b..07b3d3d165 100644 --- a/libraries/AP_Mount/AP_Mount_SToRM32_serial.h +++ b/libraries/AP_Mount/AP_Mount_SToRM32_serial.h @@ -3,10 +3,12 @@ */ #pragma once -#include "AP_Mount_Backend_Serial.h" +#include "AP_Mount_config.h" #if HAL_MOUNT_STORM32SERIAL_ENABLED +#include "AP_Mount_Backend_Serial.h" + #include #include #include diff --git a/libraries/AP_Mount/AP_Mount_Scripting.cpp b/libraries/AP_Mount/AP_Mount_Scripting.cpp index e70c030036..165d0d1a58 100644 --- a/libraries/AP_Mount/AP_Mount_Scripting.cpp +++ b/libraries/AP_Mount/AP_Mount_Scripting.cpp @@ -1,6 +1,9 @@ -#include "AP_Mount_Scripting.h" +#include "AP_Mount_config.h" #if HAL_MOUNT_SCRIPTING_ENABLED + +#include "AP_Mount_Scripting.h" + #include #include #include diff --git a/libraries/AP_Mount/AP_Mount_Scripting.h b/libraries/AP_Mount/AP_Mount_Scripting.h index ecf1f7cbd8..52537f171d 100644 --- a/libraries/AP_Mount/AP_Mount_Scripting.h +++ b/libraries/AP_Mount/AP_Mount_Scripting.h @@ -4,10 +4,12 @@ #pragma once -#include "AP_Mount_Backend.h" +#include "AP_Mount_config.h" #if HAL_MOUNT_SCRIPTING_ENABLED +#include "AP_Mount_Backend.h" + #include #include #include @@ -50,4 +52,4 @@ private: bool target_loc_valid; // true if target_loc holds a valid target location }; -#endif // HAL_MOUNT_SIYISERIAL_ENABLED +#endif // HAL_MOUNT_SCRIPTING_ENABLED diff --git a/libraries/AP_Mount/AP_Mount_Servo.cpp b/libraries/AP_Mount/AP_Mount_Servo.cpp index 743708fa9d..f2446c2af7 100644 --- a/libraries/AP_Mount/AP_Mount_Servo.cpp +++ b/libraries/AP_Mount/AP_Mount_Servo.cpp @@ -1,6 +1,9 @@ -#include "AP_Mount_Servo.h" +#include "AP_Mount_config.h" + #if HAL_MOUNT_SERVO_ENABLED +#include "AP_Mount_Servo.h" + #include #include diff --git a/libraries/AP_Mount/AP_Mount_Servo.h b/libraries/AP_Mount/AP_Mount_Servo.h index 8ead11561f..a1da63210b 100644 --- a/libraries/AP_Mount/AP_Mount_Servo.h +++ b/libraries/AP_Mount/AP_Mount_Servo.h @@ -3,10 +3,12 @@ */ #pragma once -#include "AP_Mount_Backend.h" +#include "AP_Mount_config.h" #if HAL_MOUNT_SERVO_ENABLED +#include "AP_Mount_Backend.h" + #include #include #include diff --git a/libraries/AP_Mount/AP_Mount_Siyi.cpp b/libraries/AP_Mount/AP_Mount_Siyi.cpp index 1c91af6a43..e16a29586d 100644 --- a/libraries/AP_Mount/AP_Mount_Siyi.cpp +++ b/libraries/AP_Mount/AP_Mount_Siyi.cpp @@ -1,6 +1,9 @@ -#include "AP_Mount_Siyi.h" +#include "AP_Mount_config.h" #if HAL_MOUNT_SIYI_ENABLED + +#include "AP_Mount_Siyi.h" + #include #include #include diff --git a/libraries/AP_Mount/AP_Mount_Siyi.h b/libraries/AP_Mount/AP_Mount_Siyi.h index 20285b0b5b..7f7f280b22 100644 --- a/libraries/AP_Mount/AP_Mount_Siyi.h +++ b/libraries/AP_Mount/AP_Mount_Siyi.h @@ -19,10 +19,12 @@ #pragma once -#include "AP_Mount_Backend_Serial.h" +#include "AP_Mount_config.h" #if HAL_MOUNT_SIYI_ENABLED +#include "AP_Mount_Backend_Serial.h" + #include #include #include @@ -381,4 +383,4 @@ private: uint8_t sent_time_count; }; -#endif // HAL_MOUNT_SIYISERIAL_ENABLED +#endif // HAL_MOUNT_SIYI_ENABLED diff --git a/libraries/AP_Mount/AP_Mount_Topotek.cpp b/libraries/AP_Mount/AP_Mount_Topotek.cpp index bfe93ec83a..dc1fae7007 100755 --- a/libraries/AP_Mount/AP_Mount_Topotek.cpp +++ b/libraries/AP_Mount/AP_Mount_Topotek.cpp @@ -1,7 +1,9 @@ -#include "AP_Mount_Topotek.h" +#include "AP_Mount_config.h" #if HAL_MOUNT_TOPOTEK_ENABLED +#include "AP_Mount_Topotek.h" + #include #include #include diff --git a/libraries/AP_Mount/AP_Mount_Viewpro.cpp b/libraries/AP_Mount/AP_Mount_Viewpro.cpp index 1de89fbc67..aa443483e8 100644 --- a/libraries/AP_Mount/AP_Mount_Viewpro.cpp +++ b/libraries/AP_Mount/AP_Mount_Viewpro.cpp @@ -1,6 +1,9 @@ -#include "AP_Mount_Viewpro.h" +#include "AP_Mount_config.h" #if HAL_MOUNT_VIEWPRO_ENABLED + +#include "AP_Mount_Viewpro.h" + #include #include #include diff --git a/libraries/AP_Mount/AP_Mount_Viewpro.h b/libraries/AP_Mount/AP_Mount_Viewpro.h index 1e045c8fd1..1100586cd1 100644 --- a/libraries/AP_Mount/AP_Mount_Viewpro.h +++ b/libraries/AP_Mount/AP_Mount_Viewpro.h @@ -16,10 +16,12 @@ #pragma once -#include "AP_Mount_Backend_Serial.h" +#include "AP_Mount_config.h" #if HAL_MOUNT_VIEWPRO_ENABLED +#include "AP_Mount_Backend_Serial.h" + #include #include #include diff --git a/libraries/AP_Mount/AP_Mount_Xacti.cpp b/libraries/AP_Mount/AP_Mount_Xacti.cpp index c5727f6c02..86296d814b 100644 --- a/libraries/AP_Mount/AP_Mount_Xacti.cpp +++ b/libraries/AP_Mount/AP_Mount_Xacti.cpp @@ -1,6 +1,9 @@ -#include "AP_Mount_Xacti.h" +#include "AP_Mount_config.h" #if HAL_MOUNT_XACTI_ENABLED + +#include "AP_Mount_Xacti.h" + #include #include #include diff --git a/libraries/AP_Mount/AP_Mount_Xacti.h b/libraries/AP_Mount/AP_Mount_Xacti.h index 31a6684023..0057f4ae37 100644 --- a/libraries/AP_Mount/AP_Mount_Xacti.h +++ b/libraries/AP_Mount/AP_Mount_Xacti.h @@ -8,10 +8,12 @@ #pragma once -#include "AP_Mount_Backend.h" +#include "AP_Mount_config.h" #if HAL_MOUNT_XACTI_ENABLED +#include "AP_Mount_Backend.h" + #include #include #include diff --git a/libraries/AP_Mount/AP_Mount_config.h b/libraries/AP_Mount/AP_Mount_config.h index c7b063b20e..c6e0791c2a 100644 --- a/libraries/AP_Mount/AP_Mount_config.h +++ b/libraries/AP_Mount/AP_Mount_config.h @@ -2,6 +2,8 @@ #include #include +#include +#include #ifndef HAL_MOUNT_ENABLED #define HAL_MOUNT_ENABLED 1 diff --git a/libraries/AP_Mount/SoloGimbal.cpp b/libraries/AP_Mount/SoloGimbal.cpp index eba243eaba..6e270de102 100644 --- a/libraries/AP_Mount/SoloGimbal.cpp +++ b/libraries/AP_Mount/SoloGimbal.cpp @@ -1,9 +1,11 @@ +#include "AP_Mount_config.h" + +#if HAL_SOLO_GIMBAL_ENABLED + #include #include #include "SoloGimbal.h" -#if HAL_SOLO_GIMBAL_ENABLED - #include #include #include diff --git a/libraries/AP_Mount/SoloGimbalEKF.cpp b/libraries/AP_Mount/SoloGimbalEKF.cpp index b599b4c251..b514706f15 100644 --- a/libraries/AP_Mount/SoloGimbalEKF.cpp +++ b/libraries/AP_Mount/SoloGimbalEKF.cpp @@ -1,3 +1,7 @@ +#include "AP_Mount_config.h" + +#if HAL_SOLO_GIMBAL_ENABLED + #include // uncomment this to force the optimisation of this code, note that @@ -9,7 +13,6 @@ #endif #include "SoloGimbalEKF.h" -#if HAL_SOLO_GIMBAL_ENABLED #include #include #include diff --git a/libraries/AP_Mount/SoloGimbal_Parameters.cpp b/libraries/AP_Mount/SoloGimbal_Parameters.cpp index 60bf156acb..ff76f0583d 100644 --- a/libraries/AP_Mount/SoloGimbal_Parameters.cpp +++ b/libraries/AP_Mount/SoloGimbal_Parameters.cpp @@ -1,5 +1,8 @@ -#include "SoloGimbal_Parameters.h" +#include "AP_Mount_config.h" + #if HAL_SOLO_GIMBAL_ENABLED + +#include "SoloGimbal_Parameters.h" #include #include #include