Merge remote-tracking branch 'qmk/master' into merge-2023-03-12
This commit is contained in:
@ -5,7 +5,7 @@ RGB_MATRIX_EFFECT(JELLYBEAN_RAINDROPS)
|
||||
|
||||
static void jellybean_raindrops_set_color(int i, effect_params_t* params) {
|
||||
if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) return;
|
||||
HSV hsv = {rand() & 0xFF, qadd8(rand() & 0x7F, 0x80), rgb_matrix_config.hsv.v};
|
||||
HSV hsv = {random8(), random8_min_max(127, 255), rgb_matrix_config.hsv.v};
|
||||
RGB rgb = rgb_matrix_hsv_to_rgb(hsv);
|
||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||
}
|
||||
@ -14,7 +14,7 @@ bool JELLYBEAN_RAINDROPS(effect_params_t* params) {
|
||||
if (!params->init) {
|
||||
// Change one LED every tick, make sure speed is not 0
|
||||
if (scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed, 16)) % 5 == 0) {
|
||||
jellybean_raindrops_set_color(rand() % DRIVER_LED_TOTAL, params);
|
||||
jellybean_raindrops_set_color(random8_max(RGB_MATRIX_LED_COUNT), params);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ RGB_MATRIX_EFFECT(PIXEL_FLOW)
|
||||
|
||||
static bool PIXEL_FLOW(effect_params_t* params) {
|
||||
// LED state array
|
||||
static RGB led[DRIVER_LED_TOTAL];
|
||||
static RGB led[RGB_MATRIX_LED_COUNT];
|
||||
|
||||
static uint32_t wait_timer = 0;
|
||||
if (wait_timer > g_rgb_timer) {
|
||||
@ -21,8 +21,8 @@ static bool PIXEL_FLOW(effect_params_t* params) {
|
||||
if (params->init) {
|
||||
// Clear LEDs and fill the state array
|
||||
rgb_matrix_set_color_all(0, 0, 0);
|
||||
for (uint8_t j = 0; j < DRIVER_LED_TOTAL; ++j) {
|
||||
led[j] = (random8() & 2) ? (RGB){0, 0, 0} : hsv_to_rgb((HSV){random8(), qadd8(random8() >> 1, 127), rgb_matrix_config.hsv.v});
|
||||
for (uint8_t j = 0; j < RGB_MATRIX_LED_COUNT; ++j) {
|
||||
led[j] = (random8() & 2) ? (RGB){0, 0, 0} : hsv_to_rgb((HSV){random8(), random8_min_max(127, 255), rgb_matrix_config.hsv.v});
|
||||
}
|
||||
}
|
||||
|
||||
@ -39,7 +39,7 @@ static bool PIXEL_FLOW(effect_params_t* params) {
|
||||
led[j] = led[j + 1];
|
||||
}
|
||||
// Fill last LED
|
||||
led[led_max - 1] = (random8() & 2) ? (RGB){0, 0, 0} : hsv_to_rgb((HSV){random8(), qadd8(random8() >> 1, 127), rgb_matrix_config.hsv.v});
|
||||
led[led_max - 1] = (random8() & 2) ? (RGB){0, 0, 0} : hsv_to_rgb((HSV){random8(), random8_min_max(127, 255), rgb_matrix_config.hsv.v});
|
||||
// Set pulse timer
|
||||
wait_timer = g_rgb_timer + interval();
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
// Copyright (C) 2022 @filterpaper
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
// Inspired from 4x12 fractal created by @schwarzgrau
|
||||
// Inspired by 4x12 fractal from @GEIGEIGEIST
|
||||
|
||||
#ifdef ENABLE_RGB_MATRIX_PIXEL_FRACTAL
|
||||
#define RGB_MATRIX_EFFECT_PIXEL_FRACTAL
|
||||
|
@ -1,18 +1,5 @@
|
||||
/* Copyright (C) 2021 @filterpaper
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
// Copyright 2022 @filterpaper
|
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
|
||||
#ifdef ENABLE_RGB_MATRIX_PIXEL_RAIN
|
||||
#define RGB_MATRIX_EFFECT_PIXEL_RAIN
|
||||
@ -26,23 +13,23 @@ static bool PIXEL_RAIN(effect_params_t* params) {
|
||||
return 500 / scale16by8(qadd8(rgb_matrix_config.speed, 16), 16);
|
||||
}
|
||||
|
||||
void rain_pixel(uint8_t i, effect_params_t * params, bool off) {
|
||||
if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) {
|
||||
inline void rain_pixel(uint8_t led_index) {
|
||||
if (!HAS_ANY_FLAGS(g_led_config.flags[led_index], params->flags)) {
|
||||
return;
|
||||
}
|
||||
if (off) {
|
||||
rgb_matrix_set_color(i, 0, 0, 0);
|
||||
if (random8() & 2) {
|
||||
rgb_matrix_set_color(led_index, 0, 0, 0);
|
||||
} else {
|
||||
HSV hsv = {random8(), qadd8(random8() >> 1, 127), rgb_matrix_config.hsv.v};
|
||||
HSV hsv = {random8(), random8_min_max(127, 255), rgb_matrix_config.hsv.v};
|
||||
RGB rgb = rgb_matrix_hsv_to_rgb(hsv);
|
||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||
rgb_matrix_set_color(led_index, rgb.r, rgb.g, rgb.b);
|
||||
}
|
||||
wait_timer = g_rgb_timer + interval();
|
||||
}
|
||||
|
||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||
if (g_rgb_timer > wait_timer) {
|
||||
rain_pixel(mod8(random8(), DRIVER_LED_TOTAL), params, random8() & 2);
|
||||
rain_pixel(random8_max(RGB_MATRIX_LED_COUNT));
|
||||
}
|
||||
return rgb_matrix_check_finished_leds(led_max);
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ bool RAINDROPS(effect_params_t* params) {
|
||||
if (!params->init) {
|
||||
// Change one LED every tick, make sure speed is not 0
|
||||
if (scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed, 16)) % 10 == 0) {
|
||||
raindrops_set_color(random8() % DRIVER_LED_TOTAL, params);
|
||||
raindrops_set_color(random8_max(RGB_MATRIX_LED_COUNT), params);
|
||||
}
|
||||
} else {
|
||||
for (int i = led_min; i < led_max; i++) {
|
||||
|
@ -6,7 +6,7 @@ RGB_MATRIX_EFFECT(SOLID_REACTIVE)
|
||||
|
||||
static HSV SOLID_REACTIVE_math(HSV hsv, uint16_t offset) {
|
||||
# ifdef RGB_MATRIX_SOLID_REACTIVE_GRADIENT_MODE
|
||||
hsv.h = scale16by8(g_rgb_timer, add8(rgb_matrix_config.speed, 1) >> 6);
|
||||
hsv.h = scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed, 8) >> 4);
|
||||
# endif
|
||||
hsv.h += qsub8(130, offset);
|
||||
return hsv;
|
||||
|
@ -22,7 +22,7 @@ static HSV SOLID_REACTIVE_CROSS_math(HSV hsv, int16_t dx, int16_t dy, uint8_t di
|
||||
effect += dx > dy ? dy : dx;
|
||||
if (effect > 255) effect = 255;
|
||||
# ifdef RGB_MATRIX_SOLID_REACTIVE_GRADIENT_MODE
|
||||
hsv.h = scale16by8(g_rgb_timer, add8(rgb_matrix_config.speed, 1) >> 6);
|
||||
hsv.h = scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed, 8) >> 4);
|
||||
# endif
|
||||
hsv.v = qadd8(hsv.v, 255 - effect);
|
||||
return hsv;
|
||||
|
@ -19,10 +19,11 @@ static HSV SOLID_REACTIVE_NEXUS_math(HSV hsv, int16_t dx, int16_t dy, uint8_t di
|
||||
if (dist > 72) effect = 255;
|
||||
if ((dx > 8 || dx < -8) && (dy > 8 || dy < -8)) effect = 255;
|
||||
# ifdef RGB_MATRIX_SOLID_REACTIVE_GRADIENT_MODE
|
||||
hsv.h = scale16by8(g_rgb_timer, add8(rgb_matrix_config.speed, 1) >> 6);
|
||||
hsv.h = scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed, 8) >> 4) + dy / 4;
|
||||
# else
|
||||
hsv.h = rgb_matrix_config.hsv.h + dy / 4;
|
||||
# endif
|
||||
hsv.v = qadd8(hsv.v, 255 - effect);
|
||||
hsv.h = rgb_matrix_config.hsv.h + dy / 4;
|
||||
return hsv;
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ RGB_MATRIX_EFFECT(SOLID_REACTIVE_SIMPLE)
|
||||
|
||||
static HSV SOLID_REACTIVE_SIMPLE_math(HSV hsv, uint16_t offset) {
|
||||
# ifdef RGB_MATRIX_SOLID_REACTIVE_GRADIENT_MODE
|
||||
hsv.h = scale16by8(g_rgb_timer, add8(rgb_matrix_config.speed, 1) >> 6);
|
||||
hsv.h = scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed, 8) >> 4);
|
||||
# endif
|
||||
hsv.v = scale8(255 - offset, hsv.v);
|
||||
return hsv;
|
||||
|
@ -17,7 +17,7 @@ static HSV SOLID_REACTIVE_WIDE_math(HSV hsv, int16_t dx, int16_t dy, uint8_t dis
|
||||
uint16_t effect = tick + dist * 5;
|
||||
if (effect > 255) effect = 255;
|
||||
# ifdef RGB_MATRIX_SOLID_REACTIVE_GRADIENT_MODE
|
||||
hsv.h = scale16by8(g_rgb_timer, add8(rgb_matrix_config.speed, 1) >> 6);
|
||||
hsv.h = scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed, 8) >> 4);
|
||||
# endif
|
||||
hsv.v = qadd8(hsv.v, 255 - effect);
|
||||
return hsv;
|
||||
|
@ -30,7 +30,7 @@ void process_rgb_matrix_typing_heatmap(uint8_t row, uint8_t col) {
|
||||
if (i_row == row && i_col == col) {
|
||||
g_rgb_frame_buffer[row][col] = qadd8(g_rgb_frame_buffer[row][col], 32);
|
||||
} else {
|
||||
# define LED_DISTANCE(led_a, led_b) sqrt16(((int8_t)(led_a.x - led_b.x) * (int8_t)(led_a.x - led_b.x)) + ((int8_t)(led_a.y - led_b.y) * (int8_t)(led_a.y - led_b.y)))
|
||||
# define LED_DISTANCE(led_a, led_b) sqrt16(((int16_t)(led_a.x - led_b.x) * (int16_t)(led_a.x - led_b.x)) + ((int16_t)(led_a.y - led_b.y) * (int16_t)(led_a.y - led_b.y)))
|
||||
uint8_t distance = LED_DISTANCE(g_led_config.point[g_led_config.matrix_co[row][col]], g_led_config.point[g_led_config.matrix_co[i_row][i_col]]);
|
||||
# undef LED_DISTANCE
|
||||
if (distance <= RGB_MATRIX_TYPING_HEATMAP_SPREAD) {
|
||||
|
@ -3,7 +3,7 @@
|
||||
RGB_MATRIX_EFFECT(VIALRGB_DIRECT)
|
||||
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
extern HSV g_direct_mode_colors[DRIVER_LED_TOTAL];
|
||||
extern HSV g_direct_mode_colors[RGB_MATRIX_LED_COUNT];
|
||||
|
||||
bool VIALRGB_DIRECT(effect_params_t* params) {
|
||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||
@ -12,7 +12,7 @@ bool VIALRGB_DIRECT(effect_params_t* params) {
|
||||
RGB rgb = rgb_matrix_hsv_to_rgb(g_direct_mode_colors[i]);
|
||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||
}
|
||||
return led_max < DRIVER_LED_TOTAL;
|
||||
return led_max < RGB_MATRIX_LED_COUNT;
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user