aboutsummaryrefslogtreecommitdiff
path: root/quantum/rgblight.c
diff options
context:
space:
mode:
authorFred Sundvik <fsundvik@gmail.com>2016-10-09 19:47:05 +0300
committerFred Sundvik <fsundvik@gmail.com>2016-10-09 20:04:33 +0300
commit92a3a96849aee708753a6623b0db228023e3baf8 (patch)
tree6731d71a061ad390d7ac5fac983e082f81748c2a /quantum/rgblight.c
parenta9df99b81c787862dc3fa11bd854fe39e704da81 (diff)
downloadqmk_firmware-92a3a96849aee708753a6623b0db228023e3baf8.tar.gz
qmk_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.c8
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;
55 55
56 56
57void sethsv(uint16_t hue, uint8_t sat, uint8_t val, struct cRGB *led1) { 57void sethsv(uint16_t hue, uint8_t sat, uint8_t val, struct cRGB *led1) {
58 // Convert hue, saturation, and value (HSV/HSB) to RGB. DIM_CURVE is used only
59 // on value and saturation (inverted). This looks the most natural.
60 uint8_t r = 0, g = 0, b = 0, base, color; 58 uint8_t r = 0, g = 0, b = 0, base, color;
61 59
62 val = pgm_read_byte(&DIM_CURVE[val]);
63 sat = 255 - pgm_read_byte(&DIM_CURVE[255 - sat]);
64
65 if (sat == 0) { // Acromatic color (gray). Hue doesn't mind. 60 if (sat == 0) { // Acromatic color (gray). Hue doesn't mind.
66 r = val; 61 r = val;
67 g = val; 62 g = val;
@@ -103,6 +98,9 @@ void sethsv(uint16_t hue, uint8_t sat, uint8_t val, struct cRGB *led1) {
103 break; 98 break;
104 } 99 }
105 } 100 }
101 r = pgm_read_byte(&DIM_CURVE[r]);
102 g = pgm_read_byte(&DIM_CURVE[g]);
103 b = pgm_read_byte(&DIM_CURVE[b]);
106 104
107 setrgb(r, g, b, led1); 105 setrgb(r, g, b, led1);
108} 106}