From 64b1ed45507a15d5594b1f90b936c2096918f5a4 Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Tue, 4 Oct 2022 15:24:22 -0700 Subject: Fix Per Key LED Indicator Callbacks (#18450) Co-authored-by: Dasky <32983009+daskygit@users.noreply.github.com> Co-authored-by: Nick Brassel --- keyboards/massdrop/alt/config_led.c | 6 +++- keyboards/massdrop/alt/keymaps/pregame/keymap.c | 3 +- keyboards/massdrop/ctrl/config_led.c | 6 +++- .../massdrop/ctrl/keymaps/endgame/config_led.c | 3 +- keyboards/massdrop/ctrl/keymaps/endgame/keymap.c | 3 +- .../massdrop/ctrl/keymaps/matthewrobo/config_led.c | 7 +++-- .../massdrop/ctrl/keymaps/matthewrobo/keymap.c | 7 +++-- .../massdrop/ctrl/keymaps/xanimos/config_led.c | 31 ++++++++++---------- keyboards/massdrop/ctrl/keymaps/xanimos/keymap.c | 33 +++++++++++----------- 9 files changed, 58 insertions(+), 41 deletions(-) (limited to 'keyboards/massdrop') diff --git a/keyboards/massdrop/alt/config_led.c b/keyboards/massdrop/alt/config_led.c index 85ae67878b..963282db1e 100644 --- a/keyboards/massdrop/alt/config_led.c +++ b/keyboards/massdrop/alt/config_led.c @@ -50,8 +50,12 @@ led_config_t g_led_config = { { #ifdef USB_LED_INDICATOR_ENABLE -void rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) { +bool rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) { + if (!rgb_matrix_indicators_advanced_user(led_min, led_max)) { + return false; + } md_rgb_matrix_indicators_advanced(led_min, led_max); + return true; } #endif // USB_LED_INDICATOR_ENABLE diff --git a/keyboards/massdrop/alt/keymaps/pregame/keymap.c b/keyboards/massdrop/alt/keymaps/pregame/keymap.c index 6a78f075fb..c91e557b50 100644 --- a/keyboards/massdrop/alt/keymaps/pregame/keymap.c +++ b/keyboards/massdrop/alt/keymaps/pregame/keymap.c @@ -199,11 +199,12 @@ void set_layer_color(int layer) { } } } -void rgb_matrix_indicators_user(void) { +bool rgb_matrix_indicators_user(void) { if (g_suspend_state || disable_layer_color || rgb_matrix_get_flags() == LED_FLAG_NONE || rgb_matrix_get_flags() == LED_FLAG_UNDERGLOW) { return; } set_layer_color(get_highest_layer(layer_state)); + return false; } diff --git a/keyboards/massdrop/ctrl/config_led.c b/keyboards/massdrop/ctrl/config_led.c index bd708c2cb8..50daa68e75 100644 --- a/keyboards/massdrop/ctrl/config_led.c +++ b/keyboards/massdrop/ctrl/config_led.c @@ -73,8 +73,12 @@ led_config_t g_led_config = { { #ifdef USB_LED_INDICATOR_ENABLE -void rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) { +bool rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) { + if (!rgb_matrix_indicators_advanced_user(led_min, led_max)) { + return false; + } md_rgb_matrix_indicators_advanced(led_min, led_max); + return true; } #endif // USB_LED_INDICATOR_ENABLE diff --git a/keyboards/massdrop/ctrl/keymaps/endgame/config_led.c b/keyboards/massdrop/ctrl/keymaps/endgame/config_led.c index ec32b652da..72446506d9 100644 --- a/keyboards/massdrop/ctrl/keymaps/endgame/config_led.c +++ b/keyboards/massdrop/ctrl/keymaps/endgame/config_led.c @@ -73,9 +73,10 @@ led_config_t g_led_config = { { #ifdef USB_LED_INDICATOR_ENABLE -void rgb_matrix_indicators_kb(void) +bool rgb_matrix_indicators_kb(void) { md_rgb_matrix_indicators(); + return rgb_matrix_indicators_user(); } #endif // USB_LED_INDICATOR_ENABLE diff --git a/keyboards/massdrop/ctrl/keymaps/endgame/keymap.c b/keyboards/massdrop/ctrl/keymaps/endgame/keymap.c index 9439d105ba..846fc7070c 100644 --- a/keyboards/massdrop/ctrl/keymaps/endgame/keymap.c +++ b/keyboards/massdrop/ctrl/keymaps/endgame/keymap.c @@ -372,13 +372,14 @@ void set_layer_color(int layer) { } } -void rgb_matrix_indicators_user(void) { +bool rgb_matrix_indicators_user(void) { if (disable_layer_color || rgb_matrix_get_flags() == LED_FLAG_NONE || rgb_matrix_get_flags() == LED_FLAG_UNDERGLOW) { return; } set_layer_color(get_highest_layer(layer_state)); + return false; } /* This is a test function for Raw HID, which is currently not implemented for this keyboard */ diff --git a/keyboards/massdrop/ctrl/keymaps/matthewrobo/config_led.c b/keyboards/massdrop/ctrl/keymaps/matthewrobo/config_led.c index a1c1dec543..732a60a6c5 100644 --- a/keyboards/massdrop/ctrl/keymaps/matthewrobo/config_led.c +++ b/keyboards/massdrop/ctrl/keymaps/matthewrobo/config_led.c @@ -91,7 +91,10 @@ led_config_t g_led_config = { { // clang-format on # ifdef USB_LED_INDICATOR_ENABLE -void rgb_matrix_indicators_kb(void) { md_rgb_matrix_indicators(); } +bool rgb_matrix_indicators_kb(void) { + md_rgb_matrix_indicators(); + return rgb_matrix_indicators_user(); +} # endif // USB_LED_INDICATOR_ENABLE -#endif \ No newline at end of file +#endif diff --git a/keyboards/massdrop/ctrl/keymaps/matthewrobo/keymap.c b/keyboards/massdrop/ctrl/keymaps/matthewrobo/keymap.c index 406263cee5..0ea23ccb4c 100644 --- a/keyboards/massdrop/ctrl/keymaps/matthewrobo/keymap.c +++ b/keyboards/massdrop/ctrl/keymaps/matthewrobo/keymap.c @@ -19,7 +19,7 @@ along with this program. If not, see . #include "keymap.h" // clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [_KL] = LAYOUT( + [_KL] = LAYOUT( KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SLCK, KC_PAUS, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN, @@ -99,7 +99,7 @@ const uint8_t PROGMEM ledmap[][RGB_MATRIX_LED_COUNT][3] = { _______, GOLD, CORAL, _______, _______, _______, _______, RED, {1,0,0}, CYAN, M9B59B5, _______, _______, _______, RED, _______, _______, _______, RED, PINK, YELLOW, GREEN, CREAM, _______, _______, _______, _______, _______, _______, _______, _______, WHITE, _______, _______, CORAL, _______, CORAL - }, + }, }; # undef _______ # define _______ KC_TRNS @@ -278,9 +278,10 @@ void set_layer_color(int layer) { } } -void rgb_matrix_indicators_user(void) { +bool rgb_matrix_indicators_user(void) { if (g_suspend_state || disable_layer_color || rgb_matrix_get_flags() == LED_FLAG_NONE || rgb_matrix_get_flags() == LED_FLAG_UNDERGLOW) { return; } set_layer_color(get_highest_layer(layer_state)); + return false; } diff --git a/keyboards/massdrop/ctrl/keymaps/xanimos/config_led.c b/keyboards/massdrop/ctrl/keymaps/xanimos/config_led.c index 650b31477c..d83318de83 100644 --- a/keyboards/massdrop/ctrl/keymaps/xanimos/config_led.c +++ b/keyboards/massdrop/ctrl/keymaps/xanimos/config_led.c @@ -1,18 +1,18 @@ /* Copyright 2022 Daniel Weeks (@xanimos) - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #ifdef RGB_MATRIX_ENABLE #include "ctrl.h" @@ -89,8 +89,9 @@ led_config_t g_led_config = { { #ifdef USB_LED_INDICATOR_ENABLE -void rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) { +bool rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) { md_rgb_matrix_indicators_advanced(led_min, led_max); + return rgb_matrix_indicators_advanced_user(led_min, led_max); } #endif // USB_LED_INDICATOR_ENABLE diff --git a/keyboards/massdrop/ctrl/keymaps/xanimos/keymap.c b/keyboards/massdrop/ctrl/keymaps/xanimos/keymap.c index 2b6515fc97..561171a04a 100644 --- a/keyboards/massdrop/ctrl/keymaps/xanimos/keymap.c +++ b/keyboards/massdrop/ctrl/keymaps/xanimos/keymap.c @@ -1,18 +1,18 @@ /* Copyright 2022 Daniel Weeks (@xanimos) - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #include "keymap.h" @@ -334,7 +334,7 @@ void set_layer_color(int layer) { float f = (float)rgb_matrix_config.hsv.v / UINT8_MAX; rgb_matrix_set_color(i, f * rgb.r, f * rgb.g, f * rgb.b); continue; - } + } if(layer == _FL && i <= 4 && i >= 1) { continue; // Leave RGB for F1-F4 of function layer to adjust RGB settings } @@ -343,13 +343,14 @@ void set_layer_color(int layer) { } } -void rgb_matrix_indicators_user(void) { +bool rgb_matrix_indicators_user(void) { if (disable_layer_color || rgb_matrix_get_flags() == LED_FLAG_NONE || rgb_matrix_get_flags() == LED_FLAG_UNDERGLOW) { return; } set_layer_color(get_highest_layer(layer_state)); + return false; } -- cgit v1.2.3