From 7f46b4df9fe68cb8ec2e3d9a583e52983b97567d Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Thu, 27 Jun 2024 12:26:34 -0500 Subject: [PATCH] LEDs working better now? --- iris-ce/config.h | 4 ++++ iris-ce/flake.nix | 2 ++ iris-ce/flash.bash | 6 ++--- iris-ce/keymap.c | 59 +++++++++++++++++++++++----------------------- 4 files changed, 38 insertions(+), 33 deletions(-) diff --git a/iris-ce/config.h b/iris-ce/config.h index 798ff3f..99f5be4 100644 --- a/iris-ce/config.h +++ b/iris-ce/config.h @@ -1,3 +1,7 @@ #define TAPPING_TERM 150 // #define PERMISSIVE_HOLD #define HOLD_ON_OTHER_KEY_PRESS +#define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_RAINBOW_MOOD+1 + +#define SPLIT_LAYER_STATE_ENABLE +#define SPLIT_LED_STATE_ENABLE diff --git a/iris-ce/flake.nix b/iris-ce/flake.nix index b476f7d..7bae314 100644 --- a/iris-ce/flake.nix +++ b/iris-ce/flake.nix @@ -32,6 +32,7 @@ nil, alejandra, udisks2, + clang, qmk, }: { qmk = mkShell { @@ -40,6 +41,7 @@ alejandra udisks2 qmk + clang ]; # inherit (self.outputs.checks.${system}.pre-commit-check) shellHook; diff --git a/iris-ce/flash.bash b/iris-ce/flash.bash index 9278b87..5cb1578 100755 --- a/iris-ce/flash.bash +++ b/iris-ce/flash.bash @@ -3,9 +3,9 @@ # TODO: cd dirname $0 cd "$(dirname "$0")" || exit 1 -cp ./config.h ~/qmk_firmware/keyboards/keebio/iris_ce/keymaps/lytedev -cp ./rules.mk ~/qmk_firmware/keyboards/keebio/iris_ce/keymaps/lytedev -cp ./keymap.c ~/qmk_firmware/keyboards/keebio/iris_ce/keymaps/lytedev +rsync -hvrPt ./config.h ~/qmk_firmware/keyboards/keebio/iris_ce/keymaps/lytedev +rsync -hvrPt ./rules.mk ~/qmk_firmware/keyboards/keebio/iris_ce/keymaps/lytedev +rsync -hvrPt ./keymap.c ~/qmk_firmware/keyboards/keebio/iris_ce/keymaps/lytedev ( while true; do diff --git a/iris-ce/keymap.c b/iris-ce/keymap.c index ac04b81..037b843 100644 --- a/iris-ce/keymap.c +++ b/iris-ce/keymap.c @@ -78,35 +78,34 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ) }; -layer_state_t layer_state_set_user(layer_state_t state) { - switch (get_highest_layer(state | default_layer_state)) { - case LL: - rgblight_mode_noeeprom(1); - rgblight_sethsv(HSV_BLUE); - break; - case LR: - rgblight_mode_noeeprom(1); - rgblight_sethsv(HSV_GREEN); - break; - case LA: - rgblight_mode_noeeprom(1); - rgblight_sethsv(HSV_PURPLE); - break; - case LC: - rgblight_mode_noeeprom(1); - rgblight_sethsv(HSV_ORANGE); - break; - default: - if (IS_LAYER_ON_STATE(state | default_layer_state, LG)) { - rgblight_mode_noeeprom(1); - rgblight_sethsv(HSV_RED); - } else if (IS_LAYER_ON_STATE(state | default_layer_state, LRG)) { - rgblight_mode_noeeprom(1); - rgblight_sethsv(HSV_YELLOW); - } else { - rgblight_mode_noeeprom(RGB_MATRIX_DEFAULT_MODE + 1); - } - break; +bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { + uint8_t layer = get_highest_layer(layer_state | default_layer_state); + + if (layer == LQ) { + return false; } - return state; + + HSV hsv = {0, 255, 255}; + hsv.h = 40 * layer; + + // switch (layer) { + // case(LG): + // hsv.h = 40; + // break; + // } + // hsv.h = 130; + // } else if { + // hsv.h = 30; + // } + + if (hsv.v > rgb_matrix_get_val()) { + hsv.v = rgb_matrix_get_val(); + } + RGB rgb = hsv_to_rgb(hsv); + + for (uint8_t i = led_min; i <= led_max; i++) { + rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b); + } + + return true; }