From 669cb6563be818711e57e0fade02c30bbca159b4 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 18 Aug 2024 09:05:45 +1000 Subject: [PATCH] AP_GPS: allow for EAHRS_SENSORS to not include GPS this allows external AHRS GPS to not be presented to AP_GPS as a possible driver --- libraries/AP_GPS/AP_GPS.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libraries/AP_GPS/AP_GPS.cpp b/libraries/AP_GPS/AP_GPS.cpp index d6a541a06d..2492e8f737 100644 --- a/libraries/AP_GPS/AP_GPS.cpp +++ b/libraries/AP_GPS/AP_GPS.cpp @@ -652,8 +652,11 @@ AP_GPS_Backend *AP_GPS::_detect_instance(uint8_t instance) #endif #if HAL_EXTERNAL_AHRS_ENABLED case GPS_TYPE_EXTERNAL_AHRS: - dstate->auto_detected_baud = false; // specified, not detected - return NEW_NOTHROW AP_GPS_ExternalAHRS(*this, params[instance], state[instance], nullptr); + if (AP::externalAHRS().get_port(AP_ExternalAHRS::AvailableSensor::GPS) >= 0) { + dstate->auto_detected_baud = false; // specified, not detected + return NEW_NOTHROW AP_GPS_ExternalAHRS(*this, params[instance], state[instance], nullptr); + } + break; #endif #if AP_GPS_GSOF_ENABLED case GPS_TYPE_GSOF: