~ruther/qmk_firmware

92a3a96849aee708753a6623b0db228023e3baf8 — Fred Sundvik 8 years ago a9df99b
Apply the dim curve to the RGB output

Just like it's supposed to be used. It now looks much better.
1 files changed, 3 insertions(+), 5 deletions(-)

M quantum/rgblight.c
M quantum/rgblight.c => quantum/rgblight.c +3 -5
@@ 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);
}