copilot-swe-agent[bot] 371aac2cf4 Fix legacy config driver assignment: intelligently fallback to I2S when RMT full
Fixed bug where legacy configurations without "drv" field defaulted all buses to RMT, causing invalid configurations when RMT channels were full.

**Problem:**
- Legacy configs from before user-selectable drivers don't have "drv" field in JSON
- When loaded, all LD (driver) dropdowns defaulted to RMT (first option)
- If config had more buses than RMT channels, configuration was invalid
- Example: ESP32-S2 with 6 digital buses → all RMT → 6/4 channels used (invalid)

**Solution:**
Added `fixLegacyDriverConfig()` function that:
1. Detects legacy configs (all LD fields are unset or all RMT)
2. Intelligently assigns drivers based on hardware limits:
   - First N buses → RMT (up to maxRMT: ESP32=8, S2/S3=4)
   - Remaining buses → I2S (up to maxI2S: ESP32/S2/S3=8)
3. Called automatically after config loaded from backend
4. Also called when loading config from JSON file

**Implementation:**
- Lines 817-872: Added fixLegacyDriverConfig() function
- Line 51: Call after backend config loaded
- Line 957: Call after JSON file loaded
- Line 925: Load drv field from JSON when present
- Uses existing isDig(), isD2P() helpers to identify digital buses
- Only processes ESP32 variants (is32(), isS2(), isS3())

**Behavior:**
- **Legacy config with 6 buses on ESP32-S2:**
  - Old: All 6 RMT → INVALID (exceeds 4 RMT limit)
  - New: 4 RMT + 2 I2S → VALID
- **Modern config with drv field:** No changes, respects saved values
- **New buses:** Already handled by existing addLEDs() logic

**Benefits:**
-  Legacy configs automatically upgraded on load
-  No user intervention required
-  Backward compatible with old configurations
-  Respects hardware channel limits
-  Prevents invalid "all RMT" configurations
-  Works for both backend-loaded and file-loaded configs

**Testing:**
-  Web UI built successfully
-  All 16 npm tests passed
-  No compilation errors
-  Logic only affects legacy configs (all RMT)

Co-authored-by: DedeHai <6280424+DedeHai@users.noreply.github.com>
2026-01-12 20:18:51 +00:00
2023-09-10 18:52:14 +02:00
2021-06-14 01:58:12 +02:00
2025-12-01 21:43:45 -05:00
2026-01-03 10:07:04 +01:00
2022-11-09 17:59:31 +01:00
2024-12-24 13:55:10 +01:00
2020-06-22 00:09:00 +02:00
2025-03-01 20:53:43 +00:00

Welcome to WLED!

A fast and feature-rich implementation of an ESP32 and ESP8266 webserver to control NeoPixel (WS2812B, WS2811, SK6812) LEDs or also SPI based chipsets like the WS2801 and APA102!

Originally created by Aircoookie

⚙️ Features

  • WS2812FX library with more than 100 special effects
  • FastLED noise effects and 50 palettes
  • Modern UI with color, effect and segment controls
  • Segments to set different effects and colors to user defined parts of the LED string
  • Settings page - configuration via the network
  • Access Point and station mode - automatic failsafe AP
  • Up to 10 LED outputs per instance
  • Support for RGBW strips
  • Up to 250 user presets to save and load colors/effects easily, supports cycling through them.
  • Presets can be used to automatically execute API calls
  • Nightlight function (gradually dims down)
  • Full OTA software updateability (HTTP + ArduinoOTA), password protectable
  • Configurable analog clock (Cronixie, 7-segment and EleksTube IPS clock support via usermods)
  • Configurable Auto Brightness limit for safe operation
  • Filesystem-based config for easier backup of presets and settings

💡 Supported light control interfaces

  • WLED app for Android and iOS
  • JSON and HTTP request APIs
  • MQTT
  • E1.31, Art-Net, DDP and TPM2.net
  • diyHue (Wled is supported by diyHue, including Hue Sync Entertainment under udp. Thanks to Gregory Mallios)
  • Hyperion
  • UDP realtime
  • Alexa voice control (including dimming and color)
  • Sync to Philips hue lights
  • Adalight (PC ambilight via serial) and TPM2
  • Sync color of multiple WLED devices (UDP notifier)
  • Infrared remotes (24-key RGB, receiver required)
  • Simple timers/schedules (time from NTP, timezones/DST supported)

📲 Quick start guide and documentation

See the documentation on our official site!

On this page you can find excellent tutorials and tools to help you get your new project up and running!

🖼️ User interface

💾 Compatible hardware

See here!

✌️ Other

Licensed under the EUPL v1.2 license
Credits here! CORS proxy by Corsfix

Join the Discord server to discuss everything about WLED!

Check out the WLED Discourse forum!

You can also send me mails to dev.aircoookie@gmail.com, but please, only do so if you want to talk to me privately.

If WLED really brightens up your day, you can

Disclaimer:

If you are prone to photosensitive epilepsy, we recommended you do not use this software.
If you still want to try, don't use strobe, lighting or noise modes or high effect speed settings.

As per the EUPL license, I assume no liability for any damage to you or any other person or equipment.

Description
Control WS2812B and many more types of digital RGB LEDs with an ESP8266 or ESP32 over WiFi!
Readme EUPL-1.2 311 MiB
Languages
C++ 78.4%
HTML 8.9%
C 5.4%
JavaScript 4.8%
Python 1%
Other 1.5%