Question about performance :

(Franck Marcotte) #1

Question about 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?

(Andrew Tuline) #2

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:

(Ashley M. Kirchner [Norym]) #3

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.

(Jarrod Wagner) #4

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)…

(Jarrod Wagner) #5

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

(Franck Marcotte) #6

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().

(Daniel Garcia) #7

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