mirror of
https://github.com/qmk/qmk_firmware.git
synced 2026-09-07 10:53:17 +02:00
Make framebuffer effects honour rgb_matrix_map_row_column_to_led (#26294)
This commit is contained in:
@@ -37,18 +37,22 @@ bool DIGITAL_RAIN(effect_params_t* params) {
|
|||||||
g_rgb_frame_buffer[row][col]--;
|
g_rgb_frame_buffer[row][col]--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// set the pixel colour
|
// set the pixel colour
|
||||||
uint8_t led[LED_HITS_TO_REMEMBER];
|
uint8_t led[LED_HITS_TO_REMEMBER];
|
||||||
uint8_t led_count = rgb_matrix_map_row_column_to_led(row, col, led);
|
uint8_t led_count = rgb_matrix_map_row_column_to_led(row, col, led);
|
||||||
|
|
||||||
// TODO: multiple leds are supported mapped to the same row/column
|
|
||||||
if (led_count > 0) {
|
if (led_count > 0) {
|
||||||
if (g_rgb_frame_buffer[row][col] > pure_green_intensity) {
|
if (g_rgb_frame_buffer[row][col] > pure_green_intensity) {
|
||||||
const uint8_t boost = (uint8_t)((uint16_t)max_brightness_boost * (g_rgb_frame_buffer[row][col] - pure_green_intensity) / (max_intensity - pure_green_intensity));
|
const uint8_t boost = (uint8_t)((uint16_t)max_brightness_boost * (g_rgb_frame_buffer[row][col] - pure_green_intensity) / (max_intensity - pure_green_intensity));
|
||||||
rgb_matrix_set_color(led[0], boost, max_intensity, boost);
|
for (uint8_t index = 0; index < led_count; index++) {
|
||||||
|
rgb_matrix_set_color(led[index], boost, max_intensity, boost);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
const uint8_t green = (uint8_t)((uint16_t)max_intensity * g_rgb_frame_buffer[row][col] / pure_green_intensity);
|
const uint8_t green = (uint8_t)((uint16_t)max_intensity * g_rgb_frame_buffer[row][col] / pure_green_intensity);
|
||||||
rgb_matrix_set_color(led[0], 0, green, 0);
|
for (uint8_t index = 0; index < led_count; index++) {
|
||||||
|
rgb_matrix_set_color(led[index], 0, green, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,19 +77,32 @@ bool TYPING_HEATMAP(effect_params_t* params) {
|
|||||||
uint8_t count = 0;
|
uint8_t count = 0;
|
||||||
for (uint8_t row = 0; row < MATRIX_ROWS && count < RGB_MATRIX_LED_PROCESS_LIMIT; row++) {
|
for (uint8_t row = 0; row < MATRIX_ROWS && count < RGB_MATRIX_LED_PROCESS_LIMIT; row++) {
|
||||||
for (uint8_t col = 0; col < MATRIX_COLS && RGB_MATRIX_LED_PROCESS_LIMIT; col++) {
|
for (uint8_t col = 0; col < MATRIX_COLS && RGB_MATRIX_LED_PROCESS_LIMIT; col++) {
|
||||||
if (g_led_config.matrix_co[row][col] >= led_min && g_led_config.matrix_co[row][col] < led_max) {
|
uint8_t val = g_rgb_frame_buffer[row][col];
|
||||||
count++;
|
|
||||||
uint8_t val = g_rgb_frame_buffer[row][col];
|
|
||||||
if (!HAS_ANY_FLAGS(g_led_config.flags[g_led_config.matrix_co[row][col]], params->flags)) continue;
|
|
||||||
|
|
||||||
hsv_t hsv = {170 - qsub8(val, 85), rgb_matrix_config.hsv.s, scale8((qadd8(170, val) - 170) * 3, rgb_matrix_config.hsv.v)};
|
bool processed = false;
|
||||||
rgb_t rgb = rgb_matrix_hsv_to_rgb(hsv);
|
|
||||||
rgb_matrix_set_color(g_led_config.matrix_co[row][col], rgb.r, rgb.g, rgb.b);
|
|
||||||
|
|
||||||
if (decrease_heatmap_values) {
|
uint8_t led[LED_HITS_TO_REMEMBER];
|
||||||
g_rgb_frame_buffer[row][col] = qsub8(val, 1);
|
uint8_t led_count = rgb_matrix_map_row_column_to_led(row, col, led);
|
||||||
|
for (uint8_t index = 0; index < led_count; index++) {
|
||||||
|
uint8_t led_index = led[index];
|
||||||
|
|
||||||
|
if (led_index >= led_min && led_index < led_max) {
|
||||||
|
count++;
|
||||||
|
if (!HAS_ANY_FLAGS(g_led_config.flags[led_index], params->flags)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
hsv_t hsv = {170 - qsub8(val, 85), rgb_matrix_config.hsv.s, scale8((qadd8(170, val) - 170) * 3, rgb_matrix_config.hsv.v)};
|
||||||
|
rgb_t rgb = rgb_matrix_hsv_to_rgb(hsv);
|
||||||
|
|
||||||
|
rgb_matrix_set_color(led_index, rgb.r, rgb.g, rgb.b);
|
||||||
|
processed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (processed && decrease_heatmap_values) {
|
||||||
|
g_rgb_frame_buffer[row][col] = qsub8(val, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user