Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions keyboards/keychron/common/rgb/keychron_rgb.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ static bool mixed_rgb_get_effect_list(uint8_t *data) {
uint8_t start = data[1];
uint8_t count = data[2];

if (count > 3 || region > EFFECT_LAYERS || start + count > EFFECTS_PER_LAYER) return false;
if (count > 3 || region >= EFFECT_LAYERS || start + count > EFFECTS_PER_LAYER) return false;

for (uint8_t i = 0; i < count; i++) {
data[1 + i * EFFECT_DATA_LEN] = effect_list[region][start + i].effect;
Expand All @@ -263,7 +263,7 @@ bool mixed_rgb_set_effect_list(uint8_t *data) {
uint8_t start = data[1];
uint8_t count = data[2];

if (count > 3 || region > EFFECT_LAYERS || start + count > EFFECTS_PER_LAYER) return false;
if (count > 3 || region >= EFFECT_LAYERS || start + count > EFFECTS_PER_LAYER) return false;
for (uint8_t i = 0; i < count; i++) {
if (data[3 + i * EFFECT_DATA_LEN] >= RGB_MATRIX_CUSTOM_MIXED_RGB) return false;
}
Expand Down Expand Up @@ -433,7 +433,7 @@ void os_state_indicate(void) {
}
# endif
# if defined(SCROLL_LOCK_INDEX)
if (host_keyboard_led_state().compose && !os_ind_cfg.disable.scroll_lock) {
if (host_keyboard_led_state().scroll_lock && !os_ind_cfg.disable.scroll_lock) {
rgb_matrix_set_color(SCROLL_LOCK_INDEX, rgb.r, rgb.g, rgb.b);
}
# endif
Expand Down
6 changes: 3 additions & 3 deletions keyboards/keychron/common/rgb/keychron_rgb_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
enum {
PER_KEY_RGB_SOLID,
PER_KEY_RGB_BREATHING,
PER_KEY_RGB_REATIVE_SIMPLE,
PER_KEY_RGB_REATIVE_MULTI_WIDE,
PER_KEY_RGB_REATIVE_SPLASH,
PER_KEY_RGB_REACTIVE_SIMPLE,
PER_KEY_RGB_REACTIVE_MULTI_WIDE,
PER_KEY_RGB_REACTIVE_SPLASH,
PER_KEY_RGB_MAX,
};

Expand Down
40 changes: 28 additions & 12 deletions keyboards/keychron/common/rgb/per_key_rgb.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,30 @@ bool per_key_rgb_solid(effect_params_t *params) {

for (uint8_t i = led_min; i < led_max; i++) {
hsv = per_key_led[i];
hsv.v = rgb_matrix_config.hsv.v;
// If per-key brightness is 0, keep it off (don't apply global brightness)
// Otherwise, apply global brightness
if (per_key_led[i].v > 0) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Apply Global Brightness screws with per-key color values as is, I would recommend either just doing away with the global V entirely in per key mode or multiplying the key specific V by the global V.

hsv.v = rgb_matrix_config.hsv.v;
}
RGB rgb = hsv_to_rgb(hsv);
rgb_matrix_region_set_color(params->region, i, rgb.r, rgb.g, rgb.b);
}
return rgb_matrix_check_finished_leds(led_max);
}

bool per_key_rgb_breahting(effect_params_t *params) {
bool per_key_rgb_breathing(effect_params_t *params) {
RGB_MATRIX_USE_LIMITS(led_min, led_max);
HSV hsv;
uint16_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 8);

for (uint8_t i = led_min; i < led_max; i++) {
hsv = per_key_led[i];
hsv.v = scale8(abs8(sin8(time) - 128) * 2, rgb_matrix_config.hsv.v);
// If per-key brightness is 0, keep it off during breathing
if (per_key_led[i].v > 0) {
hsv.v = scale8(abs8(sin8(time) - 128) * 2, rgb_matrix_config.hsv.v);
} else {
hsv.v = 0;
}
RGB rgb = hsv_to_rgb(hsv);
RGB_MATRIX_TEST_LED_FLAGS();
rgb_matrix_region_set_color(params->region, i, rgb.r, rgb.g, rgb.b);
Expand Down Expand Up @@ -74,10 +83,12 @@ bool per_key_rgb_reactive_simple(effect_params_t *params) {
HSV hsv = per_key_led[i];

if (offset > 255) offset = 255;
hsv.v = scale8(255 - offset, rgb_matrix_config.hsv.v);

// if (per_key_led[i].v < hsv.v)
// hsv.v = per_key_led[i].v;
if (per_key_led[i].v > 0) {
hsv.v = scale8(255 - offset, rgb_matrix_config.hsv.v);
} else {
hsv.v = 0;
}

RGB rgb = hsv_to_rgb(hsv);
rgb_matrix_region_set_color(params->region, i, rgb.r, rgb.g, rgb.b);
Expand All @@ -104,9 +115,14 @@ bool per_key_rgb_effect_runner_reactive_splash(uint8_t start, effect_params_t *p
}
hsv.h = per_key_led[i].h;
hsv.s = per_key_led[i].s;
hsv.v = scale8(hsv.v, rgb_matrix_config.hsv.v);
// if (per_key_led[i].v < hsv.v)

// hsv.v = per_key_led[i].v;
if (per_key_led[i].v > 0) {
hsv.v = scale8(hsv.v, rgb_matrix_config.hsv.v);
} else {
hsv.v = 0;
}

RGB rgb = hsv_to_rgb(hsv);
rgb_matrix_region_set_color(params->region, i, rgb.r, rgb.g, rgb.b);
}
Expand Down Expand Up @@ -142,15 +158,15 @@ bool per_key_rgb_reactive_splash(effect_params_t *params) {
bool per_key_rgb(effect_params_t *params) {
switch (per_key_rgb_type) {
case PER_KEY_RGB_BREATHING:
return per_key_rgb_breahting(params);
return per_key_rgb_breathing(params);

case PER_KEY_RGB_REATIVE_SIMPLE:
case PER_KEY_RGB_REACTIVE_SIMPLE:
return per_key_rgb_reactive_simple(params);

case PER_KEY_RGB_REATIVE_MULTI_WIDE:
case PER_KEY_RGB_REACTIVE_MULTI_WIDE:
return per_key_rgb_reactive_multi_wide(params);

case PER_KEY_RGB_REATIVE_SPLASH:
case PER_KEY_RGB_REACTIVE_SPLASH:
return per_key_rgb_reactive_splash(params);

default:
Expand Down
33 changes: 0 additions & 33 deletions keyboards/keychron/q6_max/ansi_encoder/config.h

This file was deleted.

73 changes: 0 additions & 73 deletions keyboards/keychron/q6_max/ansi_encoder/keymaps/keychron/keymap.c

This file was deleted.

85 changes: 0 additions & 85 deletions keyboards/keychron/q6_max/config.h

This file was deleted.

59 changes: 0 additions & 59 deletions keyboards/keychron/q6_max/q6_max.c

This file was deleted.