Fix RGB Matrix Typing Heatmap overflow (#25915)

This commit is contained in:
nullptr 2026-01-03 20:45:29 +01:00 committed by GitHub
parent ddeaa26fef
commit 91a9f9e492
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -32,7 +32,7 @@ void process_rgb_matrix_typing_heatmap(uint8_t row, uint8_t col) {
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], RGB_MATRIX_TYPING_HEATMAP_INCREASE_STEP); 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(((int32_t)(led_a.x - led_b.x) * (int32_t)(led_a.x - led_b.x)) + ((int32_t)(led_a.y - led_b.y) * (int32_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]]);
# undef LED_DISTANCE # undef LED_DISTANCE
if (distance <= RGB_MATRIX_TYPING_HEATMAP_SPREAD) { if (distance <= RGB_MATRIX_TYPING_HEATMAP_SPREAD) {