diff --git a/libraries/AP_Compass/examples/AP_Compass_test/AP_Compass_test.pde b/libraries/AP_Compass/examples/AP_Compass_test/AP_Compass_test.pde index 7476b4c7e8..366aac0366 100644 --- a/libraries/AP_Compass/examples/AP_Compass_test/AP_Compass_test.pde +++ b/libraries/AP_Compass/examples/AP_Compass_test/AP_Compass_test.pde @@ -10,7 +10,9 @@ #include #include #include +#include #include +#include #include // ArduPilot Mega Vector/Matrix math Library #include @@ -18,11 +20,20 @@ const AP_HAL::HAL& hal = AP_HAL_BOARD_DRIVER; -#if CONFIG_HAL_BOARD == HAL_BOARD_PX4 -AP_Compass_PX4 compass; +#define CONFIG_COMPASS HAL_COMPASS_DEFAULT + +#if CONFIG_COMPASS == HAL_COMPASS_PX4 +static AP_Compass_PX4 compass; +#elif CONFIG_COMPASS == HAL_COMPASS_VRBRAIN +static AP_Compass_VRBRAIN compass; +#elif CONFIG_COMPASS == HAL_COMPASS_HMC5843 +static AP_Compass_HMC5843 compass; +#elif CONFIG_COMPASS == HAL_COMPASS_HIL +static AP_Compass_HIL compass; #else -AP_Compass_HMC5843 compass; + #error Unrecognized CONFIG_COMPASS setting #endif + uint32_t timer; void setup() {