Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Ardupilot
GitHub Repository: Ardupilot/ardupilot
Path: blob/master/libraries/AP_Compass/AP_Compass_config.h
9608 views
1
#pragma once
2
3
#include <AP_HAL/AP_HAL_Boards.h>
4
#include <AP_ExternalAHRS/AP_ExternalAHRS_config.h>
5
#include <AP_MSP/msp.h>
6
#include <AP_AHRS/AP_AHRS_config.h>
7
#include <AP_GPS/AP_GPS_config.h>
8
#include <AP_InertialSensor/AP_InertialSensor_config.h>
9
10
#ifndef AP_COMPASS_ENABLED
11
#define AP_COMPASS_ENABLED 1
12
#endif
13
14
#ifndef AP_COMPASS_DIAGONALS_ENABLED
15
#define AP_COMPASS_DIAGONALS_ENABLED 1
16
#endif
17
18
#ifndef COMPASS_CAL_ENABLED
19
#define COMPASS_CAL_ENABLED AP_COMPASS_ENABLED && AP_AHRS_DCM_ENABLED
20
#endif
21
22
#ifndef AP_COMPASS_CALIBRATION_FIXED_YAW_ENABLED
23
#define AP_COMPASS_CALIBRATION_FIXED_YAW_ENABLED AP_COMPASS_ENABLED && AP_GPS_ENABLED && AP_AHRS_ENABLED
24
#endif
25
26
#define COMPASS_MAX_SCALE_FACTOR 1.5
27
#define COMPASS_MIN_SCALE_FACTOR (1.0/COMPASS_MAX_SCALE_FACTOR)
28
29
// Backend support
30
#ifndef AP_COMPASS_BACKEND_DEFAULT_ENABLED
31
#define AP_COMPASS_BACKEND_DEFAULT_ENABLED AP_COMPASS_ENABLED
32
#endif
33
34
#ifndef AP_COMPASS_EXTERNALAHRS_ENABLED
35
#define AP_COMPASS_EXTERNALAHRS_ENABLED (AP_COMPASS_BACKEND_DEFAULT_ENABLED && AP_EXTERNAL_AHRS_ENABLED)
36
#endif
37
38
#ifndef AP_COMPASS_MSP_ENABLED
39
#define AP_COMPASS_MSP_ENABLED (AP_COMPASS_BACKEND_DEFAULT_ENABLED && HAL_MSP_SENSORS_ENABLED)
40
#endif
41
42
#ifndef AP_COMPASS_SITL_ENABLED
43
#define AP_COMPASS_SITL_ENABLED (AP_COMPASS_BACKEND_DEFAULT_ENABLED && AP_SIM_ENABLED)
44
#endif
45
46
#ifndef AP_COMPASS_DRONECAN_ENABLED
47
#define AP_COMPASS_DRONECAN_ENABLED (AP_COMPASS_BACKEND_DEFAULT_ENABLED && HAL_ENABLE_DRONECAN_DRIVERS)
48
#endif
49
50
#ifndef AP_COMPASS_DRONECAN_HIRES_ENABLED
51
#define AP_COMPASS_DRONECAN_HIRES_ENABLED 0
52
#endif
53
54
// i2c-based compasses:
55
#ifndef AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED
56
#define AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED AP_COMPASS_BACKEND_DEFAULT_ENABLED
57
#endif
58
59
#ifndef AP_COMPASS_AK09916_ENABLED
60
#define AP_COMPASS_AK09916_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED
61
#endif
62
63
#ifndef AP_COMPASS_AK8963_ENABLED
64
#define AP_COMPASS_AK8963_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED
65
#endif
66
67
#ifndef AP_COMPASS_BMM150_ENABLED
68
#define AP_COMPASS_BMM150_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED
69
#endif
70
71
#ifndef AP_COMPASS_BMM350_ENABLED
72
#define AP_COMPASS_BMM350_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED
73
#endif
74
75
#ifndef AP_COMPASS_HMC5843_ENABLED
76
#define AP_COMPASS_HMC5843_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED
77
#endif
78
79
#ifndef AP_COMPASS_ICM20948_ENABLED
80
#define AP_COMPASS_ICM20948_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED && AP_INERTIALSENSOR_ENABLED
81
#endif
82
83
#ifndef AP_COMPASS_IIS2MDC_ENABLED
84
#define AP_COMPASS_IIS2MDC_ENABLED 0
85
#endif
86
87
#ifndef AP_COMPASS_IST8308_ENABLED
88
#define AP_COMPASS_IST8308_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED
89
#endif
90
91
#ifndef AP_COMPASS_IST8310_ENABLED
92
#define AP_COMPASS_IST8310_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED
93
#endif
94
95
#ifndef AP_COMPASS_LIS3MDL_ENABLED
96
#define AP_COMPASS_LIS3MDL_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED
97
#endif
98
99
#ifndef AP_COMPASS_LIS2MDL_ENABLED
100
#define AP_COMPASS_LIS2MDL_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED && (HAL_PROGRAM_SIZE_LIMIT_KB > 1024)
101
#endif
102
103
#ifndef AP_COMPASS_LSM303D_ENABLED
104
#define AP_COMPASS_LSM303D_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED
105
#endif
106
107
#ifndef AP_COMPASS_LSM9DS1_ENABLED
108
#define AP_COMPASS_LSM9DS1_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED
109
#endif
110
111
#ifndef AP_COMPASS_MAG3110_ENABLED
112
#define AP_COMPASS_MAG3110_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED
113
#endif
114
115
#ifndef AP_COMPASS_MMC3416_ENABLED
116
#define AP_COMPASS_MMC3416_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED
117
#endif
118
119
#ifndef AP_COMPASS_MMC5XX3_ENABLED
120
#define AP_COMPASS_MMC5XX3_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED && (HAL_PROGRAM_SIZE_LIMIT_KB > 1024)
121
#endif
122
123
#ifndef AP_COMPASS_QMC5883P_ENABLED
124
#define AP_COMPASS_QMC5883P_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED && (HAL_PROGRAM_SIZE_LIMIT_KB > 1024)
125
#endif
126
127
#ifndef AP_COMPASS_QMC5883L_ENABLED
128
#define AP_COMPASS_QMC5883L_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED
129
#endif
130
131
#ifndef AP_COMPASS_RM3100_ENABLED
132
#define AP_COMPASS_RM3100_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED
133
#endif
134
135
#ifndef AP_COMPASS_PROBING_ENABLED
136
// FIXME: vast majority of boards define this to 1!
137
#define AP_COMPASS_PROBING_ENABLED 0
138
#endif
139
140
// boards can specify that they do not want their internal buses
141
// probed for compasses - we default to probing them if we are probing
142
// any buses:
143
#ifndef AP_COMPASS_INTERNAL_BUS_PROBING_ENABLED
144
#define AP_COMPASS_INTERNAL_BUS_PROBING_ENABLED (AP_COMPASS_PROBING_ENABLED || AP_FEATURE_BOARD_DETECT)
145
#endif
146
147
// some boards do not want to probe the internal buses for IS8310 but
148
// *do* want to probe internal buses for other compasses:
149
#ifndef AP_COMPASS_IST8310_INTERNAL_BUS_PROBING_ENABLED
150
#define AP_COMPASS_IST8310_INTERNAL_BUS_PROBING_ENABLED (AP_COMPASS_IST8310_ENABLED && AP_COMPASS_INTERNAL_BUS_PROBING_ENABLED)
151
#endif
152
153
// fmuv5 boards didn't want to probe external buses for IS8310 -
154
// possibly one of their internal buses is marked external so don't
155
// want onboard IST8310 detected before *actual* external compasses?
156
#ifndef AP_COMPASS_IST8310_EXTERNAL_BUS_PROBING_ENABLED
157
#define AP_COMPASS_IST8310_EXTERNAL_BUS_PROBING_ENABLED (AP_COMPASS_IST8310_ENABLED && AP_COMPASS_PROBING_ENABLED)
158
#endif // AP_COMPASS_IST8310_EXTERNAL_BUS_PROBING_ENABLED
159
160
#ifndef AP_COMPASS_LIS2MDL_EXTERNAL_BUS_PROBING_ENABLED
161
#define AP_COMPASS_LIS2MDL_EXTERNAL_BUS_PROBING_ENABLED (AP_COMPASS_LIS2MDL_ENABLED && AP_COMPASS_PROBING_ENABLED)
162
#endif // AP_COMPASS_LIS2MDL_EXTERNAL_BUS_PROBING_ENABLED
163
164
#ifndef AP_COMPASS_HMC5843_INTERNAL_BUS_PROBING_ENABLED
165
#define AP_COMPASS_HMC5843_INTERNAL_BUS_PROBING_ENABLED (AP_COMPASS_HMC5843_ENABLED && AP_COMPASS_INTERNAL_BUS_PROBING_ENABLED)
166
#endif // AP_COMPASS_HMC5843_INTERNAL_BUS_PROBING_ENABLED
167
168
169