Skip to content

Skip RxChannel auto-naming in release builds (companion to #2943) #2954

Closed

Description

@zackees

Goal

Apply the same release-gate to `RxChannel::makeName` that #2943 applied to `Channel::makeName`. The auto-naming branch synthesizes `"RxChannel_"` purely for diagnostic consumption; in release builds (NDEBUG → `FASTLED_LOG_VERBOSITY=0` per #2890) every FL_WARN/FL_ERROR site that reads the name collapses, so the string + `fl::to_string` + heap concat run for nothing.

Parent: #2886 — symmetry win against #2943.

Why this is a real win

`src/fl/channels/rx/channel.cpp.hpp:46-51`:

```cpp
fl::string RxChannel::makeName(i32 id, const fl::string& config_name) FL_NOEXCEPT {
if (!config_name.empty()) {
return config_name;
}
return "RxChannel_" + fl::to_string(static_cast(id));
}
```

This is the exact pattern #2943 fixed for `Channel::makeName` — the difference is just the prefix (`"RxChannel_"` instead of `"Channel_"`) and the config-name source (a `fl::string` rather than an `fl::optionalfl::string`).

RxChannel is reachable from `src/platforms/esp/32/drivers/rmt_rx/rmt_rx_channel.cpp.hpp` + `src/platforms/esp/32/drivers/gpio_isr_rx/gpio_isr_rx.cpp.hpp`. Whether it ends up in a TX-only NEOPIXEL Blink's transitive closure depends on the linker's dead-strip — the post-merge bloat regression run will tell us directly via `tests/test_esp32s3_bloat_regression.py`.

Even if the saving on the stock Blink baseline is 0 B (RxChannel may not be reachable), this is correct hygiene that matches the #2943 idiom — and any future sketch that uses an RX channel inherits the saving.

Deliverable

`src/fl/channels/rx/channel.cpp.hpp` — gate the auto-naming

```cpp
fl::string RxChannel::makeName(i32 id, const fl::string& config_name) FL_NOEXCEPT {
if (!config_name.empty()) {
return config_name;
}
#if FASTLED_LOG_RUNTIME_ENABLED
return "RxChannel_" + fl::to_string(static_cast(id));
#else
(void)id;
return {};
#endif
}
```

User-provided names (`config.name.empty() == false`) are unaffected — they keep their explicit value in both debug and release.

Behavior matrix

Build config_name mName value
Debug (`FASTLED_LOG_VERBOSITY=1`) non-empty config_name
Debug empty `"RxChannel_"`
Release (`FASTLED_LOG_VERBOSITY=0`) non-empty config_name
Release empty `""` (empty)

Acceptance

  1. `bash lint --cpp` passes.
  2. Behaviour preserved in debug builds.
  3. Bloat regression gate either passes with positive headroom (RxChannel reachable in Blink) or reports zero delta (not reachable). Either is fine — the fix is correct symmetry.

Expected savings

Projected 0-200 B on the Blink baseline (depending on RxChannel reachability), but any user-built RX sketch gains the same dead-strip cascade #2943 measured (−1,845 B observed).

Out of scope

  • Refactoring the `RxChannel` API surface. Public name accessor unchanged.
  • Removing the `mName` field. Cost is a single `fl::string` (16-24 bytes per channel object) and keeping it symmetrical with `Channel` aids readers.

Related

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions