Skip to content

feat(esp8266): UART WS2812 engine as Bus::UART; retire FASTLED_ESP8266_UART (#4944) - #4952

Merged
zackees merged 2 commits into
masterfrom
feat/4944-esp8266-uart-bus
Oct 28, 2026
Merged

zackees merged 2 commits into
masterfrom
feat/4944-esp8266-uart-bus

Conversation

@zackees

@zackees zackees commented Oct 27, 2026

Copy link
Copy Markdown
Member

Stacked on #4951 (#4942). Fixes #4944. Part of #4949.

Problem

The UART1 (GPIO2) WS2812 driver was compiled in but only reachable when
FASTLED_ESP8266_UART was defined before FastLED.h — the code-enabling define
the tracking issue bans.

Change (template selection, not a code-enabling define)

  • uart_channel_driver.{h,cpp.hpp} (new) — Esp8266UartChannelDriver
    encodes a clockless channel's LED bytes into the UART1 6N1-inverted frame
    stream (four UART bytes per LED byte, two LED bits per frame) and shifts them
    out, reusing the proven esp8266_uart:: helpers. canHandle() accepts only a
    clockless channel on GPIO2 (UART1 TX is fixed there).
  • uart_bus_traits.h (new) — specializes BusTraits<Bus::UART> +
    BusSupports<Bus::UART, ClocklessChipset>; naming Bus::UART keeps the TU,
    everything else dead-strips (feat(channels): compile-time Bus binding via templated ChannelConfig (eliminates Channel API binary bloat) #2428).
  • Selection is explicit. The driver is deliberately not registered by
    FastLED.enableAllDrivers() — a user selects it with
    add<Bus::UART, ClocklessChipset>() / enableDriver<Bus::UART>(), so an
    ordinary pin-2 clockless strip keeps the bit-bang driver (no behavior change).
  • Retire FASTLED_ESP8266_UART — fastled_esp8266.h includes the UART
    header + its bus_traits unconditionally; the define is a no-op.
  • compile_test.hpp covers the Bus::UART specialization; the
    examples/Esp8266Uart sketch + READMEs move to define-free usage (legacy
    controller and channel-API paths both shown).

Test plan / evidence

  • bash compile esp8266 --examples Blink,Esp8266Uart both succeed (the UART
    driver TU compiles in the unity build).
  • compile_test.hpp asserts run on every ESP8266 build.
  • On-device capture of a WS2812 frame driven over UART1 is the remaining
    acceptance step (needs a board).

Agents that read AGENTS.md now get the same instructions as Claude.
A relative symlink (not a copy) so the two can never drift.
…6_UART

The UART1 (GPIO2) WS2812 driver was reachable only when FASTLED_ESP8266_UART
was defined before FastLED.h -- the code-enabling define the tracking issue
bans. Expose the engine as a template-selected channel driver instead.

- Esp8266UartChannelDriver encodes a clockless channel's LED bytes into the
  UART1 6N1-inverted frame stream (four UART bytes per LED byte) and shifts
  them out, reusing the host-proven esp8266_uart:: helpers. canHandle()
  accepts only a clockless channel on GPIO2 (UART1 TX is fixed there).
- uart_bus_traits.h specializes BusTraits<Bus::UART> + BusSupports<Bus::UART,
  ClocklessChipset>, so naming Bus::UART keeps the TU and everything else
  dead-strips (#2428).
- The driver is deliberately NOT registered by enableAllDrivers(): selection
  is explicit (add<Bus::UART, ClocklessChipset>() or enableDriver<Bus::UART>()),
  so an ordinary pin-2 clockless strip keeps the bit-bang driver.
- Retire FASTLED_ESP8266_UART: fastled_esp8266.h now includes the UART header
  and its bus_traits unconditionally; the define is a no-op.
- compile_test.hpp covers the Bus::UART specialization; example + READMEs
  updated to the define-free usage.

Verified: bash compile esp8266 --examples Blink,Esp8266Uart both succeed.

Refs #4944, #4949.
@coderabbitai

coderabbitai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Caution

Review failed

The pull request is closed.

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@zackees

zackees commented Oct 27, 2026

Copy link
Copy Markdown
Member Author

Memory check (fbuild bloat, Blink, esp8266)

uv run ci/bloat.py esp8266 compared against the master baseline:

master this stack Δ
image_flash 264,671 B 264,667 B -4 B
attributed flash 203,252 B 203,249 B -3 B
RAM 6,808 B 6,808 B 0 B

No memory regression: the unused ESP8266 engines are dead-stripped (template selection + linker elimination), so naming none of them costs ~nothing, as intended (#2428).

@zackees
zackees changed the base branch from feat/4942-esp8266-hspi-bus to master October 28, 2026 00:23
@zackees
zackees merged commit 8dea50b into master Oct 28, 2026
3 checks passed
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Oct 28, 2026
@zackees
zackees deleted the feat/4944-esp8266-uart-bus branch November 5, 2026 05:52
TKDFusion pushed a commit to TKDFusion/Software-FastLED-FASTLED that referenced this pull request Nov 8, 2026
…rule (FastLED#4940)

Umbrella for the ESP8266 define-elimination epic (FastLED#4949): state the rule and
guard it.

- agents/docs/cpp-standards.md: new REQUIRED section 'Driver selection is by
  template, never a code-enabling define' with the BusTraits/BusSupports shape
  and the retired offenders (FASTLED_ESP8266_UART, FASTLED_ALL_PINS_HARDWARE_SPI,
  FL_ESP8266_EMBEDDED_FS).
- ci/lint_cpp/driver_enable_define_checker.py (new): a Python FileContentChecker
  that flags a preprocessor guard wrapping a 'platforms/...' include under
  src/platforms/** in an FL_*/FASTLED_* macro -- the code-enabling-define shape.
  The guards shipping today are grandfathered in
  driver_enable_define_amnesty.txt (regenerate with --generate-amnesty); new ones
  fail. Registered in run_all_checkers.py.
- ci/tests/test_driver_enable_define_checker.py (new): flagged/allowed cases plus
  a tree-wide check that the amnesty still covers src/platforms. Wired into
  PY_SMOKE (guard in test_native_ci_modes.py bumped 9 -> 10).

The three conversions land in FastLED#4951 / FastLED#4952 / FastLED#4953; this PR is the rule + guard.

Refs FastLED#4940, FastLED#4949.
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.

ESP8266: UART WS2812 driver should be template-selected, not FASTLED_ESP8266_UART

1 participant