Skip to content

Conversation

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

Description of Change

if(duty == max_duty){ 
     duty = max_duty + 1; 
 } 

With this previous change we fixed if all bits from given resolution are set, then the LEDC PWM should be full on. But 1-bit mode duty option is 0 - fully off or 1 -fully on which is wrong. As it is in ESP-IDF docs the 1-bit PWM means the duty cycle is fixed at 50%.

This PR fixes that to align with ESP-IDF docs.

Tests scenarios

Tested on ESP32 nad ESP32S3. No need to test on all chips.

Related links

Closes #7067

@P-R-O-C-H-Y P-R-O-C-H-Y added the Area: Peripherals API Relates to peripheral's APIs. label Aug 3, 2022
@P-R-O-C-H-Y P-R-O-C-H-Y added this to the 2.0.5 milestone Aug 3, 2022
@P-R-O-C-H-Y P-R-O-C-H-Y self-assigned this Aug 3, 2022
Copy link
Contributor

@PilnyTomas PilnyTomas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@SuGlider
Copy link
Collaborator

SuGlider commented Aug 8, 2022

LGTM

@SuGlider SuGlider merged commit 285e898 into espressif:master Aug 8, 2022
@P-R-O-C-H-Y P-R-O-C-H-Y deleted the ledc-1bit-fix branch April 19, 2023 11:30
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.
Projects
Development

Successfully merging this pull request may close these issues.

ESP32 ledc 1bit PWM Configuration is impossible
3 participants