forked from mirrors/qmk_userspace
Change {LED,RGB}_DISABLE_TIMEOUT
to {LED,RGB}_MATRIX_TIMEOUT
(#18415)
This commit is contained in:
parent
9509dfbe39
commit
ea2819b2c2
138 changed files with 64 additions and 181 deletions
|
@ -54,12 +54,8 @@ const led_point_t k_led_matrix_center = LED_MATRIX_CENTER;
|
|||
// -----End led effect includes macros-------
|
||||
// ------------------------------------------
|
||||
|
||||
#if defined(LED_DISABLE_AFTER_TIMEOUT) && !defined(LED_DISABLE_TIMEOUT)
|
||||
# define LED_DISABLE_TIMEOUT (LED_DISABLE_AFTER_TIMEOUT * 1200UL)
|
||||
#endif
|
||||
|
||||
#ifndef LED_DISABLE_TIMEOUT
|
||||
# define LED_DISABLE_TIMEOUT 0
|
||||
#ifndef LED_MATRIX_TIMEOUT
|
||||
# define LED_MATRIX_TIMEOUT 0
|
||||
#endif
|
||||
|
||||
#if !defined(LED_MATRIX_MAXIMUM_BRIGHTNESS) || LED_MATRIX_MAXIMUM_BRIGHTNESS > UINT8_MAX
|
||||
|
@ -103,9 +99,9 @@ static uint8_t led_last_enable = UINT8_MAX;
|
|||
static uint8_t led_last_effect = UINT8_MAX;
|
||||
static effect_params_t led_effect_params = {0, LED_FLAG_ALL, false};
|
||||
static led_task_states led_task_state = SYNCING;
|
||||
#if LED_DISABLE_TIMEOUT > 0
|
||||
#if LED_MATRIX_TIMEOUT > 0
|
||||
static uint32_t led_anykey_timer;
|
||||
#endif // LED_DISABLE_TIMEOUT > 0
|
||||
#endif // LED_MATRIX_TIMEOUT > 0
|
||||
|
||||
// double buffers
|
||||
static uint32_t led_timer_buffer;
|
||||
|
@ -185,9 +181,9 @@ void process_led_matrix(uint8_t row, uint8_t col, bool pressed) {
|
|||
#ifndef LED_MATRIX_SPLIT
|
||||
if (!is_keyboard_master()) return;
|
||||
#endif
|
||||
#if LED_DISABLE_TIMEOUT > 0
|
||||
#if LED_MATRIX_TIMEOUT > 0
|
||||
led_anykey_timer = 0;
|
||||
#endif // LED_DISABLE_TIMEOUT > 0
|
||||
#endif // LED_MATRIX_TIMEOUT > 0
|
||||
|
||||
#ifdef LED_MATRIX_KEYREACTIVE_ENABLED
|
||||
uint8_t led[LED_HITS_TO_REMEMBER];
|
||||
|
@ -237,13 +233,13 @@ static bool led_matrix_none(effect_params_t *params) {
|
|||
}
|
||||
|
||||
static void led_task_timers(void) {
|
||||
#if defined(LED_MATRIX_KEYREACTIVE_ENABLED) || LED_DISABLE_TIMEOUT > 0
|
||||
#if defined(LED_MATRIX_KEYREACTIVE_ENABLED) || LED_MATRIX_TIMEOUT > 0
|
||||
uint32_t deltaTime = sync_timer_elapsed32(led_timer_buffer);
|
||||
#endif // defined(LED_MATRIX_KEYREACTIVE_ENABLED) || LED_DISABLE_TIMEOUT > 0
|
||||
#endif // defined(LED_MATRIX_KEYREACTIVE_ENABLED) || LED_MATRIX_TIMEOUT > 0
|
||||
led_timer_buffer = sync_timer_read32();
|
||||
|
||||
// Update double buffer timers
|
||||
#if LED_DISABLE_TIMEOUT > 0
|
||||
#if LED_MATRIX_TIMEOUT > 0
|
||||
if (led_anykey_timer < UINT32_MAX) {
|
||||
if (UINT32_MAX - deltaTime < led_anykey_timer) {
|
||||
led_anykey_timer = UINT32_MAX;
|
||||
|
@ -251,7 +247,7 @@ static void led_task_timers(void) {
|
|||
led_anykey_timer += deltaTime;
|
||||
}
|
||||
}
|
||||
#endif // LED_DISABLE_TIMEOUT > 0
|
||||
#endif // LED_MATRIX_TIMEOUT > 0
|
||||
|
||||
// Update double buffer last hit timers
|
||||
#ifdef LED_MATRIX_KEYREACTIVE_ENABLED
|
||||
|
@ -357,9 +353,9 @@ void led_matrix_task(void) {
|
|||
// 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 LED_DISABLE_TIMEOUT > 0
|
||||
(led_anykey_timer > (uint32_t)LED_DISABLE_TIMEOUT) ||
|
||||
#endif // LED_DISABLE_TIMEOUT > 0
|
||||
#if LED_MATRIX_TIMEOUT > 0
|
||||
(led_anykey_timer > (uint32_t)LED_MATRIX_TIMEOUT) ||
|
||||
#endif // LED_MATRIX_TIMEOUT > 0
|
||||
false;
|
||||
|
||||
uint8_t effect = suspend_backlight || !led_matrix_eeconfig.enable ? 0 : led_matrix_eeconfig.mode;
|
||||
|
|
|
@ -56,12 +56,8 @@ __attribute__((weak)) RGB rgb_matrix_hsv_to_rgb(HSV hsv) {
|
|||
// -----End rgb effect includes macros-------
|
||||
// ------------------------------------------
|
||||
|
||||
#if defined(RGB_DISABLE_AFTER_TIMEOUT) && !defined(RGB_DISABLE_TIMEOUT)
|
||||
# define RGB_DISABLE_TIMEOUT (RGB_DISABLE_AFTER_TIMEOUT * 1200UL)
|
||||
#endif
|
||||
|
||||
#ifndef RGB_DISABLE_TIMEOUT
|
||||
# define RGB_DISABLE_TIMEOUT 0
|
||||
#ifndef RGB_MATRIX_TIMEOUT
|
||||
# define RGB_MATRIX_TIMEOUT 0
|
||||
#endif
|
||||
|
||||
#if !defined(RGB_MATRIX_MAXIMUM_BRIGHTNESS) || RGB_MATRIX_MAXIMUM_BRIGHTNESS > UINT8_MAX
|
||||
|
@ -126,9 +122,9 @@ static uint8_t rgb_last_enable = UINT8_MAX;
|
|||
static uint8_t rgb_last_effect = UINT8_MAX;
|
||||
static effect_params_t rgb_effect_params = {0, LED_FLAG_ALL, false};
|
||||
static rgb_task_states rgb_task_state = SYNCING;
|
||||
#if RGB_DISABLE_TIMEOUT > 0
|
||||
#if RGB_MATRIX_TIMEOUT > 0
|
||||
static uint32_t rgb_anykey_timer;
|
||||
#endif // RGB_DISABLE_TIMEOUT > 0
|
||||
#endif // RGB_MATRIX_TIMEOUT > 0
|
||||
|
||||
// double buffers
|
||||
static uint32_t rgb_timer_buffer;
|
||||
|
@ -213,9 +209,9 @@ void process_rgb_matrix(uint8_t row, uint8_t col, bool pressed) {
|
|||
#ifndef RGB_MATRIX_SPLIT
|
||||
if (!is_keyboard_master()) return;
|
||||
#endif
|
||||
#if RGB_DISABLE_TIMEOUT > 0
|
||||
#if RGB_MATRIX_TIMEOUT > 0
|
||||
rgb_anykey_timer = 0;
|
||||
#endif // RGB_DISABLE_TIMEOUT > 0
|
||||
#endif // RGB_MATRIX_TIMEOUT > 0
|
||||
|
||||
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||
uint8_t led[LED_HITS_TO_REMEMBER];
|
||||
|
@ -296,17 +292,17 @@ static bool rgb_matrix_none(effect_params_t *params) {
|
|||
}
|
||||
|
||||
static void rgb_task_timers(void) {
|
||||
#if defined(RGB_MATRIX_KEYREACTIVE_ENABLED) || RGB_DISABLE_TIMEOUT > 0
|
||||
#if defined(RGB_MATRIX_KEYREACTIVE_ENABLED) || RGB_MATRIX_TIMEOUT > 0
|
||||
uint32_t deltaTime = sync_timer_elapsed32(rgb_timer_buffer);
|
||||
#endif // defined(RGB_MATRIX_KEYREACTIVE_ENABLED) || RGB_DISABLE_TIMEOUT > 0
|
||||
#endif // defined(RGB_MATRIX_KEYREACTIVE_ENABLED) || RGB_MATRIX_TIMEOUT > 0
|
||||
rgb_timer_buffer = sync_timer_read32();
|
||||
|
||||
// Update double buffer timers
|
||||
#if RGB_DISABLE_TIMEOUT > 0
|
||||
#if RGB_MATRIX_TIMEOUT > 0
|
||||
if (rgb_anykey_timer + deltaTime <= UINT32_MAX) {
|
||||
rgb_anykey_timer += deltaTime;
|
||||
}
|
||||
#endif // RGB_DISABLE_TIMEOUT > 0
|
||||
#endif // RGB_MATRIX_TIMEOUT > 0
|
||||
|
||||
// Update double buffer last hit timers
|
||||
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||
|
@ -419,9 +415,9 @@ void rgb_matrix_task(void) {
|
|||
// 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_DISABLE_TIMEOUT > 0
|
||||
(rgb_anykey_timer > (uint32_t)RGB_DISABLE_TIMEOUT) ||
|
||||
#endif // RGB_DISABLE_TIMEOUT > 0
|
||||
#if RGB_MATRIX_TIMEOUT > 0
|
||||
(rgb_anykey_timer > (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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue