chore(v16): add support for more IMU hardware#7482
Conversation
📝 WalkthroughWalkthroughAdds ChangesICM42627 & SC7U22 IMU wiring for Horus X10 V16
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@radio/src/drivers/icm42627.cpp`:
- Around line 95-97: The reset command write failure in the if statement
checking write_cmd(ICM42627_DEVICE_CONFIG_REG, ICM42627_RESET) is currently only
logging a trace message and continuing execution, which leaves the sensor in a
partially configured state. Instead of just logging the error with TRACE, the
function gyro42627Init() should return a failure status immediately when
write_cmd returns a value less than 0, ensuring that a failed reset is treated
as a fatal error that prevents the initialization from succeeding.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 69dca07d-df01-4e69-9876-7b5e910f91fa
📒 Files selected for processing (5)
radio/src/drivers/icm42627.cppradio/src/drivers/icm42627.hradio/src/targets/horus/CMakeLists.txtradio/src/targets/horus/board.cppradio/src/targets/horus/hal.h
|
Is this duplicated #7232? |
Well, some modifications were made to make it compatible with more gyroscope models |
|
The problem is that it is a duplicate of #7232, while also extending it ... i.e. if I merge #7232 first (which I was intending to do before I saw Richard's mention of this PR), there would most likely be conflicts for merging this one. Because the intention was to enhance on #7232, I'll still merge that first and then update this so it can be merged after. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
radio/src/targets/horus/CMakeLists.txt (1)
119-120: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAlign SC7U22 source gating with macro gating.
Line 119-120 enables
IMU_SC7U22underPCBREVconditions, while Line 301-303 compilesdrivers/sc7u22.cppunderFLAVOURconditions. Keeping these predicates identical avoids config drift between symbol usage and source inclusion.Suggested diff
-if(FLAVOUR STREQUAL v16) +if(PCB STREQUAL X10 AND PCBREV STREQUAL V16) target_sources(board PRIVATE drivers/sc7u22.cpp) endif()Also applies to: 301-303
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@radio/src/targets/horus/CMakeLists.txt` around lines 119 - 120, The SC7U22 macro definition and source file compilation are gated by different CMake conditions, creating a mismatch between symbol definition and actual source inclusion. The add_definitions(-DIMU_SC7U22) uses PCBREV conditions (line 119-120), while the drivers/sc7u22.cpp compilation uses FLAVOUR conditions (around line 301-303). Update the conditional check for compiling drivers/sc7u22.cpp to use the same PCBREV condition as the macro definition to ensure consistency between when the symbol is defined and when the source is actually compiled.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@radio/src/targets/horus/CMakeLists.txt`:
- Around line 119-120: The SC7U22 macro definition and source file compilation
are gated by different CMake conditions, creating a mismatch between symbol
definition and actual source inclusion. The add_definitions(-DIMU_SC7U22) uses
PCBREV conditions (line 119-120), while the drivers/sc7u22.cpp compilation uses
FLAVOUR conditions (around line 301-303). Update the conditional check for
compiling drivers/sc7u22.cpp to use the same PCBREV condition as the macro
definition to ensure consistency between when the symbol is defined and when the
source is actually compiled.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: ef937371-3c40-42dd-99ca-e65522192f7d
📒 Files selected for processing (4)
radio/src/drivers/icm42627.hradio/src/targets/horus/CMakeLists.txtradio/src/targets/horus/board.cppradio/src/targets/horus/hal.h
✅ Files skipped from review due to trivial changes (1)
- radio/src/drivers/icm42627.h
🚧 Files skipped from review as they are similar to previous changes (1)
- radio/src/targets/horus/board.cpp
The gyroscope of V16 has been enhanced with multi-chip dynamic loading functionality
The future should support more devices
Summary by CodeRabbit