Skip to content

New LEDC auto channel function needs ability to manual adjust channel. #8967

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

Closed
1 task done
spyder0069 opened this issue Dec 7, 2023 · 3 comments · Fixed by #9031
Closed
1 task done

New LEDC auto channel function needs ability to manual adjust channel. #8967

spyder0069 opened this issue Dec 7, 2023 · 3 comments · Fixed by #9031
Assignees
Labels
Area: Peripherals API Relates to peripheral's APIs. Status: Needs investigation We need to do some research before taking next steps on this issue
Milestone

Comments

@spyder0069
Copy link

Board

ESP32

Device Description

ESP32

Hardware Configuration

transducer and backlight

Version

latest development Release Candidate (RC-X)

IDE Name

Arduino IDE

Operating System

Windows 10

Flash frequency

40Mhz

PSRAM enabled

no

Upload speed

115200

Description

The new function got rid of the setup call that allowed you to manually set your channel. The problem is my project has a audio transducer and a lcd with backlight. When using ledc for tones and controlling the backlight brightness the two interfere. This is because the esp groups two sets of eight channels and the frequency is shared amongst the set. Since it now auto adds the channels its grouping both of my devices and when the frequency changes for tone control the backlight is then off and you can't fix this without a blinking in the backlight while they are grouped. Previously I could set channel 1 for backlight and 9 for the speaker and everything was happy since the frequencies were seperated.

Sketch

ledcAttach(buzzer,2000,8);
ledcAttach(TFT_BACKLIGHT,2000,8);

Debug Message

No debug messages

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@spyder0069 spyder0069 added the Status: Awaiting triage Issue is waiting for triage label Dec 7, 2023
@spyder0069
Copy link
Author

I did find my work around. I found some others talking about how each two consecutive channels share a timer. I thought the first 8 shared one and the second 8 shared another but I was wrong. 4 timers spread out. It was mentioned here "github.com/esphome/issues/issues/3114"

My workaround was to take a unused pin and use it as a unused ledc channel.
myledcresponse=ledcAttach(buzzer,2000,8); myledcresponse=ledcAttach(39,2000,8); // create a false channel with unused input. myledcresponse=ledcAttach(TFT_BACKLIGHT,2000,8);
It would be nice if the option to manually select the channel would be returned to this function in the future.

@P-R-O-C-H-Y
Copy link
Member

Hi @spyder0069, I will take a look on this. Seems reasonable to have the option to specify the channel.

@P-R-O-C-H-Y P-R-O-C-H-Y self-assigned this Dec 7, 2023
@P-R-O-C-H-Y P-R-O-C-H-Y added Status: Needs investigation We need to do some research before taking next steps on this issue Area: Peripherals API Relates to peripheral's APIs. and removed Status: Awaiting triage Issue is waiting for triage labels Dec 7, 2023
@P-R-O-C-H-Y P-R-O-C-H-Y added this to the 3.0.0-RC1 milestone Dec 7, 2023
@me-no-dev
Copy link
Member

@P-R-O-C-H-Y since this change was caused be the new IDF API, make sure that you read it's code to see how timers are allocated for channels. Timer spreading was something we added before. Made most sense at the time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Peripherals API Relates to peripheral's APIs. Status: Needs investigation We need to do some research before taking next steps on this issue
Projects
Development

Successfully merging a pull request may close this issue.

3 participants