Threading and LED fade
Posted: Tue Nov 27, 2018 10:57 pm
Hello.
I am currently working with esp-idf and ran into an error. I am trying to set up an LED to fade in and out in a breath like fashion, but I also need the board to do other things, rather than waiting because the way I have it written, other functions get blocked, since if I don't wait for the LED to fully fade, it won't fade at all. So I made a thread. The code used to have ledc_fade_func_install(0) in the main function and it would call rgb_fade() from another file afterward in a loop, however, once I put the thread in, that functionality stopped working because according to the fades inside the thread, ledc_fade_func_install was not run. When I moved the install inside the thread, I was met with an error return of 261: ESP_ERR_NOT_FOUND, as opposed to the successful installation in main.
Is there something I'm missing that would fix this, or is ledc_fade_func_install not thread safe?
I am currently working with esp-idf and ran into an error. I am trying to set up an LED to fade in and out in a breath like fashion, but I also need the board to do other things, rather than waiting because the way I have it written, other functions get blocked, since if I don't wait for the LED to fully fade, it won't fade at all. So I made a thread. The code used to have ledc_fade_func_install(0) in the main function and it would call rgb_fade() from another file afterward in a loop, however, once I put the thread in, that functionality stopped working because according to the fades inside the thread, ledc_fade_func_install was not run. When I moved the install inside the thread, I was met with an error return of 261: ESP_ERR_NOT_FOUND, as opposed to the successful installation in main.
Is there something I'm missing that would fix this, or is ledc_fade_func_install not thread safe?