2022-10-04 21:22:17 -03:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <AP_HAL/AP_HAL_Boards.h>
|
2022-10-26 06:21:36 -03:00
|
|
|
#include <AP_ExternalAHRS/AP_ExternalAHRS_config.h>
|
|
|
|
#include <AP_MSP/msp.h>
|
2023-09-18 08:53:26 -03:00
|
|
|
#include <AP_AHRS/AP_AHRS_config.h>
|
2023-09-25 05:16:34 -03:00
|
|
|
#include <AP_GPS/AP_GPS_config.h>
|
2022-10-04 21:22:17 -03:00
|
|
|
|
2023-06-20 03:36:06 -03:00
|
|
|
#ifndef AP_COMPASS_ENABLED
|
|
|
|
#define AP_COMPASS_ENABLED 1
|
|
|
|
#endif
|
|
|
|
|
2022-10-04 21:22:17 -03:00
|
|
|
#ifndef AP_COMPASS_DIAGONALS_ENABLED
|
2022-10-26 04:14:11 -03:00
|
|
|
#define AP_COMPASS_DIAGONALS_ENABLED 1
|
2022-10-04 21:22:17 -03:00
|
|
|
#endif
|
2022-10-26 06:21:36 -03:00
|
|
|
|
2023-09-18 08:53:03 -03:00
|
|
|
#ifndef COMPASS_CAL_ENABLED
|
2023-09-18 08:53:26 -03:00
|
|
|
#define COMPASS_CAL_ENABLED AP_COMPASS_ENABLED && AP_AHRS_DCM_ENABLED
|
2023-09-18 08:53:03 -03:00
|
|
|
#endif
|
|
|
|
|
2023-09-25 05:16:34 -03:00
|
|
|
#ifndef AP_COMPASS_CALIBRATION_FIXED_YAW_ENABLED
|
2024-01-03 21:09:54 -04:00
|
|
|
#define AP_COMPASS_CALIBRATION_FIXED_YAW_ENABLED AP_COMPASS_ENABLED && AP_GPS_ENABLED && AP_AHRS_ENABLED
|
2023-09-25 05:16:34 -03:00
|
|
|
#endif
|
|
|
|
|
2023-09-18 08:53:03 -03:00
|
|
|
#define COMPASS_MAX_SCALE_FACTOR 1.5
|
|
|
|
#define COMPASS_MIN_SCALE_FACTOR (1.0/COMPASS_MAX_SCALE_FACTOR)
|
|
|
|
|
2022-10-26 06:21:36 -03:00
|
|
|
// Backend support
|
2023-01-04 18:47:39 -04:00
|
|
|
#ifndef AP_COMPASS_BACKEND_DEFAULT_ENABLED
|
2023-06-20 03:36:06 -03:00
|
|
|
#define AP_COMPASS_BACKEND_DEFAULT_ENABLED AP_COMPASS_ENABLED
|
2023-01-04 18:47:39 -04:00
|
|
|
#endif
|
|
|
|
|
2022-10-26 06:21:36 -03:00
|
|
|
#ifndef AP_COMPASS_EXTERNALAHRS_ENABLED
|
2023-01-04 18:47:39 -04:00
|
|
|
#define AP_COMPASS_EXTERNALAHRS_ENABLED (AP_COMPASS_BACKEND_DEFAULT_ENABLED && HAL_EXTERNAL_AHRS_ENABLED)
|
2022-10-26 06:21:36 -03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef AP_COMPASS_MSP_ENABLED
|
2023-01-04 18:47:39 -04:00
|
|
|
#define AP_COMPASS_MSP_ENABLED (AP_COMPASS_BACKEND_DEFAULT_ENABLED && HAL_MSP_SENSORS_ENABLED)
|
2022-10-26 06:21:36 -03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef AP_COMPASS_SITL_ENABLED
|
2023-01-04 18:47:39 -04:00
|
|
|
#define AP_COMPASS_SITL_ENABLED (AP_COMPASS_BACKEND_DEFAULT_ENABLED && AP_SIM_ENABLED)
|
2022-10-26 06:21:36 -03:00
|
|
|
#endif
|
|
|
|
|
2023-04-08 00:58:13 -03:00
|
|
|
#ifndef AP_COMPASS_DRONECAN_ENABLED
|
2023-04-08 01:09:10 -03:00
|
|
|
#define AP_COMPASS_DRONECAN_ENABLED (AP_COMPASS_BACKEND_DEFAULT_ENABLED && HAL_ENABLE_DRONECAN_DRIVERS)
|
2023-01-04 18:47:39 -04:00
|
|
|
#endif
|
|
|
|
|
2024-03-02 18:04:32 -04:00
|
|
|
#ifndef AP_COMPASS_DRONECAN_HIRES_ENABLED
|
|
|
|
#define AP_COMPASS_DRONECAN_HIRES_ENABLED 0
|
|
|
|
#endif
|
|
|
|
|
2023-01-04 18:47:39 -04:00
|
|
|
// i2c-based compasses:
|
|
|
|
#ifndef AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED
|
|
|
|
#define AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED AP_COMPASS_BACKEND_DEFAULT_ENABLED
|
|
|
|
#endif
|
|
|
|
|
2023-02-19 21:05:04 -04:00
|
|
|
#ifndef AP_COMPASS_AK09916_ENABLED
|
|
|
|
#define AP_COMPASS_AK09916_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED
|
|
|
|
#endif
|
|
|
|
|
2023-02-01 08:53:43 -04:00
|
|
|
#ifndef AP_COMPASS_AK8963_ENABLED
|
|
|
|
#define AP_COMPASS_AK8963_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED
|
|
|
|
#endif
|
|
|
|
|
2023-02-07 18:55:11 -04:00
|
|
|
#ifndef AP_COMPASS_BMM150_ENABLED
|
2023-02-27 18:34:04 -04:00
|
|
|
#define AP_COMPASS_BMM150_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED
|
2023-02-07 18:55:11 -04:00
|
|
|
#endif
|
|
|
|
|
2023-02-07 19:48:11 -04:00
|
|
|
// this define dictates whether we iterate over the external i2c
|
|
|
|
// busses looking for BMM150. Ordinarily this should be true, but
|
|
|
|
// SkyViper specifies its BMM150 and thus does not need to probe.
|
|
|
|
// This is an interim arrangement until PCNC1 is eliminated as an
|
|
|
|
// auto-detect board.
|
|
|
|
#ifndef AP_COMPASS_BMM150_DETECT_BACKENDS_ENABLED
|
|
|
|
#define AP_COMPASS_BMM150_DETECT_BACKENDS_ENABLED AP_COMPASS_BMM150_ENABLED
|
|
|
|
#endif
|
|
|
|
|
2024-09-11 06:10:44 -03:00
|
|
|
#ifndef AP_COMPASS_BMM350_ENABLED
|
|
|
|
#define AP_COMPASS_BMM350_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED
|
|
|
|
#endif
|
|
|
|
|
2023-01-29 19:33:08 -04:00
|
|
|
#ifndef AP_COMPASS_HMC5843_ENABLED
|
|
|
|
#define AP_COMPASS_HMC5843_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED
|
|
|
|
#endif
|
|
|
|
|
2023-02-19 21:05:07 -04:00
|
|
|
#ifndef AP_COMPASS_ICM20948_ENABLED
|
|
|
|
#define AP_COMPASS_ICM20948_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED
|
|
|
|
#endif
|
|
|
|
|
2023-01-04 18:47:39 -04:00
|
|
|
#ifndef AP_COMPASS_IST8308_ENABLED
|
|
|
|
#define AP_COMPASS_IST8308_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED
|
2022-10-26 06:21:36 -03:00
|
|
|
#endif
|
2023-01-27 00:09:50 -04:00
|
|
|
|
2023-02-09 21:48:02 -04:00
|
|
|
#ifndef AP_COMPASS_IST8310_ENABLED
|
|
|
|
#define AP_COMPASS_IST8310_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED
|
|
|
|
#endif
|
|
|
|
|
2023-02-15 07:53:48 -04:00
|
|
|
#ifndef AP_COMPASS_LIS3MDL_ENABLED
|
|
|
|
#define AP_COMPASS_LIS3MDL_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED
|
|
|
|
#endif
|
|
|
|
|
2023-01-27 00:09:50 -04:00
|
|
|
#ifndef AP_COMPASS_LSM303D_ENABLED
|
|
|
|
#define AP_COMPASS_LSM303D_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED
|
|
|
|
#endif
|
2023-02-13 23:10:39 -04:00
|
|
|
|
|
|
|
#ifndef AP_COMPASS_LSM9DS1_ENABLED
|
|
|
|
#define AP_COMPASS_LSM9DS1_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED
|
|
|
|
#endif
|
2023-02-19 21:05:08 -04:00
|
|
|
|
2023-02-19 21:05:15 -04:00
|
|
|
#ifndef AP_COMPASS_MAG3110_ENABLED
|
|
|
|
#define AP_COMPASS_MAG3110_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED
|
|
|
|
#endif
|
|
|
|
|
2023-02-19 21:05:08 -04:00
|
|
|
#ifndef AP_COMPASS_MMC3416_ENABLED
|
|
|
|
#define AP_COMPASS_MMC3416_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED
|
|
|
|
#endif
|
2023-02-19 21:05:13 -04:00
|
|
|
|
2023-02-19 21:05:18 -04:00
|
|
|
#ifndef AP_COMPASS_MMC5XX3_ENABLED
|
|
|
|
#define AP_COMPASS_MMC5XX3_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED
|
|
|
|
#endif
|
|
|
|
|
2023-11-11 00:00:55 -04:00
|
|
|
#ifndef AP_COMPASS_QMC5883P_ENABLED
|
|
|
|
#define AP_COMPASS_QMC5883P_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED && (BOARD_FLASH_SIZE > 1024)
|
|
|
|
#endif
|
|
|
|
|
2023-02-19 21:05:13 -04:00
|
|
|
#ifndef AP_COMPASS_QMC5883L_ENABLED
|
|
|
|
#define AP_COMPASS_QMC5883L_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED
|
|
|
|
#endif
|
2023-02-19 21:05:17 -04:00
|
|
|
|
|
|
|
#ifndef AP_COMPASS_RM3100_ENABLED
|
|
|
|
#define AP_COMPASS_RM3100_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED
|
|
|
|
#endif
|