From fad42e8c9c6cd1868124aa717eb0d5c044fda29a Mon Sep 17 00:00:00 2001 From: Pierre Kancir Date: Wed, 11 Aug 2021 00:33:49 +0200 Subject: [PATCH] AP_InertialSensor: fix externalAHRS detection 'A = B >= C' kind. The expression is calculated as following: 'A = (B >= C)' --- libraries/AP_InertialSensor/AP_InertialSensor.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libraries/AP_InertialSensor/AP_InertialSensor.cpp b/libraries/AP_InertialSensor/AP_InertialSensor.cpp index 1d913aa512..68663a9e24 100644 --- a/libraries/AP_InertialSensor/AP_InertialSensor.cpp +++ b/libraries/AP_InertialSensor/AP_InertialSensor.cpp @@ -938,7 +938,8 @@ AP_InertialSensor::detect_backends(void) #if HAL_EXTERNAL_AHRS_ENABLED // if enabled, make the first IMU the external AHRS - 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(new AP_InertialSensor_ExternalAHRS(*this, serial_port)); } #endif