Repository navigation
Description
Summary
When the effect vector is full, WS2812FX::addEffect() returns 255 and no caller checks the return value. The effect is never registered, and there is no log line, no warning, and nothing in the UI to say so. From the user's side the effect simply is not in the build.
This is separate from the effect-count ceiling itself (PR #5108) — it is about the ceiling being hit invisibly. Whatever happens with the limit long-term, hitting it should be diagnosable.
Details:
uint8_t WS2812FX::addEffect(uint8_t id, mode_ptr mode_fn, const char *mode_name) { ... } else if (_mode.size() < 255) { // 255 is reserved for indicating the effect wasn't added _mode.push_back(mode_fn); ... } else { return 255; // The vector is full so return 255 } }
Every usermod I can find calls it as strip.addEffect(255, &mode_x, _data_x); and discards the result, so that branch is invisible at runtime.
With MODE_COUNT at 220, the ceiling is reachable in practice: 255 slots minus 220 built-ins leaves ~35 for all usermods on the device combined — audioreactive, any effect-providing usermod, and anything the user wrote.
Why it is worse than a plain "no space left"
Which effects go missing is not stable. Usermods register from static initialisers across translation units, and the relative order of those is unspecified per-file, so which registrations land in the surviving slots varies with toolchain and link order. The user-visible symptom is "some of my effects are missing, and which ones changes between builds", with nothing anywhere pointing at the cause.
Repro
Build with usermods registering enough effects to exceed 255 total.
Boot. Some effects are absent from the effect list.
No log output, no error, no indication of how many were dropped.
Suggested fix
Small and self-contained:
Log a warning in addEffect() when it returns 255 because the vector is full, including the effect name that was dropped.
Optionally surface remaining free slots (or a dropped-effect count) in the Info page, so it can be seen without a serial console.
Environment
main @ 700c0a4 (17.0.0-devV5); also verified identical on 16.0.1
ESP32, esp32dev, PlatformIO
Hit while developing a usermod that registers ~36+ effects (since trimmed to 33 but would like to add more without adjusting base wled)
Activity
softhack007 commentedon Aug 31, 2026
@Aceftwspades thanks, this is a known limitation - the effect list only has space for 254 effects.
We can add a debug warning when an effect cannot be added to the list, however allowing more than 254 effects is complicated because the "an effect ID is 8bit" assumption is hard-coded in many places, including segments, WLED sync, usermods, etc.
We currently have two ideas to fix this and allow 16bit effect IDs, both still in prove-of-concept status.
if you need more free effect slots, the best method for now is to exclude the "PS" particle system effects with
-D WLED_DISABLE_PARTICLESYSTEM1D-D WLED_DISABLE_PARTICLESYSTEM2D. This removes ~30 effects, but it also removes the 1D/2D particle engines respectively.keeltrace commentedon Sep 10, 2026
AI-assisted design note — no implementation is attached or proposed as a PR. I reviewed the current
maincode paths and related discussions only to summarize the decision space for maintainers. Please treat this as a menu of options, not a recommendation to merge generated code.Reproduction / current behavior
WS2812FX::addEffect()usesuint8_tIDs and reserves255as the failure/auto-allocation sentinel.MODE_COUNTis currently 220, so a normal build has only about 34 additional numeric slots before registration begins failing. A large usermod can cross that threshold by itself; for example, the checked-in Animartrix usermod currently contains 52strip.addEffect(255, ...)registrations.A deterministic reproduction is therefore:
255; callers that discard the return value lose those effects.The limit is not isolated to
addEffect(): 8-bit effect IDs are also present inSegment::mode,_modeCount,setMode(), JSON parsing, presets/helpers, UDP sync packet fields, E1.31 handling, IR paths, and usermods. That is why simply changing one type touint16_twould not be sufficient.Possible directions
A. Keep 8-bit IDs; treat 254 as the compatibility ceiling.
Pros: zero protocol/API migration risk; smallest RAM/flash impact; preserves existing presets, sync packets, integrations and usermods. Existing compile-time feature exclusions can free slots when needed.
Cons: effect-heavy builds remain constrained; users must choose which effect families to compile; the limit becomes more painful as the built-in set grows.
B. Widen effect IDs to 16-bit end-to-end. This is the direct approach explored in WLED-MM.
Pros: simple mental model; numeric IDs continue to work; removes the immediate 254-effect ceiling.
Cons: large migration surface. Segment state, JSON, presets, sync protocols, E1.31/DMX-adjacent paths, IR helpers and usermods all need auditing. UDP compatibility needs an explicit versioning strategy, and RAM/storage costs rise in some structures.
C. Keep legacy 8-bit IDs for compatibility, but add an extended effect registry/addressing path. This is broadly the direction explored by draft PR #5108: legacy IDs remain available where representable, while newer APIs can identify effects by name or another larger handle.
Pros: old integrations can keep working; new effects are no longer forced into the legacy numeric namespace; migration can be incremental.
Cons: two identity systems must coexist; lookup, serialization, random/next-effect behavior, playlists and UI semantics become more complex; names need stability/collision rules if used as identifiers.
D. Introduce banks/pages/namespaces above the existing 8-bit ID. A bank selects a group of <=254 effects, and the current 8-bit ID remains local to that bank.
Pros: preserves many compact 8-bit data structures and could reduce protocol churn compared with a full 16-bit conversion.
Cons: adds statefulness and UX complexity; presets/sync need both bank and ID; cross-bank random/playlist behavior becomes awkward; likely creates more conceptual debt than B or C.
Maintainer choice
I do not think this needs an AI-selected answer. #5837 addresses the immediate diagnostics problem. For the underlying capacity limit, A is the lowest-risk status quo, B is the cleanest numeric expansion, and C is the strongest backward-compatibility architecture; D is included mainly as a middle-ground alternative.
Related work already in the repository/community:
No code was produced for any of these options in this investigation. If maintainers prefer one direction, that choice can drive a separately scoped implementation later.