From c88c83562e2528c9e51aad6ac7343a2ce99849df Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Thu, 27 Jun 2024 10:44:39 -0500 Subject: [PATCH] Layers seem to be working now --- iris-ce/flake.nix | 2 ++ iris-ce/flash.bash | 19 ++++++++++++++++++- iris-ce/keymap.c | 29 ++++++++++++++++------------- 3 files changed, 36 insertions(+), 14 deletions(-) diff --git a/iris-ce/flake.nix b/iris-ce/flake.nix index c4f835c..b476f7d 100644 --- a/iris-ce/flake.nix +++ b/iris-ce/flake.nix @@ -31,12 +31,14 @@ mkShell, nil, alejandra, + udisks2, qmk, }: { qmk = mkShell { buildInputs = [ nil alejandra + udisks2 qmk ]; # inherit (self.outputs.checks.${system}.pre-commit-check) shellHook; diff --git a/iris-ce/flash.bash b/iris-ce/flash.bash index a673726..7d9a664 100755 --- a/iris-ce/flash.bash +++ b/iris-ce/flash.bash @@ -6,4 +6,21 @@ 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 -qmk flash --keyboard keebio/iris_ce/rev1 -km lytedev +( + while true; do + echo "Trying to mount RPI-RP2..." + if udisksctl mount -b /dev/disk/by-label/RPI-RP2; then + exit 0 + fi + sleep 1 + done +) & + +if qmk flash --keyboard keebio/iris_ce/rev1 -km lytedev; then + echo "Flashing complete!" + kill %1 + exit 0 +fi + +kill %1 +exit 1 diff --git a/iris-ce/keymap.c b/iris-ce/keymap.c index 84ce305..8b5d7d7 100644 --- a/iris-ce/keymap.c +++ b/iris-ce/keymap.c @@ -79,31 +79,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)) { - case LG: - rgblight_mode(1); - rgblight_sethsv(HSV_RED); - break; - case LRG: - rgblight_mode(1); - rgblight_sethsv(HSV_YELLOW); - break; + switch (get_highest_layer(state | default_layer_state)) { case LL: - rgblight_mode(1); + rgblight_mode_noeeprom(1); rgblight_sethsv(HSV_BLUE); break; case LR: - rgblight_mode(1); + rgblight_mode_noeeprom(1); rgblight_sethsv(HSV_GREEN); break; case LA: - rgblight_mode(1); + rgblight_mode_noeeprom(1); rgblight_sethsv(HSV_PURPLE); break; case LC: - rgblight_mode(1); + 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); + } + break; } return state; }