aboutsummaryrefslogtreecommitdiff
path: root/quantum/rgblight.c
diff options
context:
space:
mode:
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}