From 5f4a50de05d7e9eba9e0703a2aec2f4b79fcbfc1 Mon Sep 17 00:00:00 2001 From: Dominic Clifton Date: Tue, 13 Jul 2021 14:01:23 +0200 Subject: [PATCH] ICM426xx - Avoid long startup delays when target allows 42605 and 42688P. If the target has a 42688P sensor there is a 20*150ms (3 second) delay caused by the 42605 driver's detect code. The 42605/42688P sensors are pin-compatible so it makes sense that a target would specify BOTH sensors to allow flexibility in manufacturing. --- src/main/drivers/accgyro/accgyro_spi_icm42605.c | 3 +++ src/main/drivers/accgyro/accgyro_spi_icm42688p.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/main/drivers/accgyro/accgyro_spi_icm42605.c b/src/main/drivers/accgyro/accgyro_spi_icm42605.c index 31a7a9a04..e195d03a4 100644 --- a/src/main/drivers/accgyro/accgyro_spi_icm42605.c +++ b/src/main/drivers/accgyro/accgyro_spi_icm42605.c @@ -126,6 +126,9 @@ uint8_t icm42605SpiDetect(const extDevice_t *dev) case ICM42605_WHO_AM_I_CONST: icmDetected = ICM_42605_SPI; break; + case ICM42688P_WHO_AM_I_CONST: + icmDetected = ICM_42688P_SPI; + break; default: icmDetected = MPU_NONE; break; diff --git a/src/main/drivers/accgyro/accgyro_spi_icm42688p.c b/src/main/drivers/accgyro/accgyro_spi_icm42688p.c index df13774d5..9476dd412 100644 --- a/src/main/drivers/accgyro/accgyro_spi_icm42688p.c +++ b/src/main/drivers/accgyro/accgyro_spi_icm42688p.c @@ -123,6 +123,9 @@ uint8_t icm42688PSpiDetect(const extDevice_t *dev) delay(150); const uint8_t whoAmI = spiReadRegMsk(dev, MPU_RA_WHO_AM_I); switch (whoAmI) { + case ICM42605_WHO_AM_I_CONST: + icmDetected = ICM_42605_SPI; + break; case ICM42688P_WHO_AM_I_CONST: icmDetected = ICM_42688P_SPI; break; -- 2.11.4.GIT