From b6cb9bc3e5a0c6dd0eb371ed1ca3b8138d19b46c Mon Sep 17 00:00:00 2001 From: zzaurak <25051056+zzaurak@users.noreply.github.com> Date: Sun, 21 Apr 2024 09:48:09 +0200 Subject: [PATCH] AP_Airspeed: ND210 pressure value type bugfix uint->int & some fixes after rebase --- libraries/AP_Airspeed/AP_Airspeed_ND210.cpp | 2 +- libraries/AP_Airspeed/AP_Airspeed_ND210.h | 6 +----- libraries/AP_Airspeed/AP_Airspeed_config.h | 4 ++++ 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libraries/AP_Airspeed/AP_Airspeed_ND210.cpp b/libraries/AP_Airspeed/AP_Airspeed_ND210.cpp index 0ef6740da737b..27e816a011159 100644 --- a/libraries/AP_Airspeed/AP_Airspeed_ND210.cpp +++ b/libraries/AP_Airspeed/AP_Airspeed_ND210.cpp @@ -240,7 +240,7 @@ void AP_Airspeed_ND210::_timer() return; } - uint16_t P = (((uint16_t)val[0]) << 8) | val[1]; + int16_t P = (((int16_t)val[0]) << 8) | val[1]; float diff_pressure_h20 = (float(P) / ND210_SCALE_PRESSURE_ND210) * _selected_pressure_range; // GCS_SEND_TEXT(MAV_SEVERITY_ERROR, "ND210 Raw Pressure = 0x%02X", P); diff --git a/libraries/AP_Airspeed/AP_Airspeed_ND210.h b/libraries/AP_Airspeed/AP_Airspeed_ND210.h index ee527f12d4d68..d236729d3c600 100644 --- a/libraries/AP_Airspeed/AP_Airspeed_ND210.h +++ b/libraries/AP_Airspeed/AP_Airspeed_ND210.h @@ -14,11 +14,7 @@ */ #pragma once -#include - -#ifndef AP_AIRSPEED_ND210_ENABLED -#define AP_AIRSPEED_ND210_ENABLED AP_AIRSPEED_BACKEND_DEFAULT_ENABLED -#endif +#include "AP_Airspeed_config.h" #if AP_AIRSPEED_ND210_ENABLED diff --git a/libraries/AP_Airspeed/AP_Airspeed_config.h b/libraries/AP_Airspeed/AP_Airspeed_config.h index f12db5cb16c4e..6a648652204ac 100644 --- a/libraries/AP_Airspeed/AP_Airspeed_config.h +++ b/libraries/AP_Airspeed/AP_Airspeed_config.h @@ -71,3 +71,7 @@ #ifndef AP_AIRSPEED_EXTERNAL_ENABLED #define AP_AIRSPEED_EXTERNAL_ENABLED AP_AIRSPEED_ENABLED && HAL_EXTERNAL_AHRS_ENABLED #endif + +#ifndef AP_AIRSPEED_ND210_ENABLED +#define AP_AIRSPEED_ND210_ENABLED AP_AIRSPEED_ENABLED +#endif \ No newline at end of file