From c520a598b242c2b2a5e2ca7ac7ce0f360b7c6cf2 Mon Sep 17 00:00:00 2001 From: Jacob Dahl <37091262+dakejahl@users.noreply.github.com> Date: Tue, 27 Oct 2026 18:05:53 -0800 Subject: [PATCH] feat(drivers/adis16507): report the model, serial and firmware in status (#29463) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(drivers/adis16507): log the gyro range at info level The -1, -2 and -3 models (±125, ±500, ±2000 °/s) share PROD_ID, so RANG_MDL is the only way to tell which one is fitted. At debug level a board built with the wrong model looks normal from the console. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Jacob Dahl * feat(drivers/adis16507): report the model, serial and firmware in status A production test can query the model on demand instead of catching a log line that Configure() prints after the reset sequence, once `start` has already returned. The range messages are dropped since status carries the model. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Jacob Dahl --------- Signed-off-by: Jacob Dahl --- .../analog_devices/adis16507/ADIS16507.cpp | 23 ++++++++++--------- .../analog_devices/adis16507/ADIS16507.hpp | 6 +++++ 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/drivers/imu/analog_devices/adis16507/ADIS16507.cpp b/src/drivers/imu/analog_devices/adis16507/ADIS16507.cpp index ee035bff4ff..9ac6e2d6ab0 100644 --- a/src/drivers/imu/analog_devices/adis16507/ADIS16507.cpp +++ b/src/drivers/imu/analog_devices/adis16507/ADIS16507.cpp @@ -103,12 +103,13 @@ int ADIS16507::probe() return PX4_ERROR; } - const uint16_t serial = RegisterRead(Register::SERIAL_NUM); - const uint16_t rev = RegisterRead(Register::FIRM_REV); - const uint16_t daymonth = RegisterRead(Register::FIRM_DM); - const uint16_t year = RegisterRead(Register::FIRM_Y); + _serial_number = RegisterRead(Register::SERIAL_NUM); + _firmware_revision = RegisterRead(Register::FIRM_REV); + _firmware_day_month = RegisterRead(Register::FIRM_DM); + _firmware_year = RegisterRead(Register::FIRM_Y); - PX4_INFO("Serial Number: 0x%X, Firmware revision: 0x%X Date: Y %X DM %X", serial, rev, year, daymonth); + PX4_INFO("Serial Number: 0x%X, Firmware revision: 0x%X Date: Y %X DM %X", _serial_number, _firmware_revision, _firmware_year, + _firmware_day_month); return PX4_OK; } @@ -151,20 +152,17 @@ bool ADIS16507::Configure() const uint16_t gyro_range = (rang_mdl & (Bit3 | Bit2)) >> 2; if (gyro_range == 0b11) { - PX4_DEBUG("Gyro Range ±2000°/sec"); - // 11 = ±2000°/sec (ADIS16507-3BMLZ) + _model = "ADIS16507-3BMLZ (gyro ±2000°/s)"; _px4_gyro.set_range(math::radians(2000.f)); _px4_gyro.set_scale(math::radians(1.f / 10.f)); // scaling 10 LSB/°/sec -> rad/s per LSB } else if (gyro_range == 0b01) { - PX4_DEBUG("Gyro Range ±500°/sec"); - // 01 = ±500°/sec (ADIS16507-2BMLZ) + _model = "ADIS16507-2BMLZ (gyro ±500°/s)"; _px4_gyro.set_range(math::radians(500.f)); _px4_gyro.set_scale(math::radians(1.f / 40.f)); // scaling 40 LSB/°/sec -> rad/s per LSB } else if (gyro_range == 0b00) { - PX4_DEBUG("Gyro Range ±125°/sec"); - // 00 = ±125°/sec (ADIS16507-1BMLZ) + _model = "ADIS16507-1BMLZ (gyro ±125°/s)"; _px4_gyro.set_range(math::radians(125.f)); _px4_gyro.set_scale(math::radians(1.f / 160.f)); // scaling 160 LSB/°/sec -> rad/s per LSB } @@ -504,6 +502,9 @@ bool ADIS16507::RegisterCheck(uint16_t reg, uint16_t val) void ADIS16507::print_status() { I2CSPIDriverBase::print_status(); + PX4_INFO("Model: %s", _model); + PX4_INFO("Serial: 0x%X", _serial_number); + PX4_INFO("Firmware: revision 0x%X, date Y %X DM %X", _firmware_revision, _firmware_year, _firmware_day_month); perf_print_counter(_reset_perf); perf_print_counter(_bad_transfer_perf); diff --git a/src/drivers/imu/analog_devices/adis16507/ADIS16507.hpp b/src/drivers/imu/analog_devices/adis16507/ADIS16507.hpp index 55a89006824..9845783dbde 100644 --- a/src/drivers/imu/analog_devices/adis16507/ADIS16507.hpp +++ b/src/drivers/imu/analog_devices/adis16507/ADIS16507.hpp @@ -108,6 +108,12 @@ private: bool _self_test_passed{false}; + const char *_model{"unknown"}; + uint16_t _serial_number{0}; + uint16_t _firmware_revision{0}; + uint16_t _firmware_day_month{0}; + uint16_t _firmware_year{0}; + enum class STATE : uint8_t { RESET, WAIT_FOR_RESET,