Skip to content

Fixes for grove and i2c changes#31

Merged
KenVanHoeylandt merged 3 commits into
TactilityProject:mainfrom
Shadowtrance:fixes
Jun 19, 2026
Merged

Fixes for grove and i2c changes#31
KenVanHoeylandt merged 3 commits into
TactilityProject:mainfrom
Shadowtrance:fixes

Conversation

@Shadowtrance

@Shadowtrance Shadowtrance commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features
    • Added shared Grove discovery helpers to locate the correct I2C and UART controllers automatically.
  • Bug Fixes
    • Updated multiple test units to use Grove-based I2C/UART detection instead of hardcoded device names, improving setup on different Grove configurations.
    • Improved “device not found” messaging to reflect the Grove port/controller.
    • Optimized PaHub probing to check only supported unit addresses (instead of a full bus scan) for more reliable initialization.
  • Chores
    • Updated MIDI UART targeting to the Grove UART controller.

@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 340f224a-d5ba-4eec-b6b1-18078113ad2d

📥 Commits

Reviewing files that changed from the base of the PR and between 10c26c8 and 36d49c8.

📒 Files selected for processing (4)
  • Apps/M5UnitTest/main/Source/GroveLookup.cpp
  • Apps/M5UnitTest/main/Source/GroveLookup.h
  • Apps/M5UnitTest/main/Source/TestUnitMidi.cpp
  • Apps/M5UnitTest/main/Source/TestUnitMidi.h
💤 Files with no reviewable changes (1)
  • Apps/M5UnitTest/main/Source/TestUnitMidi.h
✅ Files skipped from review due to trivial changes (1)
  • Apps/M5UnitTest/main/Source/GroveLookup.h

📝 Walkthrough

Walkthrough

A new GroveLookup.h/GroveLookup.cpp module is added to M5UnitTest exposing two public helpers: findGroveI2cDevice() and findGroveUartDevice(). Each helper iterates over children of the GROVE_TYPE device, selects the first ready child whose type and grove mode match the requested controller (I2C or UART). All unit test modules (TestUnit8Encoder, TestUnitByteButton, TestUnitCardKB2, TestUnitJoystick2, TestUnitLcd, TestUnitLcdGfx, TestUnitPaHub, TestUnitRfid2, TestUnitScroll, TestUnitMidi) are updated to include GroveLookup.h and call these helpers instead of hardcoded device_find_by_name("i2c1"/"uart1") calls; "not found" UI messages are updated accordingly. TestUnitMidi.h changes its UART_DEVICE constant from "uart1" to "grove0_uart". UnitCommon.h gains a KNOWN_UNIT_ADDRS static constexpr array of known M5Stack STM32 Grove unit I2C addresses, used by TestUnitPaHub::probeSelected() in place of a full bus range scan.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Fixes for grove and i2c changes' is vague and generic, using non-specific terms like 'fixes' and 'changes' that don't convey the actual scope of work. Provide a more specific title that describes the main change, such as 'Replace hardcoded I2C/UART device names with Grove lookup functions' or 'Refactor device discovery to use Grove helper functions'.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
Apps/M5UnitTest/main/Source/TestUnitMidi.h (1)

21-21: Refactor UART device lookup to use GroveLookup abstraction for consistency.

Line 21 hardcodes a device name constant that is resolved via device_find_by_name(UART_DEVICE) in TestUnitMidi.cpp (line 87). Other migrated modules use findGroveUartDevice() abstraction instead. Adopting the same pattern improves maintainability and ensures MIDI benefits from any device discovery improvements made to the abstraction layer.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0fa9f4c9-4317-429a-8681-4c43e9343ecc

📥 Commits

Reviewing files that changed from the base of the PR and between dbf850c and 10c26c8.

📒 Files selected for processing (13)
  • Apps/M5UnitTest/main/Source/GroveLookup.cpp
  • Apps/M5UnitTest/main/Source/GroveLookup.h
  • Apps/M5UnitTest/main/Source/TestUnit8Encoder.cpp
  • Apps/M5UnitTest/main/Source/TestUnitByteButton.cpp
  • Apps/M5UnitTest/main/Source/TestUnitCardKB2.cpp
  • Apps/M5UnitTest/main/Source/TestUnitJoystick2.cpp
  • Apps/M5UnitTest/main/Source/TestUnitLcd.cpp
  • Apps/M5UnitTest/main/Source/TestUnitLcdGfx.cpp
  • Apps/M5UnitTest/main/Source/TestUnitMidi.h
  • Apps/M5UnitTest/main/Source/TestUnitPaHub.cpp
  • Apps/M5UnitTest/main/Source/TestUnitRfid2.cpp
  • Apps/M5UnitTest/main/Source/TestUnitScroll.cpp
  • Libraries/M5UnitModules/Include/UnitCommon.h

Comment thread Apps/M5UnitTest/main/Source/GroveLookup.cpp Outdated
@KenVanHoeylandt KenVanHoeylandt merged commit a0c1b25 into TactilityProject:main Jun 19, 2026
19 checks passed
@KenVanHoeylandt

Copy link
Copy Markdown
Contributor

Thanks again!

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.

2 participants