r/FastLED • u/lit_amin • Nov 22 '23
Support WLED effects in FastLED
Is there a easy way to include WLED effects in my FastLED code? I prefer FastLED but cannot deny that some effects in WLED are too sweet to ignore. Problem is, I don't understand one bit of how these effects are coded. To my knowledge, they are in FX.cpp, but it all seems like greek to me (I know FastLED quite good though!). Is it a big chunk of work to implement a few of the WLED effects in FastLED? How can I get started in a easy way?
6
Upvotes
3
u/Finndersen Nov 23 '23
I've developed a library for creating patterns/effects and mapping them to LED strip segments using FastLED. I'm planning on porting over some effects from WLED, but you can also take a look at how existing patterns are implemented and try make your own, copying logic from WLED. Have a look and let me know what you think :) https://github.com/Finndersen/LEDuino
2
u/Netmindz Nov 23 '23
I've only ported from FastLED to WLED, but it's normally pretty minimal change. The FastLED code is actually simpler.
Rather than messing about with casting and odd named variables you can set regular sensibly named variables, even static if you need to.
Then rather than calling setPixel, just assign the CRGB value in your LEDs array
1
u/johnny5canuck Nov 22 '23
It wasn't easy when I started porting FastLED effects over to WLED (the sound reactive version), as WLED uses NeoPixel Bus to drive the LED's and FastLED for some of the math.
Lines 3928 and onwards in that FX.cpp have some of my former FastLED effects, and I really had to change things around in order to make them work in the WLED environment. For instance, static variables? Nope. That was quite the challenge. So, unfortunately, no easy answer.
Here's some (now) outdated programing notes from back in the day:
https://github.com/atuline/WLED/wiki/WLED-Programming-Notes
Here's the FastLED version of Twinkleup which you can compare against the WLED version in FX.cpp:
https://pastebin.com/yGeeGCRy
To make matters worse, I haven't worked on this stuff for almost 2 years now, so I've forgotten most of it, and WLED has continued to evolve very nicely.