Extend PWM resolution from 8 to 10 bits for low brightness lights. #5742
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
The internal ESP8266 PWM implementation is 10 bits resolution but we use only 8 for LED control. This makes a significant difference when activating Gamma Correction (Ledtable 1) since the Gamma curve is very flat at low light levels. Going to 10 bits resolution makes a smoother low light display and better color accuracy at low brightness.
Due to current implementation of PWM, it seems that you cannot go beyond 9 bits resolution with core_2_3_0 or core_2_4_2. Full range is available when switching to core_2_5_0 and when PWMFrequency is below 440 Hz.
To see the difference:
Activate Gamma Correction:
LedTable 1
Set color to ligth white:
Color #FFFFFF
Set Dimmer to 1:
Dimmer 1
Set PMW Frequency to 440 Hz:
PwmFrequency 440
With previous version (8 bits), you won't see an increase in brightness from
Dimmer 1
untilDimmer 13
.With current version with core_2_5_0, you'll see a first light increase at
Dimmer 8
, then atDimmer 11
and so on.**Related issue (if applicable):
Implementation:
ledGamma()
instead.Checklist: