]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
Apply the dim curve to the RGB output
authorFred Sundvik <fsundvik@gmail.com>
Sun, 9 Oct 2016 16:47:05 +0000 (19:47 +0300)
committerFred Sundvik <fsundvik@gmail.com>
Sun, 9 Oct 2016 17:04:33 +0000 (20:04 +0300)
Just like it's supposed to be used. It now looks much better.

quantum/rgblight.c

index f82e3ec5589a268a8ca4f410b990346c9f1e10a3..b36a1fda0eb4e06079e8172f81608a92d71163b2 100644 (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);
 }