Fix Per Key LED Indicator Callbacks (#18450)
Co-authored-by: Dasky <32983009+daskygit@users.noreply.github.com> Co-authored-by: Nick Brassel <nick@tzarc.org>
This commit is contained in:
		
							parent
							
								
									09d3e27710
								
							
						
					
					
						commit
						64b1ed4550
					
				
					 218 changed files with 1430 additions and 1271 deletions
				
			
		| 
						 | 
				
			
			@ -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
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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 */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -19,7 +19,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		|||
#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;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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 <http://www.gnu.org/licenses/>. 
 | 
			
		||||
  */ 
 | 
			
		||||
  *
 | 
			
		||||
  * 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 <http://www.gnu.org/licenses/>.
 | 
			
		||||
  */
 | 
			
		||||
 | 
			
		||||
#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
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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 <http://www.gnu.org/licenses/>. 
 | 
			
		||||
  */ 
 | 
			
		||||
  *
 | 
			
		||||
  * 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 <http://www.gnu.org/licenses/>.
 | 
			
		||||
  */
 | 
			
		||||
 | 
			
		||||
#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;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue