From 9a054876ff1320a2788aee417a64a98d7352fea6 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Mon, 25 Sep 2023 18:16:34 +1000 Subject: [PATCH] AP_Compass: use AP_GPS_ENABLED to exclude more code when GPS not compiled in --- libraries/AP_Compass/AP_Compass_Calibration.cpp | 3 +++ libraries/AP_Compass/AP_Compass_config.h | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/libraries/AP_Compass/AP_Compass_Calibration.cpp b/libraries/AP_Compass/AP_Compass_Calibration.cpp index d12b77ba83..8d70f24c66 100644 --- a/libraries/AP_Compass/AP_Compass_Calibration.cpp +++ b/libraries/AP_Compass/AP_Compass_Calibration.cpp @@ -453,6 +453,7 @@ MAV_RESULT Compass::handle_mag_cal_command(const mavlink_command_int_t &packet) #endif // COMPASS_CAL_ENABLED +#if AP_COMPASS_CALIBRATION_FIXED_YAW_ENABLED /* get mag field with the effects of offsets, diagonals and off-diagonals removed @@ -573,3 +574,5 @@ MAV_RESULT Compass::mag_cal_fixed_yaw(float yaw_deg, uint8_t compass_mask, return MAV_RESULT_ACCEPTED; } + +#endif // AP_COMPASS_CALIBRATION_FIXED_YAW_ENABLED diff --git a/libraries/AP_Compass/AP_Compass_config.h b/libraries/AP_Compass/AP_Compass_config.h index 9d77843b09..6bb8153b58 100644 --- a/libraries/AP_Compass/AP_Compass_config.h +++ b/libraries/AP_Compass/AP_Compass_config.h @@ -4,6 +4,7 @@ #include #include #include +#include #ifndef AP_COMPASS_ENABLED #define AP_COMPASS_ENABLED 1 @@ -17,6 +18,10 @@ #define COMPASS_CAL_ENABLED AP_COMPASS_ENABLED && AP_AHRS_DCM_ENABLED #endif +#ifndef AP_COMPASS_CALIBRATION_FIXED_YAW_ENABLED +#define AP_COMPASS_CALIBRATION_FIXED_YAW_ENABLED AP_GPS_ENABLED +#endif + #define COMPASS_MAX_SCALE_FACTOR 1.5 #define COMPASS_MIN_SCALE_FACTOR (1.0/COMPASS_MAX_SCALE_FACTOR)