mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-07-16 21:01:31 +00:00
Fix RGB matrix not syncing properly on timeout
This commit is contained in:
parent
15e7c8f37a
commit
9b6cd929af
@ -76,6 +76,7 @@ last_hit_t g_last_hit_tracker;
|
||||
static bool suspend_state = false;
|
||||
static uint8_t rgb_last_enable = UINT8_MAX;
|
||||
static uint8_t rgb_last_effect = UINT8_MAX;
|
||||
static uint8_t rgb_current_effect = 0;
|
||||
static effect_params_t rgb_effect_params = {0, LED_FLAG_ALL, false};
|
||||
static rgb_task_states rgb_task_state = SYNCING;
|
||||
|
||||
@ -289,6 +290,17 @@ static void rgb_task_start(void) {
|
||||
g_last_hit_tracker = last_hit_buffer;
|
||||
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||
|
||||
// Ideally we would also stop sending zeros to the LED driver PWM buffers
|
||||
// while suspended and just do a software shutdown. This is a cheap hack for now.
|
||||
bool suspend_backlight = suspend_state ||
|
||||
#if RGB_MATRIX_TIMEOUT > 0
|
||||
(last_input_activity_elapsed() > (uint32_t)RGB_MATRIX_TIMEOUT) ||
|
||||
#endif // RGB_MATRIX_TIMEOUT > 0
|
||||
false;
|
||||
|
||||
// Set effect to be renedered
|
||||
rgb_current_effect = suspend_backlight || !rgb_matrix_config.enable ? 0 : rgb_matrix_config.mode;
|
||||
|
||||
// next task
|
||||
rgb_task_state = RENDERING;
|
||||
}
|
||||
@ -377,15 +389,7 @@ static void rgb_task_flush(uint8_t effect) {
|
||||
void rgb_matrix_task(void) {
|
||||
rgb_task_timers();
|
||||
|
||||
// Ideally we would also stop sending zeros to the LED driver PWM buffers
|
||||
// while suspended and just do a software shutdown. This is a cheap hack for now.
|
||||
bool suspend_backlight = suspend_state ||
|
||||
#if RGB_MATRIX_TIMEOUT > 0
|
||||
(last_input_activity_elapsed() > (uint32_t)RGB_MATRIX_TIMEOUT) ||
|
||||
#endif // RGB_MATRIX_TIMEOUT > 0
|
||||
false;
|
||||
|
||||
uint8_t effect = suspend_backlight || !rgb_matrix_config.enable ? 0 : rgb_matrix_config.mode;
|
||||
uint8_t effect = rgb_current_effect;
|
||||
|
||||
switch (rgb_task_state) {
|
||||
case STARTING:
|
||||
|
Loading…
Reference in New Issue
Block a user