Question about FastLED.show() performance :

Question about FastLED.show() performance :

I usually call show() after making a modification to a strip. Since the animation includes a delay, show() will be called every 20 ms, for example.

But what if I call show() every single loop() ? Would this be bad practice?

Using show() in every loop is good practice. Using the blocking delay() statement, however, isn’t a good practice. See my example of FastLED’s EVERY_N_MILLISECONDS function at:

https://github.com/atuline/FastLED-Demos/blob/master/one_sine/one_sine.ino

Generally I only call .show() IF something has changed. If I didn’t change anything, I just loop and save cycles. It allows for doing other things without using clock cycles for a .show() update that isn’t updating anything.

I have different methods dependant on the situation. If I’m using any sort of motion or shifting colors, I call it every time through the loop even if something hasn’t changed every loop through.

If I know that it’s going to be static, changing between solid colors or brightness, I usually have a trigger that will call show like if(CurrentVal!=PrevVal)…

Furthermore, by selectively using show, you can be a little more lenient with interrupts that are usually disabled while calling show.

I don’t use delay() either, I track time with millis(). If I run two animations on the same strip, this works fine. But if I want to overlay animations, I don’t want any flickering. So I was thinking of removing all show() calls from my animations and moving to a single show() in loop().

Yeah - generally I have show live outside of the animation code for my projects - makes it easier to mix and match.