feat(q5_max): map dip-switch to RGB effects (heatmap / solid white)
Replace the Win/Mac default-layer switch with an RGB effect toggle: - Win side → solid white backlight - Mac side → typing heatmap Add a weak dip_switch_update_keymap() hook in q5_max.c to work around factory_test.c already owning dip_switch_update_user().
This commit is contained in:
@@ -259,6 +259,27 @@ void keyboard_post_init_user(void) {
|
|||||||
set_unicode_input_mode(UNICODE_MODE_LINUX);
|
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) {
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
if (!process_record_keychron_common(keycode, record)) {
|
if (!process_record_keychron_common(keycode, record)) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -29,11 +29,16 @@
|
|||||||
|
|
||||||
|
|
||||||
#ifdef DIP_SWITCH_ENABLE
|
#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) {
|
bool dip_switch_update_kb(uint8_t index, bool active) {
|
||||||
if (index == 0) {
|
// if (index == 0) {
|
||||||
default_layer_set(1UL << (active ? 2 : 0));
|
// default_layer_set(1UL << (active ? 2 : 0));
|
||||||
}
|
// }
|
||||||
dip_switch_update_user(index, active);
|
dip_switch_update_user(index, active);
|
||||||
|
dip_switch_update_keymap(index, active);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user