typing_heatmap: Add macro to configure increase steps (#20300)

Co-authored-by: Joel Challis <git@zvecr.com>
This commit is contained in:
Jasmin 2023-04-30 03:57:30 +02:00 committed by GitHub
parent a415d2203c
commit 4887f03dbd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 2 deletions

View file

@ -690,6 +690,14 @@ Remove the spread effect entirely.
#define RGB_MATRIX_TYPING_HEATMAP_SLIM #define RGB_MATRIX_TYPING_HEATMAP_SLIM
``` ```
It's also possible to adjust the tempo of *heating up*. It's defined as the number of shades that are
increased on the [HSV scale](https://en.wikipedia.org/wiki/HSL_and_HSV). Decreasing this value increases
the number of keystrokes needed to fully heat up the key.
```c
#define RGB_MATRIX_TYPING_HEATMAP_INCREASE_STEP 32
```
### RGB Matrix Effect Solid Reactive :id=rgb-matrix-effect-solid-reactive ### RGB Matrix Effect Solid Reactive :id=rgb-matrix-effect-solid-reactive
Solid reactive effects will pulse RGB light on key presses with user configurable hues. To enable gradient mode that will automatically change reactive color, add the following define: Solid reactive effects will pulse RGB light on key presses with user configurable hues. To enable gradient mode that will automatically change reactive color, add the following define:

View file

@ -1,6 +1,9 @@
#if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && defined(ENABLE_RGB_MATRIX_TYPING_HEATMAP) #if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && defined(ENABLE_RGB_MATRIX_TYPING_HEATMAP)
RGB_MATRIX_EFFECT(TYPING_HEATMAP) RGB_MATRIX_EFFECT(TYPING_HEATMAP)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS # ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
# ifndef RGB_MATRIX_TYPING_HEATMAP_INCREASE_STEP
# define RGB_MATRIX_TYPING_HEATMAP_INCREASE_STEP 32
# endif
# ifndef RGB_MATRIX_TYPING_HEATMAP_DECREASE_DELAY_MS # ifndef RGB_MATRIX_TYPING_HEATMAP_DECREASE_DELAY_MS
# define RGB_MATRIX_TYPING_HEATMAP_DECREASE_DELAY_MS 25 # define RGB_MATRIX_TYPING_HEATMAP_DECREASE_DELAY_MS 25
@ -16,7 +19,7 @@ RGB_MATRIX_EFFECT(TYPING_HEATMAP)
void process_rgb_matrix_typing_heatmap(uint8_t row, uint8_t col) { void process_rgb_matrix_typing_heatmap(uint8_t row, uint8_t col) {
# ifdef RGB_MATRIX_TYPING_HEATMAP_SLIM # ifdef RGB_MATRIX_TYPING_HEATMAP_SLIM
// Limit effect to pressed keys // Limit effect to pressed keys
g_rgb_frame_buffer[row][col] = qadd8(g_rgb_frame_buffer[row][col], 32); g_rgb_frame_buffer[row][col] = qadd8(g_rgb_frame_buffer[row][col], RGB_MATRIX_TYPING_HEATMAP_INCREASE_STEP);
# else # else
if (g_led_config.matrix_co[row][col] == NO_LED) { // skip as pressed key doesn't have an led position if (g_led_config.matrix_co[row][col] == NO_LED) { // skip as pressed key doesn't have an led position
return; return;
@ -27,7 +30,7 @@ void process_rgb_matrix_typing_heatmap(uint8_t row, uint8_t col) {
continue; continue;
} }
if (i_row == row && i_col == col) { if (i_row == row && i_col == col) {
g_rgb_frame_buffer[row][col] = qadd8(g_rgb_frame_buffer[row][col], 32); g_rgb_frame_buffer[row][col] = qadd8(g_rgb_frame_buffer[row][col], RGB_MATRIX_TYPING_HEATMAP_INCREASE_STEP);
} else { } else {
# 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))) # 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]]); 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]]);