Skip to content

Commit ca3c4d6

Browse files
committed
keymap.c: Replaced float arithmetic with integer math in set_layer_color
1 parent 234ccb0 commit ca3c4d6

File tree

1 file changed

+3
-3
lines changed
  • keyboards/zsa/voyager/keymaps/jpds

1 file changed

+3
-3
lines changed

keyboards/zsa/voyager/keymaps/jpds/keymap.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ void set_layer_color(uint8_t layer) {
9090
if (!hsv.h && !hsv.s && !hsv.v) {
9191
rgb_matrix_set_color(i, 0, 0, 0);
9292
} else {
93-
RGB rgb = hsv_to_rgb(hsv);
94-
float f = (float)rgb_matrix_config.hsv.v / UINT8_MAX;
95-
rgb_matrix_set_color(i, f * rgb.r, f * rgb.g, f * rgb.b);
93+
RGB rgb = hsv_to_rgb(hsv);
94+
uint8_t v = rgb_matrix_config.hsv.v;
95+
rgb_matrix_set_color(i, (uint16_t)rgb.r * v / 255, (uint16_t)rgb.g * v / 255, (uint16_t)rgb.b * v / 255);
9696
}
9797
}
9898
}

0 commit comments

Comments
 (0)