Skip to content

Avoid I2S include on Renesas boards - #3749

Merged
zackees merged 1 commit into
FastLED:masterfrom
mfiumara:fix/renesas-i2s-include
Jul 28, 2026
Merged

zackees merged 1 commit into
FastLED:masterfrom
mfiumara:fix/renesas-i2s-include

Conversation

@mfiumara

@mfiumara mfiumara commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • detect known-broken Renesas Arduino targets before probing for I2S.h
  • keep Arduino I2S audio disabled on those targets without including the unusable header
  • add a regression test with a deliberately poisonous I2S.h

On ArduinoCore-renesas, I2S.h can be discoverable even though including it fails because the bundled FSP does not provide r_i2s_api.h. The existing guard ran only after that include.

Caveat: PlatformIO's Library Dependency Finder may still scan the guarded literal #include <I2S.h> without honoring preprocessor flow. Downstream UNO R4 PlatformIO projects therefore still need lib_ignore = I2S; FastLED CI already applies that exclusion.

Related: arduino/ArduinoCore-renesas#521

Validation

  • uv run pytest ci/tests/test_renesas_i2s_include_guard.py -q
  • uv run ruff check ci/tests/test_renesas_i2s_include_guard.py
  • uv run ruff format --check ci/tests/test_renesas_i2s_include_guard.py
  • bash compile uno_r4_wifi Blink --backend platformio

The default fbuild path was also attempted, but its current macOS ARM toolchain URL returns HTTP 404 before compilation starts.

Summary by CodeRabbit

  • Bug Fixes

    • Improved Arduino I2S compatibility on Renesas and UNO R4 boards by safely disabling unsupported I2S functionality when required platform headers are unavailable.
    • Prevented problematic I2S headers from causing preprocessing failures.
    • Improved detection and reporting of incomplete I2S libraries missing required mode constants.
  • Tests

    • Added regression coverage to verify Renesas I2S support remains safely disabled under affected conditions.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Renesas Arduino I2S detection now disables known-broken targets before probing I2S.h. A pytest regression test verifies preprocessing succeeds with a poisonous I2S.h and leaves full I2S support disabled.

Changes

Renesas I2S include guard

Layer / File(s) Summary
Early Renesas support guard
src/platforms/arduino/audio_input.hpp
Known-broken Renesas and UNO R4 targets are disabled before I2S.h probing, and I2S mode-constant validation remains explicit.
Poisonous header regression test
ci/tests/test_renesas_i2s_include_guard.py
The test runs the preprocessor with temporary Arduino.h and failing I2S.h headers, asserting preprocessing succeeds without enabling full I2S support.

Estimated code review effort: 3 (Moderate) | ~15–30 minutes

Suggested reviewers: zackees

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: skipping the I2S include on Renesas boards.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ 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.

@fastled-project-sync fastled-project-sync Bot moved this to In Progress in FastLED Tracker Jul 28, 2026
@mfiumara
mfiumara marked this pull request as ready for review July 28, 2026 11:59
@fastled-project-sync fastled-project-sync Bot moved this from In Progress to Triage in FastLED Tracker Jul 28, 2026

@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)
ci/tests/test_renesas_i2s_include_guard.py (1)

1-53: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Move the Renesas include-guard test into the CI platform test suite.

This is a minor regression case but currently lives in a standalone new file. Add/remove the test according to the project’s platform/compiler test convention; per the Python guidelines, minor test additions should be consolidated into existing test files rather than creating new ones.

🤖 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 `@ci/tests/test_renesas_i2s_include_guard.py` around lines 1 - 53, Move
test_renesas_guard_skips_poisonous_i2s_header into the existing CI
platform/compiler test module that covers Arduino audio include guards, and
remove the standalone test file. Preserve the test’s current compiler discovery,
temporary header setup, preprocessing command, and ARDUINO_I2S_FULLY_SUPPORTED
assertion.

Source: Coding guidelines

🤖 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 `@ci/tests/test_renesas_i2s_include_guard.py`:
- Around line 1-53: Move test_renesas_guard_skips_poisonous_i2s_header into the
existing CI platform/compiler test module that covers Arduino audio include
guards, and remove the standalone test file. Preserve the test’s current
compiler discovery, temporary header setup, preprocessing command, and
ARDUINO_I2S_FULLY_SUPPORTED assertion.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 29354d19-1b1b-43fb-a908-cfe97abf7716

📥 Commits

Reviewing files that changed from the base of the PR and between 70002b8 and 42d9448.

📒 Files selected for processing (2)
  • ci/tests/test_renesas_i2s_include_guard.py
  • src/platforms/arduino/audio_input.hpp

@zackees
zackees merged commit 4da8f6b into FastLED:master Jul 28, 2026
2 checks passed
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Jul 28, 2026
zackees added a commit that referenced this pull request Jul 28, 2026
Found while checking PR #3749's new test against the ratchet. Running

    subprocess_capture_checker.py ci/tests/some_file.py

reported "239 baselined subprocess usage(s) are now gone" -- because the
improvement check compared the whole baseline against a single file's
findings. Every entry for a file that was simply not examined counted as
fixed.

That message is wrong on its own, but the dangerous part is the action it
invites: adding --update-baseline to that same narrow command rewrote the
baseline from just that file, silently deleting the other 128 entries and
turning the ratchet off across the repo. The next raw Popen would have gone
in unnoticed.

Both halves now key off the set of files actually scanned:

- --update-baseline merges instead of overwriting, keeping entries for
  unscanned files verbatim. A file that genuinely improved still shrinks or
  drops out, so the ratchet can still be tightened incrementally.
- The "now gone" note only counts entries for files this run looked at.

Also drops the two check_array_params/check_noexcept SRC004 entries that
#3747 resolved -- the baseline was generated just before that merged, so it
was stale by exactly those two.

Tests cover the narrow-update case, the misleading note, that a rescanned
file can still shrink, and that a genuinely new violation still fails. The
first three fail against the previous implementation.

Validated: 556 passed / 39 skipped in ci/tests, lint green.

Co-Authored-By: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants