fix(backlight2): signal smooth adjustment completion explicitly instead of zeroing target_pct - #124
Open
dmanam wants to merge 1 commit into
Open
fix(backlight2): signal smooth adjustment completion explicitly instead of zeroing target_pct#124dmanam wants to merge 1 commit into
dmanam wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This adds an extra return value
reachedtoset_backlight_value()which explicitly tracks whether the target value has been reached, so that we no longer need to track it by zeroingtarget_pct.This fixes two bugs:
Backlight2.Setreaches its target within a single step, it ends up zeroingtarget_pctbut then continuing to smooth for one more step, erroneously taking an extra step towards 0. This ends up causing the backlight to flicker, since this repeats every update (since we're never at the desired percentage). This is mitigated in many cases by Fix backlight flickering and suspend/resume state machine Clight#317, but the underlying cause is here. This bug was introduced in 2e8c6ff (off by just one from what @3cky found here).Backlight2.Lowerwhich tries to lower to 0 never makes it, sincetarget_pctbeing 0 causes the smoothing to stop.There's also a third (seeming) bug which is now easily fixed: if the target backlight for
Setis 0, then we currently jump to it immediately, even if smoothing is on. I didn't implement the fix, since it's possible this is the intended behavior, but doing so just requires removing&& params->target_pct > 0fromis_smooth(). Once we're tracking completion separately, this doesn't introduce any issues.