You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Having Fastled.Delay must after Show while using FastLed on ESP32 Amazon FreeRtos #1049
Hi, My Environment: ESP32 using FastLED along with AmazonFreeRTOS, connected with WS2812 LED Matrix of 8 LEDs x 8 LED Code: FastLED.Show is called periodically in a High Priority task
Observation without calling Fastled.Delay after show,
When I have 10 LEDs with Color Value and rest all with (0,0,0). In 1st call with FastLED.show only 9 LEDs glow. In the subsequent calls to FastLED, 10th LED also glow, but 3rd LED glows with altogether different color
When I send command to lit all 8 x 8 leds with constant color. The flicker is observed randomly.
In order to address above:
I just added FastLED.Delay with 40 mSec right after call to .Show(). There is no flicker and there no Wierd color for 3rd LED also.
I thought of adding FastLED.delay after show after reading a few articles that If OS switches to another task while all data is not yet transferred completely to LED Matrix hardware. Considering FastLED.delay as blocking I presume it just does not pass the control to OS prematurely and does the trick
So My Question is:
a) Do you recommend calling Fastled.Delay as above or is there a smarter way?
b) For larger number of LEDs, this delay needed would also be more, So how to know how much delay necessary. Also adding more and more delay, the task will just be on hold and there is no possibility of other tasks to function.
show() and delay() are blocking, but there is one subtle difference in what delay() does.
delay() calls show() as well. It basically calls show() until the amount of milliseconds that were requested as a delay have passed.
But the notable thing about delay() is that it calls yield() after it's call to show().
Try this:
FastLED.show();
yield();
I'm not sure as to why show() doesn't just call yield() in the first place or why there aren't more people with this problem, if my assumptions are correct.
I have to say though, that I'm not sure if it fixes the problem because I don't know what/if anything would be done in the background. I also don't know amazons FreeRtos, but the yield call is the only difference between show() and delay() in the FastLED functions, except for the delaying part.
Activity
SnowMB commentedon Jul 10, 2020
Hey I just wrote about a similar issue in #1037.
5chmidti commentedon Jul 11, 2020
show()anddelay()are blocking, but there is one subtle difference in whatdelay()does.delay()callsshow()as well. It basically callsshow()until the amount of milliseconds that were requested as a delay have passed.But the notable thing about
delay()is that it callsyield()after it's call toshow().Try this:
FastLED.show(); yield();I'm not sure as to why
show()doesn't just callyield()in the first place or why there aren't more people with this problem, if my assumptions are correct.firepower9966 commentedon Jul 14, 2020
What does yield do?
5chmidti commentedon Jul 14, 2020
Here is an explanation from stackoverflow.
I have to say though, that I'm not sure if it fixes the problem because I don't know what/if anything would be done in the background. I also don't know amazons FreeRtos, but the yield call is the only difference between
show()anddelay()in the FastLED functions, except for the delaying part.