Skip to content

Fix bugs in ICM-45686 IMU driver (PR #11418)#11455

Open
sensei-hacker wants to merge 1 commit intoiNavFlight:maintenance-9.xfrom
sensei-hacker:icm45686-driver
Open

Fix bugs in ICM-45686 IMU driver (PR #11418)#11455
sensei-hacker wants to merge 1 commit intoiNavFlight:maintenance-9.xfrom
sensei-hacker:icm45686-driver

Conversation

@sensei-hacker
Copy link
Copy Markdown
Member

@sensei-hacker sensei-hacker commented Mar 25, 2026

Summary

This PR fixes several issues in the ICM-45686 IMU driver introduced in #11418. The driver structure and INAV integration are correct; these are targeted fixes to specific issues found during review.

Changes

  • settings.yaml: Fix unquoted ICM45686 string in acc_hardware table (YAML parse error)
  • accgyro_icm45686.c: Fix accel LPF fallback — was writing ODR_DIV_8 again instead of BYPASS on IREG failure (comment said BYPASS, code did not match; gyro fallback was correct)
  • accgyro_icm45686.c: Fix IREG polling — replace delay(1) (1 ms) with delayMicroseconds(10) to match the waited_us counter units; previous code had a ~100x timeout overrun
  • accgyro_icm45686.c: Fix reset polling — replace while(1) with do/while pattern consistent with all other drivers in the codebase
  • accgyro_icm45686.c: Fix temperature formula — use 12.8f float literal instead of 12.8 double to avoid soft-float promotion on F4 targets
  • accgyro_icm45686.c: Add named constant ICM456XX_INT_CONFIG_DELAY_MS for the post-interrupt-config settle delay
  • accgyro_icm45686.c: Remove unused endianness defines (ICM456XX_RA_SREG_CTRL, ICM456XX_SREG_DATA_ENDIAN_SEL_*) kept "for future use"
  • All modified files: Add missing trailing newlines

Testing

  • Built successfully against STM32F722 target with USE_IMU_ICM45686 enabled — zero warnings or errors
  • Hardware testing not performed (no ICM-45686 hardware available); the original PR author should verify on hardware before merge

Related

Fixes issues found during review of #11418.

- Fix settings.yaml: quote "ICM45686" string in acc_hardware table
- Fix accel LPF fallback: write BYPASS not ODR_DIV_8 on IREG failure
- Fix IREG polling: use delayMicroseconds(10) not delay(1) to match waited_us counter
- Fix reset polling: replace while(1) with do/while pattern used by all other drivers
- Fix temperature formula: use float literals (12.8f) to avoid double promotion on F4
- Add named constant ICM456XX_INT_CONFIG_DELAY_MS for post-interrupt settle delay
- Remove unused endianness defines (ICM456XX_RA_SREG_CTRL, SREG_DATA_ENDIAN_SEL_*)
- Add missing trailing newlines to all modified files
@github-actions
Copy link
Copy Markdown

Test firmware build ready — commit 6358ec0

Download firmware for PR #11455

228 targets built. Find your board's .hex file by name on that page (e.g. MATEKF405SE.hex). Files are individually downloadable — no GitHub login required.

Development build for testing only. Use Full Chip Erase when flashing.

@sensei-hacker
Copy link
Copy Markdown
Member Author

@Yuri-Sharapov
Can you please review these changes and see what you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant