From 3043ab6b0123bf7c460fb57e5045d8fdae6efaa9 Mon Sep 17 00:00:00 2001 From: Pierre Kancir Date: Wed, 11 Aug 2021 00:30:52 +0200 Subject: [PATCH] AP_Baro: fix externalAHRS detection 'A = B >= C' kind. The expression is calculated as following: 'A = (B >= C)' --- libraries/AP_Baro/AP_Baro.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libraries/AP_Baro/AP_Baro.cpp b/libraries/AP_Baro/AP_Baro.cpp index cf266e7ae8..50c5e9af6b 100644 --- a/libraries/AP_Baro/AP_Baro.cpp +++ b/libraries/AP_Baro/AP_Baro.cpp @@ -531,7 +531,8 @@ void AP_Baro::init(void) #endif #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(new AP_Baro_ExternalAHRS(*this, serial_port)); } #endif