Skip to content

Fix Teensy Audio selection on low-memory boards - #2702

Merged
zackees merged 2 commits into
masterfrom
fix/2406-teensy30-audio-gate
Jun 3, 2026
Merged

zackees merged 2 commits into
masterfrom
fix/2406-teensy30-audio-gate

Conversation

@zackees

@zackees zackees commented Jun 3, 2026 •

Copy link
Copy Markdown
Member

Fixes #2406.

Summary

  • Add a central Teensy audio configuration header that disables PJRC Audio input on Teensy LC and Teensy 3.0 by default.
  • Hide optional Teensy Audio includes behind macro includes so fbuild does not pull PJRC libraries/Audio into low-memory builds while normal compiler behavior is preserved when the feature is enabled.
  • Keep Teensy off the generic Arduino I2S backend.
  • Filter the AudioInput example to large-memory Teensy boards and ESP32.
  • Add a sketch-filter regression test for the AudioInput board selection.

Validation

  • uv run pytest ci/tests/test_sketch_filter.py -q -> 68 passed.
  • bash compile --no-interactive --no-parallel --max-failures 1 --backend=fbuild teensy30 AnalogOutput -> pass, flash 29.65 KB / 128 KB, RAM 4.06 KB / 16 KB.
  • bash compile --no-interactive --no-parallel --max-failures 1 --backend=fbuild teensylc Blink -> pass, flash 38.51 KB / 62 KB, RAM 4.48 KB / 8 KB.
  • Final fbuild compile databases for those two repro builds contain no libraries/Audio entries.
  • Final map files show .dmabuffers reduced to 0xf8 on Teensy 3.0 and 0xc0 on Teensy LC.
  • bash compile --no-interactive --no-parallel --max-failures 1 --backend=fbuild teensylc all -> 30/30 selected examples passed.
  • bash compile --no-interactive --no-parallel --max-failures 1 --backend=fbuild teensy30 all -> 31/32 wrapper-level successes; WS2816 hit a transient fbuild daemon stream error, and a direct fbuild retry of the generated WS2816 build exited 0 with no RAM overflow.

Summary by CodeRabbit

  • Improvements

    • Refined Teensy audio input detection with improved board-specific filtering (memory-aware) and clearer Teensy/library availability handling.
  • Examples

    • Updated several example sketches to include Teensy audio headers conditionally so the build scanner recognizes PJRC Audio sources.
  • Tests

    • Added tests validating audio-input filter behavior across multiple Teensy and ESP32 board variants.

@coderabbitai

coderabbitai Bot commented Jun 3, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 088b830c-18f3-4997-906a-41f96017d4e3

📥 Commits

Reviewing files that changed from the base of the PR and between 83fef76 and 83b64b0.

📒 Files selected for processing (10)
  • ci/tests/test_sketch_filter.py
  • examples/Animartrix/Animartrix.ino
  • examples/AnimartrixRing/AnimartrixRing.ino
  • examples/Audio/Audio.ino
  • examples/AudioInput/TeensyAudioInput.h
  • examples/AudioReactive/AudioReactive.ino
  • examples/AudioUrl/AudioUrl.ino
  • examples/BeatDetection/BeatDetection.ino
  • examples/ElPanelReactive/ElPanelReactive.ino
  • examples/Sailboat/Sailboat.ino
✅ Files skipped from review due to trivial changes (5)
  • examples/AudioReactive/AudioReactive.ino
  • examples/AudioInput/TeensyAudioInput.h
  • examples/AnimartrixRing/AnimartrixRing.ino
  • examples/Sailboat/Sailboat.ino
  • examples/BeatDetection/BeatDetection.ino

📝 Walkthrough

Walkthrough

This PR centralizes Teensy audio-library detection into a shared config header, rewires platform detection and conditional includes to use those macros, updates the AudioInput example filter to exclude small-RAM Teensy targets, and adds CI tests that validate the sketch filter behavior for AudioInput and BeatDetection.

Changes

Teensy Audio Configuration Consolidation

Layer / File(s) Summary
Teensy Audio Configuration Header
src/platforms/arm/teensy/audio_input_teensy_config.h
Introduces FASTLED_USES_TEENSY_AUDIO_INPUT and TEENSY_AUDIO_LIBRARY_AVAILABLE macros that detect Teensy Audio Library support per-board, disabling support on Teensy 3.0 and LC (low-memory targets).
Platform Detection & Include Wiring
src/platforms/audio.h, src/fl/audio/audio_input.cpp.hpp, src/platforms/arm/teensy/audio_input_teensy.h, src/platforms/arm/teensy/_build.cpp.hpp
Includes the new config header at shared detection points and switches Teensy audio gating to the centralized macros; conditionally includes Teensy-specific audio implementation when enabled.

Examples and CI Validation

Layer / File(s) Summary
Examples: add Teensy Audio includes
examples/... (Audio, AudioReactive, AudioUrl, Animartrix, AnimartrixRing, BeatDetection, ElPanelReactive, Sailboat), examples/AudioInput/TeensyAudioInput.h
Adds #if defined(FL_IS_TEENSY) guards that include PJRC Audio.h in multiple examples and helper headers so the build/library scanner detects Teensy Audio sources.
AudioInput filter and CI tests
examples/AudioInput/AudioInput.ino, ci/tests/test_sketch_filter.py
Updates AudioInput.ino @filter to require memory is large for Teensy targets and adds TestAudioInputFilter and TestBeatDetectionFilter tests that parse sketch filters and assert should_skip_sketch outcomes for specified Teensy/ESP32 boards.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • FastLED/FastLED#2573: Both PRs update example @filter directives to avoid building on low-memory Teensy boards and validate skip logic via filter parsing and should_skip_sketch checks.

Poem

🐰 A tiny rabbit hops in code so bright,
He nudges Teensy guards into the light,
Filters now skip too-small boards,
Tests confirm the right accords,
And builds sleep soundly through the night.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: fixing Teensy Audio selection specifically on low-memory boards (Teensy 3.0 and LC).
Linked Issues check ✅ Passed All coding objectives from issue #2406 are met: a Teensy audio configuration header disables PJRC Audio on Teensy 3.0/LC, macro-controlled includes hide optional audio libraries from fbuild, AudioInput example is filtered to large-memory boards, and regression tests are added.
Out of Scope Changes check ✅ Passed All changes are scoped to addressing #2406: Teensy audio gating, fbuild library scanning, example filtering, and test coverage. Conditional Audio.h includes in examples support the fbuild scanner awareness without changing runtime logic.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/2406-teensy30-audio-gate

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.

@zackees
zackees merged commit 223f13f into master Jun 3, 2026
6 checks passed
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Jun 3, 2026
@zackees
zackees deleted the fix/2406-teensy30-audio-gate branch August 21, 2026 19:15
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.

Teensy 3.0 / LC link-time RAM overflow (.dmabuffers / .bss) across all examples

1 participant