Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/main/target/ORBITF435/target.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "drivers/pinio.h"
#include "drivers/sensor.h"

BUSDEV_REGISTER_SPI_TAG(busdev_lsm6dxx, DEVHW_LSM6D, LSM6DXX_SPI_BUS, LSM6DXX_CS_PIN, NONE, 0, DEVFLAGS_NONE, IMU_LSM6DXX_ALIGN);
BUSDEV_REGISTER_SPI_TAG(busdev_icm42688, DEVHW_ICM42605, ICM42688_SPI_BUS, ICM42688_CS_PIN, NONE, 0, DEVFLAGS_NONE, IMU_ICM42688_ALIGN);

timerHardware_t timerHardware[] = {
Expand Down
5 changes: 5 additions & 0 deletions src/main/target/ORBITF435/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@
#define ICM42688_CS_PIN PA4
#define ICM42688_SPI_BUS BUS_SPI1

#define USE_IMU_LSM6DXX
#define IMU_LSM6DXX_ALIGN CW270_DEG
#define LSM6DXX_SPI_BUS BUS_SPI1
#define LSM6DXX_CS_PIN PA4
Comment on lines +98 to +101

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

1. Slow gyro autodetect boot 🐞 Bug ➹ Performance

On ORBITF435 builds with both ICM42605 and LSM6DXX enabled, gyro init always starts from
GYRO_AUTODETECT and will attempt ICM42605 detection first; on LSM6DXX hardware this adds ~0.9s of
delay before it can fall through to LSM6DXX detection. This slows boot and can make startup timing
less reliable on the new LSM6DSK320X-equipped boards.
Agent Prompt
## Issue description
On ORBITF435, this PR enables `USE_IMU_LSM6DXX` while keeping `USE_IMU_ICM42605` enabled. Gyro init always runs `GYRO_AUTODETECT` and probes ICM first; when the physical IMU is LSM6DSK320X, the ICM driver’s detect routine performs multiple delayed retries before failing, adding a noticeable boot delay.

## Issue Context
- `gyroInit()` always calls `gyroDetect(..., GYRO_AUTODETECT)` (not target-configurable today), so every enabled gyro driver in the detection chain may be probed.
- The ICM42605 detect path includes repeated `delay(150)` retries.

## Fix Focus Areas
Pick one approach (preferably aligned with how ORBITF435 hardware is actually shipping):

1) **If ORBITF435 is now LSM6DSK320X-only**
- Remove ICM42605/42688 enablement and its busdev registration from the ORBITF435 target so autodetect doesn’t spend time probing an IMU that will never be present.

2) **If ORBITF435 must support both IMUs in one firmware**
- Consider introducing a target-specific way to bias detection order / reduce worst-case probe latency when multiple IMUs share a footprint (e.g., a faster “non-matching device” exit path in the ICM detect routine, without breaking cold-start ICM detection).

### Code references
- src/main/target/ORBITF435/target.h[84-102]
- src/main/sensors/gyro.c[151-234]
- src/main/sensors/gyro.c[321-346]
- src/main/drivers/accgyro/accgyro_icm42605.c[288-318]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


// *************** I2C(Baro & I2C) **************************
#define USE_I2C
#define USE_BARO
Expand Down
Loading