AP_Compass: use AP_COMPASS_EXTERNALAHRS_ENABLED more

Also rename driver name from serial to externalahrs for consistency
This commit is contained in:
Peter Barker 2023-02-20 12:05:16 +11:00 committed by Andrew Tridgell
parent bd33f5894b
commit 2c93b7809c
2 changed files with 5 additions and 3 deletions

View File

@ -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++) {

View File

@ -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,
};