From adb82e13ee738be652f7dd471e9a0840d84923c1 Mon Sep 17 00:00:00 2001 From: Pierre Kancir Date: Wed, 11 Aug 2021 00:29:32 +0200 Subject: [PATCH] AP_Compass: fix externalAHRS detection 'A = B >= C' kind. The expression is calculated as following: 'A = (B >= C)' --- libraries/AP_Compass/AP_Compass.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libraries/AP_Compass/AP_Compass.cpp b/libraries/AP_Compass/AP_Compass.cpp index 8cc61c8dde..cf41db9b65 100644 --- a/libraries/AP_Compass/AP_Compass.cpp +++ b/libraries/AP_Compass/AP_Compass.cpp @@ -1206,7 +1206,8 @@ void Compass::_probe_external_i2c_compasses(void) void Compass::_detect_backends(void) { #if HAL_EXTERNAL_AHRS_ENABLED - if (int8_t serial_port = AP::externalAHRS().get_port() >= 0) { + const int8_t serial_port = AP::externalAHRS().get_port(); + if (serial_port >= 0) { ADD_BACKEND(DRIVER_SERIAL, new AP_Compass_ExternalAHRS(serial_port)); } #endif