-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FastLED CRGB[] (leds) support #2662
Comments
leds[] array is in fact double-buffering. Unfortunately most often leds[] represent RGB array stripping away W support WLED has. Still, using leds[], global or local, can benefit effect porting since LED/RGB data is retained (losslessly) between invocations of the effect function which is it's most common use. Actually there is no need to overload [] operator since we only need an index to leds[]. I have implemented 2D support for WLED that uses local leds[] array in a sample 2D effect bundled with it. |
Of course leds[] in its standard form is double buffering. Effect level benefits:
Bus level benefits:
|
Sorry, I misunderstood the original post. 😄 Overloading leds[XY(x,y)] with a setPixelColor/getPixelColor is a nice idea. Though, rarely needed since leds[] serves its own purpose IMO. |
I have been porting FastLED effects (25 currently) to WLED using dynamic leds[] array and it only takes 8 lines of code to make simple effects work. |
One more note regading global WLED handles color in uint32_t whereas CRGB is effectively uint24_t and as such discarding/loosing W channel. If The additional benefit of global |
@ewoudwijma has started work on this here. So the recommendation would be to overload [] and =operators to support setPixelColor and getPixelColor |
Eventually it turned out we removed leds from effect functions all together and only have leds under the hood in sPC and gPC. Question is if this is enough if we still need to add leds overloads? I personally think not as we keep code more straightforward by only allowing sPC and gPC. |
Although I would prefer WLED way of writing effects (using |
Double buffering done in #3280 |
@Aircoookie do we keep this open? |
My opinion is, let's close it. Even if we can use some tricks to implement an "array index" operator, it won't allow to do all the fancy things that are possible with FastLED
|
Just a thought: If we ditch global brightness then we no longer need to care about lossy pixel restoration. And we can play with pixel arrays directly. |
Is your feature request related to a problem? Please describe.
It is some effort for users to port effects written for the FastLED library to WLED.
Describe the solution you'd like
Add support for using the
CRGB leds[]
array from within WLED effect functions, callingsetPixelColor()
andgetPixelColor()
automatically via[]
operator overrideDescribe alternatives you've considered
Current WLED effect code flavor and upcoming custom FX scripting does not make it easier to port FastLED effects.
Additional context
https://stackoverflow.com/questions/37043078/c-overloading-array-operator
The text was updated successfully, but these errors were encountered: