Skip to content
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

ESP32, FastLED, and delay() #783

Open
davepl opened this issue Apr 30, 2019 · 2 comments

Comments

Projects
None yet
3 participants
@davepl
Copy link

commented Apr 30, 2019

I've debugged a serious problem with an ESP32 issue that comes down to the fact that FastLED replaces the delay() function with it's own non-multitasking-friendly version of a busy wait.

Is there any particular reason that FastLED needs to do this? I have many tasks running and need to yield CPU time in my loop, but FastLED obscures the delay() function needed to do this. Before I change it, I hope to understand why this FastLED behavior persists on FreeRTOS on the ESP32, and if its OK to change it?

@focalintent

This comment has been minimized.

Copy link
Member

commented Apr 30, 2019

FastLED.delay is designed to continuously run show to drive the dithering engine. It doesn’t replace the system delay function. If you want delay without calling show in a loop, call delay. If you want to drive the dithering engine, call FastLED.delay.

@t413

This comment has been minimized.

Copy link

commented May 2, 2019

Two other ideas for you to try:

  • Try designing your code to use the periodic functions EVERY_N_MILLISECONDS or EVERY_N_SECONDS macros provided by FastLED instead of using more delays. See here in one of the examples.
  • Try adding another FreeRTOS task. Use xTaskCreate() in your setup() method.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.