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

[LedC] ledc_handle.used_channels is never initialized #9213

Closed
1 task done
TD-er opened this issue Feb 5, 2024 · 1 comment · Fixed by #9257
Closed
1 task done

[LedC] ledc_handle.used_channels is never initialized #9213

TD-er opened this issue Feb 5, 2024 · 1 comment · Fixed by #9257
Assignees
Labels
Status: Needs investigation We need to do some research before taking next steps on this issue

Comments

@TD-er
Copy link
Contributor

TD-er commented Feb 5, 2024

Board

ESP32 (classic)

Device Description

Hardware Configuration

Version

latest master (checkout manually)

IDE Name

PlatformIO

Operating System

Windows 11

Flash frequency

40MHz

PSRAM enabled

yes

Upload speed

115200

Description

ledcAttach uses ledc_handle.used_channels to pick an unused channel.
However this is never initialized to 0.

This can lead to nearly impossible to reproduce issues where per build (or run?) the number of usable ledC channels can differ.

Suggested change:

bool ledcAttach(uint8_t pin, uint32_t freq, uint8_t resolution)
{
    if (!fade_initialized) {
        ledc_handle.used_channels = 0;
    }
...

Slightly related issue: #9212

Sketch

-

Debug Message

-

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.
@TD-er TD-er added the Status: Awaiting triage Issue is waiting for triage label Feb 5, 2024
@SuGlider
Copy link
Collaborator

SuGlider commented Feb 5, 2024

@P-R-O-C-H-Y - PTAL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs investigation We need to do some research before taking next steps on this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants