diff options
author | Fred Sundvik <fsundvik@gmail.com> | 2016-10-09 19:47:05 +0300 |
---|---|---|
committer | Fred Sundvik <fsundvik@gmail.com> | 2016-10-09 20:04:33 +0300 |
commit | 92a3a96849aee708753a6623b0db228023e3baf8 (patch) | |
tree | 6731d71a061ad390d7ac5fac983e082f81748c2a /quantum/rgblight.c | |
parent | a9df99b81c787862dc3fa11bd854fe39e704da81 (diff) | |
download | firmware-92a3a96849aee708753a6623b0db228023e3baf8.tar.gz firmware-92a3a96849aee708753a6623b0db228023e3baf8.tar.bz2 firmware-92a3a96849aee708753a6623b0db228023e3baf8.zip |
Apply the dim curve to the RGB output
Just like it's supposed to be used. It now looks much better.
Diffstat (limited to 'quantum/rgblight.c')
-rw-r--r-- | quantum/rgblight.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/quantum/rgblight.c b/quantum/rgblight.c index f82e3ec55..b36a1fda0 100644 --- a/quantum/rgblight.c +++ b/quantum/rgblight.c @@ -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); } |