diff --git a/src/main/config/config.h b/src/main/config/config.h index 56f66645a8..1432b6882b 100644 --- a/src/main/config/config.h +++ b/src/main/config/config.h @@ -17,6 +17,8 @@ #pragma once +#include + #if FLASH_SIZE <= 128 #define MAX_PROFILE_COUNT 2 #else diff --git a/src/main/config/config_master.h b/src/main/config/config_master.h index 87a527e417..59d5a39fe8 100644 --- a/src/main/config/config_master.h +++ b/src/main/config/config_master.h @@ -17,49 +17,38 @@ #pragma once -#include -#include #include -#include "common/color.h" -#include "common/axis.h" +#include "config/config_profile.h" -#include "drivers/sensor.h" -#include "drivers/accgyro.h" #include "drivers/pwm_rx.h" -#include "drivers/serial.h" -#include "sensors/sensors.h" -#include "sensors/gyro.h" -#include "sensors/acceleration.h" -#include "sensors/barometer.h" -#include "sensors/boardalignment.h" -#include "sensors/battery.h" +#include "fc/rc_controls.h" + +#include "flight/failsafe.h" +#include "flight/mixer.h" +#include "flight/imu.h" +#include "flight/navigation.h" #include "io/serial.h" #include "io/gimbal.h" #include "io/motors.h" #include "io/servos.h" -#include "fc/rc_controls.h" -#include "io/ledstrip.h" #include "io/gps.h" #include "io/osd.h" +#include "io/ledstrip.h" #include "io/vtx.h" #include "rx/rx.h" #include "telemetry/telemetry.h" -#include "flight/mixer.h" -#include "flight/pid.h" -#include "flight/imu.h" -#include "flight/failsafe.h" -#include "flight/altitudehold.h" -#include "flight/navigation.h" - -#include "config/config.h" -#include "config/config_profile.h" -#include "config/config_master.h" +#include "sensors/sensors.h" +#include "sensors/gyro.h" +#include "sensors/acceleration.h" +#include "sensors/boardalignment.h" +#include "sensors/barometer.h" +#include "sensors/battery.h" // System-wide diff --git a/src/main/config/config_profile.h b/src/main/config/config_profile.h index 1ecbc29fcd..b66233df05 100644 --- a/src/main/config/config_profile.h +++ b/src/main/config/config_profile.h @@ -17,6 +17,11 @@ #pragma once +#include "config/config.h" +#include "common/axis.h" +#include "fc/rc_controls.h" +#include "flight/pid.h" + typedef struct profile_s { pidProfile_t pidProfile; uint8_t activeRateProfile; diff --git a/src/main/drivers/accgyro.h b/src/main/drivers/accgyro.h index 3d90de1bc0..0020d770fa 100644 --- a/src/main/drivers/accgyro.h +++ b/src/main/drivers/accgyro.h @@ -17,6 +17,8 @@ #pragma once +#include "drivers/sensor.h" + #ifndef MPU_I2C_INSTANCE #define MPU_I2C_INSTANCE I2C_DEVICE #endif diff --git a/src/main/drivers/pwm_rx.h b/src/main/drivers/pwm_rx.h index 5158a24653..b302796175 100644 --- a/src/main/drivers/pwm_rx.h +++ b/src/main/drivers/pwm_rx.h @@ -17,6 +17,8 @@ #pragma once +#include "drivers/timer.h" + typedef enum { INPUT_FILTERING_DISABLED = 0, INPUT_FILTERING_ENABLED @@ -24,7 +26,6 @@ typedef enum { #define PPM_RCVR_TIMEOUT 0 -struct timerHardware_s; void ppmInConfig(const struct timerHardware_s *timerHardwarePtr); void ppmAvoidPWMTimerClash(const struct timerHardware_s *timerHardwarePtr, TIM_TypeDef *sharedPwmTimer, uint8_t pwmProtocol); diff --git a/src/main/fc/rc_controls.h b/src/main/fc/rc_controls.h index 87008c129e..6c84dee566 100644 --- a/src/main/fc/rc_controls.h +++ b/src/main/fc/rc_controls.h @@ -17,6 +17,8 @@ #pragma once +#include + typedef enum { BOXARM = 0, BOXANGLE, diff --git a/src/main/flight/imu.h b/src/main/flight/imu.h index 43a629ce30..28751a86f7 100644 --- a/src/main/flight/imu.h +++ b/src/main/flight/imu.h @@ -17,12 +17,18 @@ #pragma once -extern int16_t throttleAngleCorrection; +#include "common/axis.h" +#include "common/maths.h" + +#include "sensors/acceleration.h" + +// Exported symbols extern uint32_t accTimeSum; extern int accSumCount; extern float accVelScale; extern int32_t accSum[XYZ_AXIS_COUNT]; + #define DEGREES_TO_DECIDEGREES(angle) (angle * 10) #define DECIDEGREES_TO_DEGREES(angle) (angle / 10) #define DECIDEGREES_TO_RADIANS(angle) ((angle / 10.0f) * 0.0174532925f) diff --git a/src/main/flight/pid.h b/src/main/flight/pid.h index 464989b8d3..38b7a81f11 100644 --- a/src/main/flight/pid.h +++ b/src/main/flight/pid.h @@ -17,6 +17,8 @@ #pragma once +#include + #define GYRO_I_MAX 256 // Gyro I limiter #define YAW_P_LIMIT_MIN 100 // Maximum value for yaw P limiter #define YAW_P_LIMIT_MAX 500 // Maximum value for yaw P limiter diff --git a/src/main/io/ledstrip.h b/src/main/io/ledstrip.h index b7497d6a56..eff11d7cfd 100644 --- a/src/main/io/ledstrip.h +++ b/src/main/io/ledstrip.h @@ -17,6 +17,8 @@ #pragma once +#include "common/color.h" + #define LED_MAX_STRIP_LENGTH 32 #define LED_CONFIGURABLE_COLOR_COUNT 16 #define LED_MODE_COUNT 6 diff --git a/src/main/io/serial.h b/src/main/io/serial.h index 0448d3e592..38d6851d28 100644 --- a/src/main/io/serial.h +++ b/src/main/io/serial.h @@ -17,6 +17,8 @@ #pragma once +#include "drivers/serial.h" + typedef enum { PORTSHARING_UNUSED = 0, PORTSHARING_NOT_SHARED, diff --git a/src/main/io/vtx.c b/src/main/io/vtx.c index c4c859a170..0b4e727917 100644 --- a/src/main/io/vtx.c +++ b/src/main/io/vtx.c @@ -15,27 +15,21 @@ * along with Cleanflight. If not, see . */ -#include -#include +// Get target build configuration #include "platform.h" #ifdef VTX -#include "drivers/vtx_rtc6705.h" - -#include "fc/rc_controls.h" -#include "fc/runtime_config.h" - -#include "flight/pid.h" - -#include "io/beeper.h" +// Own interfaces #include "io/vtx.h" -#include "config/config.h" -#include "config/config_eeprom.h" -#include "config/config_profile.h" +//External dependencies #include "config/config_master.h" +#include "config/config_eeprom.h" +#include "drivers/vtx_rtc6705.h" +#include "fc/runtime_config.h" +#include "io/beeper.h" static uint8_t locked = 0; diff --git a/src/main/io/vtx.h b/src/main/io/vtx.h index fdd5e506f9..939c84d701 100644 --- a/src/main/io/vtx.h +++ b/src/main/io/vtx.h @@ -17,6 +17,8 @@ #pragma once +#include "fc/rc_controls.h" + #define VTX_BAND_MIN 1 #define VTX_BAND_MAX 5 #define VTX_CHANNEL_MIN 1 diff --git a/src/main/sensors/acceleration.h b/src/main/sensors/acceleration.h index b7a63ecbc1..c4050fc9d0 100644 --- a/src/main/sensors/acceleration.h +++ b/src/main/sensors/acceleration.h @@ -17,6 +17,9 @@ #pragma once +#include "drivers/accgyro.h" +#include "sensors/sensors.h" + // Type of accelerometer used/detected typedef enum { ACC_DEFAULT = 0, diff --git a/src/main/sensors/gyro.h b/src/main/sensors/gyro.h index 32d53b126c..2946a4602f 100644 --- a/src/main/sensors/gyro.h +++ b/src/main/sensors/gyro.h @@ -17,6 +17,9 @@ #pragma once +#include "drivers/accgyro.h" +#include "common/axis.h" + typedef enum { GYRO_NONE = 0, GYRO_DEFAULT,