-
-
Notifications
You must be signed in to change notification settings - Fork 39.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] fix backlight_avr.c breathing feature doesn't handle correctly #16628
Draft
monksoffunk
wants to merge
2
commits into
qmk:master
Choose a base branch
from
monksoffunk:feature/backlight_avr_bug
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains 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
temporary changes for testing purpose
Monitoring variables(when BREATHING_PERIOD 3, BREATHING_STEPS 128):
|
Well, I've got time, so let's move on. Oh, another PR #16770 has already been merged! |
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.
Description
The current backlight breathing feature for AVR doesn't work.
This PR aims to solve the following 2 problems.
I want to start as Draft PR and change the stage after discussion.
Problem 1
Breathing does not appear to occur, at least visually.
This is caused by argument overflow for scale_backlight
this must be
or
Problem 2
Even after correcting 1, the behavior of breathing is still strange.
Specifically, after breathing slightly shorter than BREATHING_PERIOD, another short breathing occurs and the next breathing starts in the middle.
Cause:
Because BREATHING_STEPS is 128, the decimal point of uint16_t interval is truncated in most BREATHING_PERIOD settings including default 6.
By BREATHING_PERIOD 3 setting, interval is (uint16_t)3* 120 / 128 = (uint16_t)2.8125 = 2, so the problem becomes more pronounced.
Solution 1:
Change BREATHING_STEPS to 120
Solution 2:
Change interval from int to float
Solution 1 is preferable from the point of view of AVR load.
Since BREATHING_ISR_FREQUENCY is 120, BREATHING_ISR_FREQUENCY / BREATHING_STEPS always be 1.
Types of Changes
Issues Fixed or Closed by This PR
Checklist