From b9b49cf8c4183b767a21f57bd91b25582acfcdb2 Mon Sep 17 00:00:00 2001 From: Marin Doetterer Date: Tue, 13 Oct 2026 10:54:25 +0200 Subject: [PATCH] fix(driver/AUAV): naming and documentation --- src/drivers/differential_pressure/auav/AUAV.cpp | 8 ++++---- src/drivers/differential_pressure/auav/AUAV.hpp | 6 +++--- src/drivers/differential_pressure/auav/AUAV_Absolute.cpp | 2 +- src/drivers/differential_pressure/auav/AUAV_Absolute.hpp | 2 +- .../differential_pressure/auav/AUAV_Differential.cpp | 2 +- .../differential_pressure/auav/AUAV_Differential.hpp | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/drivers/differential_pressure/auav/AUAV.cpp b/src/drivers/differential_pressure/auav/AUAV.cpp index d1a3c147436..4ba8c6277e4 100644 --- a/src/drivers/differential_pressure/auav/AUAV.cpp +++ b/src/drivers/differential_pressure/auav/AUAV.cpp @@ -59,12 +59,12 @@ I2CSPIDriverBase *AUAV::instantiate(const I2CSPIDriverConfig &config, const int return instance; } -AUAV::AUAV(const I2CSPIDriverConfig &config, const uint8_t status_byte) : +AUAV::AUAV(const I2CSPIDriverConfig &config, const uint8_t status_byte_expected) : I2C(config), I2CSPIDriver(config), _sample_perf(perf_alloc(PC_ELAPSED, MODULE_NAME": read")), _comms_errors(perf_alloc(PC_COUNT, MODULE_NAME": comms errors")), - _status_byte(status_byte) + _status_byte_expected(status_byte_expected) { I2C::_retries = 5; } @@ -126,7 +126,7 @@ int AUAV::probe() int status = transfer(nullptr, 0, &res_data, 1); /* Check that the sensor is powered on, error free and of the expected type (mode bits) */ - if (status == PX4_OK && res_data == _status_byte) { + if (status == PX4_OK && res_data == _status_byte_expected) { return PX4_OK; } @@ -203,7 +203,7 @@ void AUAV::handle_state_gather_measurement() int status = transfer(nullptr, 0, res_data, sizeof(res_data)); /* Continue processing if the transfer was a success and the status is as expected (powered on, not busy, no errors) */ - if (status == PX4_OK && res_data[0] == _status_byte) { + if (status == PX4_OK && res_data[0] == _status_byte_expected) { const hrt_abstime timestamp_sample = hrt_absolute_time(); const uint32_t pressure_raw = (res_data[1] << 16) | (res_data[2] << 8) | (res_data[3]); diff --git a/src/drivers/differential_pressure/auav/AUAV.hpp b/src/drivers/differential_pressure/auav/AUAV.hpp index eb0aa08a19b..223ea93bbae 100644 --- a/src/drivers/differential_pressure/auav/AUAV.hpp +++ b/src/drivers/differential_pressure/auav/AUAV.hpp @@ -49,7 +49,7 @@ static constexpr uint32_t I2C_SPEED = 100 * 1000; // 100 kHz I2C serial interfac class AUAV : public device::I2C, public I2CSPIDriver { public: - explicit AUAV(const I2CSPIDriverConfig &config, const uint8_t status_byte); + explicit AUAV(const I2CSPIDriverConfig &config, const uint8_t status_byte_expected); virtual ~AUAV(); static I2CSPIDriverBase *instantiate(const I2CSPIDriverConfig &config, const int runtime_instance); @@ -131,12 +131,12 @@ protected: * bit 0: ALU error (0 = ok) * bit 1: reserved (0) * bit 2: memory error (0 = ok) - * bit 3-4: mode (differential: 0b01, absolute: 0b00) + * bit 3-4: mode (differential: 0b10, absolute: 0b00) * bit 5: busy (0 = measurement ready) * bit 6: power on (1) * bit 7: reserved (0) */ - const uint8_t _status_byte; + const uint8_t _status_byte_expected; private: int probe() override; diff --git a/src/drivers/differential_pressure/auav/AUAV_Absolute.cpp b/src/drivers/differential_pressure/auav/AUAV_Absolute.cpp index f660c5b9849..1b808992ebf 100644 --- a/src/drivers/differential_pressure/auav/AUAV_Absolute.cpp +++ b/src/drivers/differential_pressure/auav/AUAV_Absolute.cpp @@ -34,7 +34,7 @@ #include "AUAV_Absolute.hpp" AUAV_Absolute::AUAV_Absolute(const I2CSPIDriverConfig &config) : - AUAV(config, STATUS_BYTE_ABS), + AUAV(config, STATUS_BYTE_EXPECTED_ABS), _baro_external(config.external) { } diff --git a/src/drivers/differential_pressure/auav/AUAV_Absolute.hpp b/src/drivers/differential_pressure/auav/AUAV_Absolute.hpp index 10391d026fd..5cf441db84f 100644 --- a/src/drivers/differential_pressure/auav/AUAV_Absolute.hpp +++ b/src/drivers/differential_pressure/auav/AUAV_Absolute.hpp @@ -58,7 +58,7 @@ static_assert(ABS_CONVERSION_INTERVAL >= 7000, "Conversion interval is too fast" static constexpr float MBAR_TO_PA = 100.0f; /* Status byte of a completed reading without error */ -static constexpr uint8_t STATUS_BYTE_ABS = 0x40; +static constexpr uint8_t STATUS_BYTE_EXPECTED_ABS = 0x40; class AUAV_Absolute : public AUAV { diff --git a/src/drivers/differential_pressure/auav/AUAV_Differential.cpp b/src/drivers/differential_pressure/auav/AUAV_Differential.cpp index b4ae2dcc928..112b8f71cea 100644 --- a/src/drivers/differential_pressure/auav/AUAV_Differential.cpp +++ b/src/drivers/differential_pressure/auav/AUAV_Differential.cpp @@ -36,7 +36,7 @@ #include AUAV_Differential::AUAV_Differential(const I2CSPIDriverConfig &config) : - AUAV(config, STATUS_BYTE_DIFF) + AUAV(config, STATUS_BYTE_EXPECTED_DIFF) { /* Initialize cal_range from parameter as fallback value */ int32_t hw_model = 0; diff --git a/src/drivers/differential_pressure/auav/AUAV_Differential.hpp b/src/drivers/differential_pressure/auav/AUAV_Differential.hpp index e19efec57fa..3c436316d25 100644 --- a/src/drivers/differential_pressure/auav/AUAV_Differential.hpp +++ b/src/drivers/differential_pressure/auav/AUAV_Differential.hpp @@ -56,7 +56,7 @@ static constexpr int64_t DIFF_CONVERSION_INTERVAL = (1000000 / DIFF_MEAS_RATE); static_assert(DIFF_CONVERSION_INTERVAL >= 7000, "Conversion interval is too fast"); /* Status byte of a completed reading without error */ -static constexpr uint8_t STATUS_BYTE_DIFF = 0x50; +static constexpr uint8_t STATUS_BYTE_EXPECTED_DIFF = 0x50; /* Valid AUAV types */ static constexpr int32_t AUAV_LD_05 = 5;