From 2c93b7809cb12b4e0d7d96b5d94b1d96959fecc0 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Mon, 20 Feb 2023 12:05:16 +1100 Subject: [PATCH] AP_Compass: use AP_COMPASS_EXTERNALAHRS_ENABLED more Also rename driver name from serial to externalahrs for consistency --- libraries/AP_Compass/AP_Compass.cpp | 4 ++-- libraries/AP_Compass/AP_Compass.h | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/libraries/AP_Compass/AP_Compass.cpp b/libraries/AP_Compass/AP_Compass.cpp index eef8add899..8384f416c6 100644 --- a/libraries/AP_Compass/AP_Compass.cpp +++ b/libraries/AP_Compass/AP_Compass.cpp @@ -1273,7 +1273,7 @@ void Compass::_detect_backends(void) #if AP_COMPASS_EXTERNALAHRS_ENABLED const int8_t serial_port = AP::externalAHRS().get_port(AP_ExternalAHRS::AvailableSensor::COMPASS); if (serial_port >= 0) { - ADD_BACKEND(DRIVER_SERIAL, new AP_Compass_ExternalAHRS(serial_port)); + ADD_BACKEND(DRIVER_EXTERNALAHRS, new AP_Compass_ExternalAHRS(serial_port)); } #endif @@ -2116,7 +2116,7 @@ void Compass::handle_msp(const MSP::msp_compass_data_message_t &pkt) #if AP_COMPASS_EXTERNALAHRS_ENABLED void Compass::handle_external(const AP_ExternalAHRS::mag_data_message_t &pkt) { - if (!_driver_enabled(DRIVER_SERIAL)) { + if (!_driver_enabled(DRIVER_EXTERNALAHRS)) { return; } for (uint8_t i=0; i<_backend_count; i++) { diff --git a/libraries/AP_Compass/AP_Compass.h b/libraries/AP_Compass/AP_Compass.h index 74050904c0..ede68ec66c 100644 --- a/libraries/AP_Compass/AP_Compass.h +++ b/libraries/AP_Compass/AP_Compass.h @@ -463,7 +463,9 @@ private: #if AP_COMPASS_MSP_ENABLED DRIVER_MSP =17, #endif - DRIVER_SERIAL =18, +#if AP_COMPASS_EXTERNALAHRS_ENABLED + DRIVER_EXTERNALAHRS =18, +#endif DRIVER_MMC5XX3 =19, };