Threading and LED fade

CopperCory
Posts: 2
Joined: Tue Nov 27, 2018 10:48 pm

Threading and LED fade

Postby CopperCory » 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?

ESP_houwenxiang
Posts: 118
Joined: Tue Jun 26, 2018 3:09 am

Re: Threading and LED fade

Postby ESP_houwenxiang » Wed Nov 28, 2018 2:55 am

Hi,
Are you using dual core and frequently calling "ledc_fade_func_install" ? and can you provide your IDF version?
wookooho

CopperCory
Posts: 2
Joined: Tue Nov 27, 2018 10:48 pm

Re: Threading and LED fade

Postby CopperCory » Wed Nov 28, 2018 5:11 pm

I am using IDF version 3.1.1 if memory serves, and no, I'm trying to call ledc_fade_func_install once if I can. I am using a dual core board though.

ESP_houwenxiang
Posts: 118
Joined: Tue Jun 26, 2018 3:09 am

Re: Threading and LED fade

Postby ESP_houwenxiang » Thu Nov 29, 2018 5:33 am

CopperCory wrote:
Wed Nov 28, 2018 5:11 pm
I am using IDF version 3.1.1 if memory serves, and no, I'm trying to call ledc_fade_func_install once if I can. I am using a dual core board though.
Hi, CopperCory
Can you please try the master branch for testing? we have some update on master branch. According to your description, I guess that your issue sholud be solved by this fix: (3.1.1 : https://github.com/espressif/esp-idf/bl ... loc.c#L713 master: https://github.com/espressif/esp-idf/bl ... loc.c#L714).
wookooho

ESP_houwenxiang
Posts: 118
Joined: Tue Jun 26, 2018 3:09 am

Re: Threading and LED fade

Postby ESP_houwenxiang » Wed Dec 05, 2018 2:23 am

ESP_houwenxiang wrote:
Thu Nov 29, 2018 5:33 am
CopperCory wrote:
Wed Nov 28, 2018 5:11 pm
I am using IDF version 3.1.1 if memory serves, and no, I'm trying to call ledc_fade_func_install once if I can. I am using a dual core board though.
Hi, CopperCory
Can you please try the master branch for testing? we have some update on master branch. According to your description, I guess that your issue sholud be solved by this fix: (3.1.1 : https://github.com/espressif/esp-idf/bl ... loc.c#L713 master: https://github.com/espressif/esp-idf/bl ... loc.c#L714).

Hi, CopperCory
Has your problem been solved?
wookooho

Who is online

Users browsing this forum: No registered users and 122 guests