Fix with PWM for brightness slowing devices down #6894
Merged
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.
Fix for CircuitPython v8.0.0-beta.2: display_shapes.polygon color fill is rendering very slowly
#6734 removed support for auto brightness left a call in
displayio_display_background
to set the brightness to a 1.0f fixed value. In the previous code another function call checked that auto-brightness was set to True and skipped any work if it was not true and limited to how often the brightness was set.With the previous PR always calling
common_hal_displayio_display_set_brightness
to 1.0f it was both preventing the brightness from being set (using the same auto-brightness behavior that no longer exists) and having to change the PWMOut object was slow the lower the frequency of the PWM timer. Most boards with built in displays were set to 50KHz so it was barely noticeable. The Titano was set to 500Hz so the problem became apparent. But there is a measurable speed-up even when the frequency was set to the higher value.This PR does not fix the brightness from not being set properly. This would be one source of error but apparently others exist still.
But this PR does fix a slowdown with any board using PWM to control the display brightness.