Skip to content

Commit

Permalink
[Bug] Fix missing variable for Backlight Breathing (#15199)
Browse files Browse the repository at this point in the history
* [Bug] Fix missing varaible for Backlight Breathing

* Better fix

* formatting
  • Loading branch information
drashna authored Nov 18, 2021
1 parent aa712b5 commit 88eaf78
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions quantum/backlight/backlight_avr.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,9 +331,9 @@ bool is_breathing(void) { return !!(TIMSKx & _BV(TOIEx)); }
do { \
breathing_counter = 0; \
} while (0)
# define breathing_max() \
do { \
breathing_counter = breathing_period * breathing_ISR_frequency / 2; \
# define breathing_max() \
do { \
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
}
}

0 comments on commit 88eaf78

Please sign in to comment.