Merge remote-tracking branch 'qmk/master' into merge-2022-07-11
This commit is contained in:
@@ -11,11 +11,13 @@ RGB_MATRIX_EFFECT(DIGITAL_RAIN)
|
||||
bool DIGITAL_RAIN(effect_params_t* params) {
|
||||
// algorithm ported from https://github.com/tremby/Kaleidoscope-LEDEffect-DigitalRain
|
||||
const uint8_t drop_ticks = 28;
|
||||
const uint8_t pure_green_intensity = 0xd0;
|
||||
const uint8_t max_brightness_boost = 0xc0;
|
||||
const uint8_t max_intensity = 0xff;
|
||||
const uint8_t pure_green_intensity = (((uint16_t)rgb_matrix_config.hsv.v) * 3) >> 2;
|
||||
const uint8_t max_brightness_boost = (((uint16_t)rgb_matrix_config.hsv.v) * 3) >> 2;
|
||||
const uint8_t max_intensity = rgb_matrix_config.hsv.v;
|
||||
const uint8_t decay_ticks = 0xff / max_intensity;
|
||||
|
||||
static uint8_t drop = 0;
|
||||
static uint8_t drop = 0;
|
||||
static uint8_t decay = 0;
|
||||
|
||||
if (params->init) {
|
||||
rgb_matrix_set_color_all(0, 0, 0);
|
||||
@@ -23,6 +25,7 @@ bool DIGITAL_RAIN(effect_params_t* params) {
|
||||
drop = 0;
|
||||
}
|
||||
|
||||
decay++;
|
||||
for (uint8_t col = 0; col < MATRIX_COLS; col++) {
|
||||
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
|
||||
if (row == 0 && drop == 0 && rand() < RAND_MAX / RGB_DIGITAL_RAIN_DROPS) {
|
||||
@@ -31,7 +34,9 @@ bool DIGITAL_RAIN(effect_params_t* params) {
|
||||
g_rgb_frame_buffer[row][col] = max_intensity;
|
||||
} else if (g_rgb_frame_buffer[row][col] > 0 && g_rgb_frame_buffer[row][col] < max_intensity) {
|
||||
// neither fully bright nor dark, decay it
|
||||
g_rgb_frame_buffer[row][col]--;
|
||||
if (decay == decay_ticks) {
|
||||
g_rgb_frame_buffer[row][col]--;
|
||||
}
|
||||
}
|
||||
// set the pixel colour
|
||||
uint8_t led[LED_HITS_TO_REMEMBER];
|
||||
@@ -49,6 +54,9 @@ bool DIGITAL_RAIN(effect_params_t* params) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (decay == decay_ticks) {
|
||||
decay = 0;
|
||||
}
|
||||
|
||||
if (++drop > drop_ticks) {
|
||||
// reset drop timer
|
||||
@@ -60,9 +68,9 @@ bool DIGITAL_RAIN(effect_params_t* params) {
|
||||
g_rgb_frame_buffer[row][col]--;
|
||||
}
|
||||
// check if the pixel above is bright
|
||||
if (g_rgb_frame_buffer[row - 1][col] == max_intensity) {
|
||||
if (g_rgb_frame_buffer[row - 1][col] >= max_intensity) { // Note: can be larger than max_intensity if val was recently decreased
|
||||
// allow old bright pixel to decay
|
||||
g_rgb_frame_buffer[row - 1][col]--;
|
||||
g_rgb_frame_buffer[row - 1][col] = max_intensity - 1;
|
||||
// make this pixel bright
|
||||
g_rgb_frame_buffer[row][col] = max_intensity;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,10 @@ RGB_MATRIX_EFFECT(TYPING_HEATMAP)
|
||||
# endif
|
||||
|
||||
void process_rgb_matrix_typing_heatmap(uint8_t row, uint8_t col) {
|
||||
# ifdef RGB_MATRIX_TYPING_HEATMAP_SLIM
|
||||
// Limit effect to pressed keys
|
||||
g_rgb_frame_buffer[row][col] = qadd8(g_rgb_frame_buffer[row][col], 32);
|
||||
# else
|
||||
uint8_t m_row = row - 1;
|
||||
uint8_t p_row = row + 1;
|
||||
uint8_t m_col = col - 1;
|
||||
@@ -28,6 +32,7 @@ void process_rgb_matrix_typing_heatmap(uint8_t row, uint8_t col) {
|
||||
g_rgb_frame_buffer[m_row][col] = qadd8(g_rgb_frame_buffer[m_row][col], 16);
|
||||
if (p_col < MATRIX_COLS) g_rgb_frame_buffer[m_row][p_col] = qadd8(g_rgb_frame_buffer[m_row][p_col], 13);
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
// A timer to track the last time we decremented all heatmap values.
|
||||
|
||||
Reference in New Issue
Block a user