From 9ec6a4b1d7a6b9da99fdfa919de24918e0787637 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Mon, 20 Feb 2023 14:39:31 +1300 Subject: [PATCH] icm42688p: fix comment about gyro and accel bits This really confused me. Signed-off-by: Julian Oes --- src/drivers/imu/invensense/icm42688p/ICM42688P.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/drivers/imu/invensense/icm42688p/ICM42688P.cpp b/src/drivers/imu/invensense/icm42688p/ICM42688P.cpp index e4ad620f89..df4178554f 100644 --- a/src/drivers/imu/invensense/icm42688p/ICM42688P.cpp +++ b/src/drivers/imu/invensense/icm42688p/ICM42688P.cpp @@ -642,7 +642,7 @@ void ICM42688P::ProcessAccel(const hrt_abstime ×tamp_sample, const FIFO::DA accel.timestamp_sample = timestamp_sample; accel.samples = 0; - // 18-bits of accelerometer data + // 18-bits of accelerometer data, sent as 20-bits, 2 least significant bits always 0 bool scale_20bit = false; // first pass @@ -738,7 +738,7 @@ void ICM42688P::ProcessGyro(const hrt_abstime ×tamp_sample, const FIFO::DAT gyro.timestamp_sample = timestamp_sample; gyro.samples = 0; - // 20-bits of gyroscope data + // 19-bits of gyroscope data sent as 20-bits, LSB bit is 0 bool scale_20bit = false; // first pass @@ -775,6 +775,7 @@ void ICM42688P::ProcessGyro(const hrt_abstime ×tamp_sample, const FIFO::DAT scale_20bit = true; } + // shift by 1 (least significant bit is always 0) gyro.x[gyro.samples] = gyro_x / 2; gyro.y[gyro.samples] = gyro_y / 2; gyro.z[gyro.samples] = gyro_z / 2;