Skip to content
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

[Bug] Fix missing variable for Backlight Breathing #15199

Merged
merged 3 commits into from
Nov 18, 2021
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions quantum/backlight/backlight_avr.c
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ bool is_breathing(void) { return !!(TIMSKx & _BV(TOIEx)); }
} while (0)
# define breathing_max() \
do { \
breathing_counter = breathing_period * breathing_ISR_frequency / 2; \
breathing_counter = get_breathing_period() * breathing_ISR_frequency / 2; \
} while (0)

void breathing_enable(void) {
Expand Down Expand Up @@ -390,9 +390,9 @@ ISR(TIMERx_OVF_vect)
} else {
return;
}
uint16_t interval = (uint16_t)breathing_period * breathing_ISR_frequency / BREATHING_STEPS;
uint16_t interval = (uint16_t)get_breathing_period() * breathing_ISR_frequency / BREATHING_STEPS;
// resetting after one period to prevent ugly reset at overflow.
breathing_counter = (breathing_counter + 1) % (breathing_period * breathing_ISR_frequency);
breathing_counter = (breathing_counter + 1) % (get_breathing_period() * breathing_ISR_frequency);
uint8_t index = breathing_counter / interval % BREATHING_STEPS;

if (((breathing_halt == BREATHING_HALT_ON) && (index == BREATHING_STEPS / 2)) || ((breathing_halt == BREATHING_HALT_OFF) && (index == BREATHING_STEPS - 1))) {
Expand Down Expand Up @@ -454,4 +454,4 @@ void backlight_init_ports(void) {
breathing_enable();
}
#endif
}
}