Skip to content

[Bug] Multiple instance interface no longer functioning #2371

Closed

Description

@nomakewan

Board / MCU

ESP32-S3

LED Chipset

WS2812B / NeoPixel

FastLED Version

master#7767ad1

Arduino / PlatformIO version

PlatformIO 6.1.19

Operating System

Windows

Description

When using the split-interface addressing feature of FastLED, the strips no longer show any output. If using the standard global instance, all strips output as expected.

When I say "split-interface addressing" what I mean is code that calls FastLED.addLeds twice in setup(), then instead of calling the global FastLED.show(); to write to all LEDs at once it instead calls:

FastLED[0].showLeds(255);
FastLED[1].showLeds(255);

This method works perfectly in FastLED 3.10.3 and earlier.

Steps to reproduce

  1. Have code that uses FastLED[0].showLeds(255); and FastLED[1].showLeds(255); instead of FastLED.show().
  2. See that the LED strips have no output.

Minimal sketch

#include <FastLED.h>
#define BARREL_LED_PIN 41
#define BARREL_LEDS_MAX 50
CRGB barrel_leds[BARREL_LEDS_MAX];

#define TOP_LED_PIN 42
#define VENT_LEDS_MAX 2
CRGB vent_leds[VENT_LEDS_MAX];

void setup() {
  FastLED.addLeds<NEOPIXEL, BARREL_LED_PIN>(barrel_leds, BARREL_LEDS_MAX).setCorrection(TypicalLEDStrip);
  FastLED.setMaxRefreshRate(0);

  FastLED.addLeds<NEOPIXEL, TOP_LED_PIN>(vent_leds, VENT_LEDS_MAX).setCorrection(TypicalLEDStrip);

  FastLED.show();

  for(uint8_t i = 0; i < BARREL_LEDS_MAX; i++) {
    barrel_leds[i] = CRGB::Green;
  }

  vent_leds[0] = CRGB::Red;
  vent_leds[1] = CRGB::Blue;
}

void loop() {
  EVERY_N_MILLISECONDS(750) {
    FastLED[0].showLeds(255);
    if(barrel_leds[0]) {
      for(uint8_t i = 0; i < BARREL_LEDS_MAX; i++) {
        barrel_leds[i] = CRGB::Black;
      }
    }
    else {
      for(uint8_t i = 0; i < BARREL_LEDS_MAX; i++) {
        barrel_leds[i] = CRGB::Green;
      }
    }
  }

  EVERY_N_MILLISECONDS(500) {
    FastLED[1].showLeds(255);
    CRGB temp_leds[1];
    temp_leds[0] = vent_leds[1];
    vent_leds[1] = vent_leds[0];
    vent_leds[0] = temp_leds[0];
  }
}

Checklist

  • I have searched existing issues for duplicates
  • I have tested with the latest FastLED release or git master
  • I can reproduce this with a minimal sketch

Activity

  1. added
    status: triage
    type: bug
    on Apr 22, 2026
  2. zackees commented on Apr 22, 2026

    @zackees
    Member

    Investigated this against master / 7767ad1. This looks like a regression in the direct per-controller show path after the ESP32 RMT5 path moved onto the ChannelManager architecture.

    What is happening:

    • On ESP32-S3 with current master, NEOPIXEL / WS2812 goes through ClocklessIdf5, which inherits from fl::Channel.
    • FastLED[0].showLeds(255) enters the legacy CLEDController::showLeds() path: beginShowLeds() -> showLedsInternal() -> endShowLeds().
    • For a Channel, showLedsInternal() reaches Channel::showPixels().
    • Channel::showPixels() encodes the pixel bytes and calls driver->enqueue(mChannelData), but it does not start transmission.
    • The actual hardware transmission is started later by ChannelManager::onEndFrame(), which calls entry.driver->show() for the registered drivers.
    • ChannelManager::onEndFrame() is fired by FastLED.show(), but it is not fired by direct CLEDController::showLeds().

    So FastLED[0].showLeds() / FastLED[1].showLeds() currently queue channel data, but never flush the queue to the RMT driver. That matches the symptom: global FastLED.show() works, but indexed controller showLeds() produces no output.

    This also explains why FastLED 3.10.3 worked: the old ESP32 RMT5 controller was self-contained. Its showPixels() loaded data into the RMT controller, and its endShowLeds() directly called mRMTController.showPixels(). The current channel-backed controller depends on the frame-end ChannelManager flush instead.

    Temporary workaround: use FastLED.show(). If the sketch needs to update only one strip at a time, a possible workaround is to temporarily disable the other controllers with setEnabled(false), call FastLED.show(), then restore them. That keeps execution on the global frame path that actually flushes ChannelManager.

    Likely library fix: make the direct per-controller showLeds() path trigger channel-driver transmission for Channel-backed controllers, or make direct controller shows emit the same relevant frame-end flush that FastLED.show() emits. The important part is that driver->enqueue() must be followed by the channel driver show() step for this API to remain compatible.

  3. zackees commented on Apr 22, 2026

    @zackees
    Member

    Design note for the fix:

    The compatibility fix should be gated to large-memory/channel-capable builds only. We do not want small-memory legacy targets to pull in EngineEvents, ChannelManager, or other channel/event objects from a dead path.

    Recommended shape:

    VIRTUAL_IF_NOT_AVR void showLeds(fl::u8 brightness) FL_NOEXCEPT {
    #if FASTLED_HAS_ENGINE_EVENTS
        fl::EngineEvents::onBeginFrame();
    #endif
    
        void* data = beginShowLeds(mLeds.size());
        showLedsInternal(brightness);
        endShowLeds(data);
    
    #if FASTLED_HAS_ENGINE_EVENTS
        fl::EngineEvents::onEndFrame();      // flushes ChannelManager queued data
        fl::EngineEvents::onEndShowLeds();   // parity with FastLED.show()
    #endif
    }

    Why this guard:

    • FASTLED_HAS_ENGINE_EVENTS already defaults to SKETCH_HAS_LARGE_MEMORY.
    • ESP32 platforms have SKETCH_HAS_LARGE_MEMORY=1, so this restores the channel-backed ESP32 behavior.
    • AVR / tiny / other small-memory sketches keep the current lightweight direct path.
    • Since the event calls are compiled out on small-memory builds, this should avoid linking in the event/channel machinery there.

    Why put this in CLEDController::showLeds() rather than only Channel::showLeds():

    • The immediate repro is ESP32-S3 RMT5, where ClocklessIdf5 inherits from fl::Channel.
    • But the same enqueue-without-flush pattern also exists in other channel-driver-backed controller wrappers, for example ESP32 RMT4 and clockless-SPI paths that are CPixelLEDController subclasses rather than fl::Channel subclasses.
    • Fixing only Channel::showLeds() would address this specific RMT5 repro but leave other direct controller show paths fragile.

    Why this should not break global batching:

    • FastLED.show() calls showLedsInternal() on each controller, not public showLeds().
    • So the global show path still batches all controllers and then calls frame-end once.
    • The new frame events only run for the explicit direct-controller API: FastLED[n].showLeds(...) / direct controller.showLeds(...).

    Tests I would add:

    1. A channel-backed controller test where channel->showLeds(255) causes the mock driver to transmit without manually calling driver->show().
    2. A two-controller FastLED.show() test confirming the driver still receives one batched flush.
    3. A direct indexed FastLED[0].showLeds(255) test confirming only the direct call path flushes.
    4. A compile-size guard/AVR compile check confirming small-memory builds compile out the event calls.

    This keeps the old API contract: direct controller showLeds() should actually put data on the wire. On channel-backed platforms, that now requires the same frame-end flush that FastLED.show() already performs.

  4. nomakewan commented on Apr 22, 2026

    @nomakewan
    ContributorAuthor

    Confirmed that after #2377 the individual LED strips went back to working. Thanks!

  5. added a commit that references this issue on Apr 25, 2026
    5097889
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

    status: triagetype: bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions