aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorla-ninpre <aaoth@aaoth.xyz>2024-07-13 12:04:19 +0300
committerla-ninpre <aaoth@aaoth.xyz>2024-07-13 12:04:19 +0300
commitf53a5c92e36ff17f0ccdeb9f2b7f222dad02faad (patch)
treed7cc9eb9c53ea7d1e5d8af2e17fa768e8b9c19e5
parent4384322201012ef258bd663b2c4f46225fca7cbb (diff)
downloadqmk-userspace-f53a5c92e36ff17f0ccdeb9f2b7f222dad02faad.tar.gz
qmk-userspace-f53a5c92e36ff17f0ccdeb9f2b7f222dad02faad.zip
simplify rgb lighting
set colors using post-init hook instead of relying on eeprom. previously keyboard would load colour from eeprom, and if different firmware set it to a different one, it would stay as is, which is why i added the eeprom clean button. now there's no need to touch eeprom at all.
-rw-r--r--keyboards/keychron/v1/ansi/keymaps/lbr/config.h6
-rw-r--r--keyboards/keychron/v1/ansi/keymaps/lbr/keymap.c19
2 files changed, 14 insertions, 11 deletions
diff --git a/keyboards/keychron/v1/ansi/keymaps/lbr/config.h b/keyboards/keychron/v1/ansi/keymaps/lbr/config.h
index 218a1a3..97d6b5e 100644
--- a/keyboards/keychron/v1/ansi/keymaps/lbr/config.h
+++ b/keyboards/keychron/v1/ansi/keymaps/lbr/config.h
@@ -1,4 +1,3 @@
-/* override defaults */
#undef ENABLE_RGB_MATRIX_BREATHING
#undef ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL
#undef ENABLE_RGB_MATRIX_CYCLE_ALL
@@ -16,9 +15,4 @@
#undef RGB_MATRIX_KEYPRESSES
#undef RGB_MATRIX_FRAMEBUFFER_EFFECTS
-/* set our defaults */
#define RGB_MATRIX_DISABLE_KEYCODES
-#define RGB_MATRIX_DEFAULT_MODE RGB_MATRIX_SOLID_COLOR
-#define RGB_MATRIX_DEFAULT_HUE 0
-#define RGB_MATRIX_DEFAULT_SAT 191
-#define RGB_MATRIX_DEFAULT_VAL 204
diff --git a/keyboards/keychron/v1/ansi/keymaps/lbr/keymap.c b/keyboards/keychron/v1/ansi/keymaps/lbr/keymap.c
index 4719d35..6264ce9 100644
--- a/keyboards/keychron/v1/ansi/keymaps/lbr/keymap.c
+++ b/keyboards/keychron/v1/ansi/keymaps/lbr/keymap.c
@@ -41,7 +41,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_______, _______, _______, _______, KC_P0, KC_PDOT, KC_APP, KC_MS_L, KC_MS_D, KC_MS_R),
[MGCK] = LAYOUT_ansi_82(
QK_BOOT, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
- EE_CLR, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
NK_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
@@ -49,6 +49,19 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
};
#ifdef RGB_MATRIX_ENABLE
+// top-right key for numpad status
+#define IND_NUMPAD 14
+#define IND_CAPSLK 0
+#define IND_COLOUR 0xcc, 0x33, 0x33
+
+void
+keyboard_post_init_user(void)
+{
+ if(rgb_matrix_is_enabled()){
+ rgb_matrix_set_color_all(IND_COLOUR);
+ }
+}
+
#ifdef DIP_SWITCH_ENABLE
bool
dip_switch_update_user(uint8_t index, bool active)
@@ -64,10 +77,6 @@ dip_switch_update_user(uint8_t index, bool active)
}
#endif // DIP_SWITCH_ENABLE
-// top-right key for numpad status
-#define IND_NUMPAD 14
-#define IND_CAPSLK 0
-#define IND_COLOUR 0xcc, 0x33, 0x33
bool
rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max)
{