From a501262a6b1b28478ee60f612fbccf0c3a4e7aaf Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Mon, 20 Nov 2023 18:30:57 +1300 Subject: [PATCH] icm45686: fix dt (and usage command) With the wrong dt, the flight behaviour was really poor and noisy, so this fix is absolutely required. Signed-off-by: Julian Oes --- src/drivers/imu/invensense/icm45686/ICM45686.cpp | 4 ++-- src/drivers/imu/invensense/icm45686/ICM45686.hpp | 2 +- src/drivers/imu/invensense/icm45686/icm45686_main.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/drivers/imu/invensense/icm45686/ICM45686.cpp b/src/drivers/imu/invensense/icm45686/ICM45686.cpp index 07fdf6633a..1bd2a12834 100644 --- a/src/drivers/imu/invensense/icm45686/ICM45686.cpp +++ b/src/drivers/imu/invensense/icm45686/ICM45686.cpp @@ -522,7 +522,7 @@ void ICM45686::ProcessAccel(const hrt_abstime ×tamp_sample, const FIFO::DAT accel.dt = (float)timestamp_fifo * ((1.f / _input_clock_freq) * 1e6f); } else { - accel.dt = FIFO_TIMESTAMP_SCALING; + accel.dt = FIFO_SAMPLE_DT; } // 20 bit hires mode @@ -634,7 +634,7 @@ void ICM45686::ProcessGyro(const hrt_abstime ×tamp_sample, const FIFO::DATA gyro.dt = (float)timestamp_fifo * ((1.f / _input_clock_freq) * 1e6f); } else { - gyro.dt = FIFO_TIMESTAMP_SCALING; + gyro.dt = FIFO_SAMPLE_DT; } // 20 bit hires mode diff --git a/src/drivers/imu/invensense/icm45686/ICM45686.hpp b/src/drivers/imu/invensense/icm45686/ICM45686.hpp index f370808772..efcc485b71 100644 --- a/src/drivers/imu/invensense/icm45686/ICM45686.hpp +++ b/src/drivers/imu/invensense/icm45686/ICM45686.hpp @@ -70,7 +70,7 @@ private: void exit_and_cleanup() override; // Sensor Configuration - static constexpr float FIFO_SAMPLE_DT{1e6f / 8000.f}; // 8000 Hz accel & gyro ODR configured + static constexpr float FIFO_SAMPLE_DT{1e6f / 6400.f}; // 6400 Hz accel & gyro ODR configured static constexpr float GYRO_RATE{1e6f / FIFO_SAMPLE_DT}; static constexpr float ACCEL_RATE{1e6f / FIFO_SAMPLE_DT}; diff --git a/src/drivers/imu/invensense/icm45686/icm45686_main.cpp b/src/drivers/imu/invensense/icm45686/icm45686_main.cpp index 8cf88e0597..1951acd989 100644 --- a/src/drivers/imu/invensense/icm45686/icm45686_main.cpp +++ b/src/drivers/imu/invensense/icm45686/icm45686_main.cpp @@ -38,7 +38,7 @@ void ICM45686::print_usage() { - PRINT_MODULE_USAGE_NAME("icm42688p", "driver"); + PRINT_MODULE_USAGE_NAME("icm45686", "driver"); PRINT_MODULE_USAGE_SUBCATEGORY("imu"); PRINT_MODULE_USAGE_COMMAND("start"); PRINT_MODULE_USAGE_PARAMS_I2C_SPI_DRIVER(false, true);