Apply the dim curve to the RGB output

Just like it's supposed to be used. It now looks much better.
daktil_thumb_popravljen
Fred Sundvik 2016-10-09 19:47:05 +03:00
parent a9df99b81c
commit 92a3a96849
1 changed files with 3 additions and 5 deletions

View File

@ -55,13 +55,8 @@ uint8_t rgblight_inited = 0;
void sethsv(uint16_t hue, uint8_t sat, uint8_t val, struct cRGB *led1) {
// Convert hue, saturation, and value (HSV/HSB) to RGB. DIM_CURVE is used only
// on value and saturation (inverted). This looks the most natural.
uint8_t r = 0, g = 0, b = 0, base, color;
val = pgm_read_byte(&DIM_CURVE[val]);
sat = 255 - pgm_read_byte(&DIM_CURVE[255 - sat]);
if (sat == 0) { // Acromatic color (gray). Hue doesn't mind.
r = val;
g = val;
@ -103,6 +98,9 @@ void sethsv(uint16_t hue, uint8_t sat, uint8_t val, struct cRGB *led1) {
break;
}
}
r = pgm_read_byte(&DIM_CURVE[r]);
g = pgm_read_byte(&DIM_CURVE[g]);
b = pgm_read_byte(&DIM_CURVE[b]);
setrgb(r, g, b, led1);
}