Skip to content

Conversation

brentru
Copy link
Member

@brentru brentru commented May 21, 2025

This pull request updates the analogWrite function in src/components/ledc/ws_ledc.cpp to correct the calculation of the duty cycle for 12-bit resolution.

Key change:

  • Updated the duty cycle calculation to use a more precise formula with type casting and floating-point arithmetic, ensuring accurate scaling for 12-bit resolution. The new formula replaces the integer division with floating-point division and casts value to uint32_t for consistency.

@tyeth tyeth marked this pull request as ready for review May 23, 2025 18:57
@tyeth
Copy link
Member

tyeth commented May 23, 2025

This works well Brent, I tested on the scope, and confirmed by Tyler.
It was mentioned in Fridays meeting that Tyler's guide needs to ideally include the patched firmware, so I offered to release it instead.

@tyeth tyeth merged commit d0463bf into main May 23, 2025
39 checks passed
@brentru
Copy link
Member Author

brentru commented May 27, 2025

Okay, glad it worked!

@tyeth tyeth deleted the fix-duty-cycle branch June 19, 2025 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants