Skip to content

fix(memory): keep ChannelOptions and new color profiles out of legacy controllers and AVR #4784

Closed

Description

@zackees

Context

Legacy CLEDController and FastLED.addLeds() are the memory-conscious API. ChannelOptions and the newer emitter/source color-profile configuration belong exclusively to the Channels API. The maintainer explicitly requested restoring this boundary and removing the new profile machinery from AVR and legacy addLeds().

The dashboard's matched Uno AVR Blink measurements at FastLED master ce225edab6df477b86fac772640d353f3db45902 show:

Metric 3.10.3 Measured master
Physical static RAM 131 B 266 B
Flash 3,784 B 3,914 B
NEOPIXEL controller object 24 B 87 B
Controller scratch array 16 B 32 B

Evidence: dashboard measurements, 3.10.3 Blink symbols, measured-master Blink symbols. Use physical RAM totals; symbol attribution includes aliased vtables and is not interchangeable with physical RAM.

The current AVR field layout reserves 53 bytes per controller for runtime profile binding and its warning flags: 33 bytes of source primaries/transfer function, 8 bytes of target white, and 12 bytes of ownership pointers, policy, and flags. This is a source-layout accounting result, not a measured firmware saving yet. Blink never configures a color profile.

How this happened

  • Commit e092fd506c grouped existing legacy settings into LEDSettings in November 2025.
  • Commit 268b73f518 replaced LEDSettings with ChannelOptions in December 2025 while adding channel engine affinity. Subsequent ChannelOptions fields therefore enlarged every legacy controller.
  • PR #4161, merged September 2026, added runtime profile state, base-controller profile accessors, and a profile template overload on legacy addLeds().
  • Later rendering/power integration relies on those base-controller hooks. Layout protection excluded only the <=1 KB tiny-memory tier; Uno has 2 KB SRAM and carries the profile state.
  • PR #4750 reduced padding but retained the shared ownership of configuration. It did not restore the API boundary.

The traditional LEDColorCorrection and ColorTemperature enums are RGB multipliers and must remain available. They are distinct from the new EmitterProfile, source-space, gamut, target-white, and response-LUT system.

Proposal

  1. Restore compact legacy settings in CLEDController; remove its ChannelOptions member and dependency. Preserve correction, temperature, dithering, enabled state, and supported legacy white-channel behavior.
  2. Give fl::Channel ownership of its own ChannelOptions. Update constructors, applyConfig(), profile reconciliation, and rendering to use Channel-owned configuration. Explicitly synchronize the legacy rendering settings that Channels still needs; avoid hidden duplicate profile state.
  3. Remove new color-profile binding APIs, StaticProfileClocklessController, and the new profile-template overload from legacy FastLED.addLeds(). Keep profile selection through the Channels API. Remove profile-specific virtual hooks from the legacy base and route managed rendering/power access through Channel-owned integration.
  4. Explicitly exclude the new profile machinery from AVR. AVR legacy Blink must retain no new profile state, initialization, or pipeline code. Unsupported profile requests must report their lack of support rather than silently claim managed output.
  5. Update tests and documentation to enforce the corrected API boundary. Existing tests that require profile identity through a legacy controller or profiled legacy addLeds() encode the behavior being reversed and need replacement.

Touch points and compatibility risks

  • src/fl/channels/cled_controller.h, src/cled_controller.cpp.hpp, src/fl/channels/options.h, src/fl/channels/channel.h, and src/fl/channels/channel.cpp.hpp.
  • src/FastLED.h, src/FastLED.cpp.hpp, src/fl/channels/pipeline_binding.cpp.hpp, and src/power_mgt.cpp.hpp: preserve mixed legacy/Channel rendering and power accounting, profile lifetime guarantees, and profile reconciliation when global correction/temperature setters traverse the base-controller list.
  • src/fl/chipsets/ucs7604.h reads gamma from inherited mSettings. Move its required configuration to the driver rather than imposing Channels configuration on every controller; preserve its existing output.
  • Preserve supported legacy RGBW/RGBWW behavior and chipset-owned white-channel policies. Removing profile state must not remove unrelated driver capabilities.
  • Removal of the newer profile-specific legacy overloads is intentional. Document migration to Channel::create<Profile>() / FastLED.add<Profile>(ChannelConfig) on supported platforms.

Acceptance criteria

  • Focused RED -> GREEN evidence: establish a failing legacy-layout/dependency regression and record matched Uno Blink baseline before implementation; the implementation makes the regression pass.
  • CLEDController contains no ChannelOptions, runtime color-profile binding, source-space/target-white state, or profile warning flags; new profile binding is exclusive to Channels.
  • New profile-specific legacy addLeds() overloads and profile-specific base virtual hooks are removed; old correction/temperature enum APIs and output remain supported.
  • AVR legacy Blink retains no new profile symbols, initialization, or storage. Verify on the real AVR toolchain, not only a host layout approximation.
  • Rebuild the exact dashboard Uno Blink sketch using matched board configuration, compiler flags, core, and toolchain. Preserve before/after ELF, symbol reports, provenance, controller size, physical static RAM, and flash totals. Report the measured savings; do not equate the 53-byte field estimate with the final firmware delta.
  • Verify legacy correction, temperature, dithering, white-channel output, and the affected UCS7604 gamma path; verify Channel profile rendering, rebinding, and mixed legacy/Channel power behavior.
  • Permanent tests prevent future ChannelOptions additions from enlarging legacy controllers and cover settings changed through the global/base-controller APIs.
  • Run repository lint, required native/sanitizer tests, and code review. Tighten relevant size budgets only to observed values; do not increase ceilings.

Decisions

  • Ownership is split by API on all platforms; changing only Uno's memory-tier classification would leave the architectural regression in place.
  • AVR Blink is the measurement and optimization target for this issue. Other benchmark workloads and unrelated scratch-array/timer reductions are outside scope.
  • Preserve traditional correction/temperature enums. The newer profile-specific legacy API is intentionally withdrawn in favor of Channels.
  • This authorizes the targeted settings/profile ownership correction described above. It does not authorize broad driver, build/unity, workflow, or whole-system refactoring.

Related issues

Completion evidence

Delivered by merged PRs #4785 and #4786. Final source commit: 619b7763a9eae5ff3d899fded553835c8e61cdf7. Fresh matched dashboard Uno Blink build from git-archived final merge source: 3762 bytes flash /168 bytes physical static RAM, versus3914/266 before. Savings: 152 bytes flash /98 bytes RAM. Concrete NEOPIXEL controller:87→27 bytes. No retained EmitterProfile, StreamingPipeline, ProfileBinding or soft-float symbols. Final ELF SHA256: ae719342287d9e87051cda318d86ba4b3d724ecaea2732c0e1abdc50c77e8fda. Preserved final build, ELF, report and provenance under .build/issue4784/merged-final; baseline artifacts remain under .build/issue4784/before.

Full final-head hosted validation:120 passing checks, one skipped CodeRabbit check, one confirmed pre-existing ATmega8 capacity failure. Intel macOS retry passed after its initial dependency-download timeout. ESP32-S3 size gate passes350151 bytes unchanged. Local full sanitizer suite319 unit targets/95 examples, full Python suite, focused compatibility regressions, lint and independent review pass. The follow-up ensures AVR base white setters remain authoritative without new virtual slots or storage. Both PRs are merged and this issue is closed.

Activity

  1. zackees commented on Oct 8, 2026

    @zackees
    MemberAuthor

    Merged-source verification for #4784: PR #4785 merged as d7ea050; issue closure verified. Fresh git-archive source build of the matched dashboard Uno Blink yields 3762 bytes flash /168 bytes physical static RAM, versus3914/266 before: 152 flash /98 RAM saved. Concrete NEOPIXEL controller is27 bytes versus87. Compiler/core/config are unchanged; before/after ELF, build logs, source provenance and symbol reports are retained in .build/issue4784. Final outside-diff AVR white-setting review correction is tracked separately in #4786; it also measures3762/168.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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