AP_Compass: add a probe method to AP_Compass_ExternalAHRS

this allows for the creation of the backend to fail gracefully

without this the backend will still have a value of 0, and will still get updated, overwriting the data for one of the registered compasses
This commit is contained in:
Peter Barker
2025-09-23 08:59:56 +09:00
committed by Randy Mackay
parent e2b737cfa3
commit 39a4032f70
3 changed files with 16 additions and 7 deletions
+1 -1
View File
@@ -1373,7 +1373,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_EXTERNALAHRS, NEW_NOTHROW AP_Compass_ExternalAHRS(serial_port));
ADD_BACKEND(DRIVER_EXTERNALAHRS, AP_Compass_ExternalAHRS::probe(serial_port));
}
#endif