Merge pull request 'feat(q5_max): map dip-switch to RGB effects (heatmap / solid white)' (#17) from feat/rbg-switch into main

This commit was merged in pull request #17.
This commit is contained in:
2026-04-11 06:16:09 +00:00
2 changed files with 29 additions and 3 deletions
@@ -259,6 +259,27 @@ void keyboard_post_init_user(void) {
set_unicode_input_mode(UNICODE_MODE_LINUX);
}
#ifdef DIP_SWITCH_ENABLE
// dip_switch_update_user is claimed by factory_test.c; use the weak
// dip_switch_update_keymap hook added in q5_max.c instead.
void dip_switch_update_keymap(uint8_t index, bool active) {
if (index == 0) {
if (active) {
// "Win" side → solid white backlight
rgb_matrix_mode(RGB_MATRIX_SOLID_COLOR);
rgb_matrix_sethsv(HSV_WHITE);
} else {
// "Mac" side → heatmap effect.
// Restore hue+saturation before switching modes: the heatmap reads
// rgb_matrix_config.hsv.s directly for its color scale, so leaving
// saturation=0 (from HSV_WHITE) produces a white-only heatmap.
rgb_matrix_sethsv(0, 255, rgb_matrix_get_val());
rgb_matrix_mode(RGB_MATRIX_TYPING_HEATMAP);
}
}
}
#endif
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (!process_record_keychron_common(keycode, record)) {
return false;
+8 -3
View File
@@ -29,11 +29,16 @@
#ifdef DIP_SWITCH_ENABLE
// Weak hook — override in keymap.c to handle dip-switch events
// without conflicting with factory_test.c's dip_switch_update_user.
__attribute__((weak)) void dip_switch_update_keymap(uint8_t index, bool active) {}
bool dip_switch_update_kb(uint8_t index, bool active) {
if (index == 0) {
default_layer_set(1UL << (active ? 2 : 0));
}
// if (index == 0) {
// default_layer_set(1UL << (active ? 2 : 0));
// }
dip_switch_update_user(index, active);
dip_switch_update_keymap(index, active);
return true;
}