diff --git a/libraries/AP_Compass/AP_Compass.cpp b/libraries/AP_Compass/AP_Compass.cpp index 45eccb97e7..ad7397d061 100644 --- a/libraries/AP_Compass/AP_Compass.cpp +++ b/libraries/AP_Compass/AP_Compass.cpp @@ -1,3 +1,7 @@ +#include "AP_Compass_config.h" + +#if AP_COMPASS_ENABLED + #include #if CONFIG_HAL_BOARD == HAL_BOARD_LINUX #include @@ -2236,3 +2240,5 @@ Compass &compass() } } + +#endif // AP_COMPASS_ENABLED diff --git a/libraries/AP_Compass/AP_Compass_Backend.cpp b/libraries/AP_Compass/AP_Compass_Backend.cpp index c0a7bf973e..7d430c3193 100644 --- a/libraries/AP_Compass/AP_Compass_Backend.cpp +++ b/libraries/AP_Compass/AP_Compass_Backend.cpp @@ -1,3 +1,7 @@ +#include "AP_Compass_config.h" + +#if AP_COMPASS_ENABLED + #include #include "AP_Compass.h" @@ -294,3 +298,5 @@ enum Rotation AP_Compass_Backend::get_board_orientation(void) const { return _compass._board_orientation; } + +#endif // AP_COMPASS_ENABLED