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.
la-ninpre aaoth@aaoth.xyz
Sat, 13 Jul 2024 12:04:19 +0300
2 files changed,
14 insertions(+),
11 deletions(-)
M
keyboards/keychron/v1/ansi/keymaps/lbr/config.h
→
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 ENABLE_RGB_MATRIX_PIXEL_RAIN
#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
M
keyboards/keychron/v1/ansi/keymaps/lbr/keymap.c
→
keyboards/keychron/v1/ansi/keymaps/lbr/keymap.c
@@ -41,7 +41,7 @@ _______, _______, _______, _______, KC_WH_D, _______, _______, KC_P1, KC_P2, KC_P3, KC_PSLS, _______, KC_MS_U,
_______, _______, _______, _______, 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 @@ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
}; #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 @@ return false;
} #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) {