Damian Schneider 76cb2e9988 Improvements to heap-memory and PSRAM handling (#4791)
* Improved heap and PSRAM handling

- Segment `allocateData()` uses more elaborate DRAM checking to reduce fragmentation and allow for larger setups to run on low heap
- Segment data allocation fails if minimum contiguous block size runs low to keep the UI working
- Increased `MAX_SEGMENT_DATA` to account for better segment data handling
- Memory allocation functions try to keep enough DRAM for segment data
- Added constant `PSRAM_THRESHOLD` to improve PSARM usage
- Increase MIN_HEAP_SIZE to reduce risk of breaking UI due to low memory for JSON response
- ESP32 makes use of IRAM (no 8bit access) for pixeluffers, freeing up to 50kB of RAM
- Fix to properly get available heap on all platforms: added function `getFreeHeapSize()`
- Bugfix for effects that divide by SEGLEN: don't run FX in service() if segment is not active
-Syntax fix in AR: calloc() uses (numelements, size) as arguments

* Added new functions for allocation and heap checking

- added `allocate_buffer()` function that can be used to allocate large buffers: takes parameters to set preferred ram location, including 32bit accessible RAM on ESP32. Returns null if heap runs low or switches to PSRAM
- getFreeHeapSize() and getContiguousFreeHeap() helper functions for all platforms to correctly report free useable heap
- updated some constants
- updated segment data allocation to free the data if it is large

- replaced "psramsafe" variable with it's #ifdef: BOARD_HAS_PSRAM and made accomodating changes
- added some compile-time checks to handle invalid env. definitions
- updated all allocation functions and some of the logic behind them
- added use of fast RTC-Memory where available
- increased MIN_HEAP_SIZE for all systems (improved stability in tests)
- updated memory calculation in web-UI to account for required segment buffer
- added UI alerts if buffer allocation fails
- made getUsedSegmentData() non-private (used in buffer alloc function)
- changed MAX_SEGMENT_DATA
- added more detailed memory log to DEBUG output
- added debug output to buffer alloc function
2025-09-16 19:46:16 +02:00
2025-09-14 18:12:03 +01:00
2023-09-10 18:52:14 +02:00
2021-06-14 01:58:12 +02:00
2024-11-09 21:33:58 -05:00
2025-04-11 16:15:52 +02:00
2025-01-19 12:19:06 +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-09-03 23:05:20 -04: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
Languages
C++ 74.9%
C 11.8%
HTML 7.1%
JavaScript 3.9%
CSS 1.1%
Other 1.2%