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

Strange ledc_start_fade behaviour (more time than request) (IDFGH-14293) #15085

Open
3 tasks done
StefanoTesla opened this issue Dec 23, 2024 · 1 comment
Open
3 tasks done
Assignees
Labels
Status: Opened Issue is new

Comments

@StefanoTesla
Copy link

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

General issue report

running this code:

ledc_channel_t ledcChannel = static_cast<ledc_channel_t>(0); esp_err_t fade_in_status = ledc_set_fade_with_time(LEDC_LOW_SPEED_MODE, ledcChannel, dutyValue, time); if (fade_in_status == ESP_OK){ ledc_fade_start(LEDC_LOW_SPEED_MODE, ledcChannel, LEDC_FADE_NO_WAIT);

I got a strange behaviour, for example if I pass 5000 in the time, esp32 took approx 9 seconds to make the fade, If I use something like 2000 it works like a sharm...

I got an esp32-d v3.0 espressif version 6.9.0

of course at the beginning I run ledc_fade_func_install(0);

@espressif-bot espressif-bot added the Status: Opened Issue is new label Dec 23, 2024
@github-actions github-actions bot changed the title Strange ledc_start_fade behaviour (more time than request) Strange ledc_start_fade behaviour (more time than request) (IDFGH-14293) Dec 23, 2024
@songruo
Copy link
Collaborator

songruo commented Dec 24, 2024

Hi @StefanoTesla, our ledc_set_fade_with_time API does have the possibility of an inaccurate fade time, up to 50%, due to the the rounding of the scale/cycle parameters calculation internally (as a single linear fade). If you want a very accurate timing, you need to do some calculation by yourself to split the entire fade into multiple linear fades to avoid the rounding error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Opened Issue is new
Projects
None yet
Development

No branches or pull requests

3 participants