Skip to content

Commit

Permalink
Fix int8_t overflow in RGB heatmap effect (#18410)
Browse files Browse the repository at this point in the history
  • Loading branch information
RagingCactus authored Sep 19, 2022
1 parent 89df40d commit 652d1d8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion quantum/rgb_matrix/animations/typing_heatmap_anim.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,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) {
Expand Down

0 comments on commit 652d1d8

Please sign in to comment.