summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Thomson <thomsj@users.noreply.github.com>2022-10-11 19:33:02 +0100
committerGitHub <noreply@github.com>2022-10-11 11:33:02 -0700
commit41159326ca7c366b50edad1392369131c4ce4008 (patch)
tree883ef6282eb5ae533f23704f73b348a4b1a201ed
parent6af7d9fa736990d9c808e148592dc9efcec332ab (diff)
Fix boundary in `RGB_MATRIX_INDICATOR_SET_COLOR` (#18650)
-rw-r--r--docs/feature_rgb_matrix.md8
-rw-r--r--quantum/rgb_matrix/rgb_matrix.h2
2 files changed, 5 insertions, 5 deletions
diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md
index 669f88e0a9..e0c46f60e2 100644
--- a/docs/feature_rgb_matrix.md
+++ b/docs/feature_rgb_matrix.md
@@ -912,7 +912,7 @@ Caps Lock indicator on alphanumeric flagged keys:
```c
bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
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) {
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:
```c
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)) {
case 2:
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) {
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) {
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);
- 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
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
}
diff --git a/quantum/rgb_matrix/rgb_matrix.h b/quantum/rgb_matrix/rgb_matrix.h
index 1cd054abc4..e1bdad42e0 100644
--- a/quantum/rgb_matrix/rgb_matrix.h
+++ b/quantum/rgb_matrix/rgb_matrix.h
@@ -81,7 +81,7 @@
#endif
#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); \
}