Fix boundary in RGB_MATRIX_INDICATOR_SET_COLOR
(#18650)
This commit is contained in:
parent
6af7d9fa73
commit
41159326ca
2 changed files with 5 additions and 5 deletions
|
@ -912,7 +912,7 @@ Caps Lock indicator on alphanumeric flagged keys:
|
||||||
```c
|
```c
|
||||||
bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
|
bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
|
||||||
if (host_keyboard_led_state().caps_lock) {
|
if (host_keyboard_led_state().caps_lock) {
|
||||||
for (uint8_t i = led_min; i <= led_max; i++) {
|
for (uint8_t i = led_min; i < led_max; i++) {
|
||||||
if (g_led_config.flags[i] & LED_FLAG_KEYLIGHT) {
|
if (g_led_config.flags[i] & LED_FLAG_KEYLIGHT) {
|
||||||
rgb_matrix_set_color(i, RGB_RED);
|
rgb_matrix_set_color(i, RGB_RED);
|
||||||
}
|
}
|
||||||
|
@ -925,7 +925,7 @@ bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
|
||||||
Layer indicator on all keys:
|
Layer indicator on all keys:
|
||||||
```c
|
```c
|
||||||
bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
|
bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
|
||||||
for (uint8_t i = led_min; i <= led_max; i++) {
|
for (uint8_t i = led_min; i < led_max; i++) {
|
||||||
switch(get_highest_layer(layer_state|default_layer_state)) {
|
switch(get_highest_layer(layer_state|default_layer_state)) {
|
||||||
case 2:
|
case 2:
|
||||||
rgb_matrix_set_color(i, RGB_BLUE);
|
rgb_matrix_set_color(i, RGB_BLUE);
|
||||||
|
@ -951,7 +951,7 @@ bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
|
||||||
for (uint8_t col = 0; col < MATRIX_COLS; ++col) {
|
for (uint8_t col = 0; col < MATRIX_COLS; ++col) {
|
||||||
uint8_t index = g_led_config.matrix_co[row][col];
|
uint8_t index = g_led_config.matrix_co[row][col];
|
||||||
|
|
||||||
if (index >= led_min && index <= led_max && index != NO_LED &&
|
if (index >= led_min && index < led_max && index != NO_LED &&
|
||||||
keymap_key_to_keycode(layer, (keypos_t){col,row}) > KC_TRNS) {
|
keymap_key_to_keycode(layer, (keypos_t){col,row}) > KC_TRNS) {
|
||||||
rgb_matrix_set_color(index, RGB_GREEN);
|
rgb_matrix_set_color(index, RGB_GREEN);
|
||||||
}
|
}
|
||||||
|
@ -983,7 +983,7 @@ bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
|
||||||
}
|
}
|
||||||
RGB rgb = hsv_to_rgb(hsv);
|
RGB rgb = hsv_to_rgb(hsv);
|
||||||
|
|
||||||
for (uint8_t i = led_min; i <= led_max; i++) {
|
for (uint8_t i = led_min; i < led_max; i++) {
|
||||||
if (HAS_FLAGS(g_led_config.flags[i], 0x01)) { // 0x01 == LED_FLAG_MODIFIER
|
if (HAS_FLAGS(g_led_config.flags[i], 0x01)) { // 0x01 == LED_FLAG_MODIFIER
|
||||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define RGB_MATRIX_INDICATOR_SET_COLOR(i, r, g, b) \
|
#define RGB_MATRIX_INDICATOR_SET_COLOR(i, r, g, b) \
|
||||||
if (i >= led_min && i <= led_max) { \
|
if (i >= led_min && i < led_max) { \
|
||||||
rgb_matrix_set_color(i, r, g, b); \
|
rgb_matrix_set_color(i, r, g, b); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue