summaryrefslogtreecommitdiff
path: root/quantum/color.c
diff options
context:
space:
mode:
authorFlorian Didron <fdidron@users.noreply.github.com>2019-05-06 09:58:00 +0900
committerGitHub <noreply@github.com>2019-05-06 09:58:00 +0900
commit46ea7dfd516c4d617da96ef385e7699123bb3222 (patch)
tree7ebb3fe96f194accc6eed3eb044b73d9d843b5c2 /quantum/color.c
parent1f3fd52b6df2bdcce044ae013fa12ed56092adf0 (diff)
parent22426a4b4a29781b1d4b416717d44ceb434b67a2 (diff)
Merge pull request #39 from zsa/fix/hue_to_rgb_tuning
Adjusted the linear led table and hsv_to_rgb to better handle 255 hue
Diffstat (limited to 'quantum/color.c')
-rw-r--r--quantum/color.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/quantum/color.c b/quantum/color.c
index c49877592e..466e6edacb 100644
--- a/quantum/color.c
+++ b/quantum/color.c
@@ -22,8 +22,8 @@
RGB hsv_to_rgb( HSV hsv )
{
RGB rgb;
- uint8_t region, p, q, t;
- uint16_t h, s, v, remainder;
+ uint8_t region, remainder, p, q, t;
+ uint16_t h, s, v;
if ( hsv.s == 0 )
{
@@ -37,8 +37,8 @@ RGB hsv_to_rgb( HSV hsv )
s = hsv.s;
v = hsv.v;
- region = h / 43;
- remainder = (h - (region * 43)) * 6;
+ region = h * 6 / 255;
+ remainder = (h * 2 - region * 85) * 3;
p = (v * (255 - s)) >> 8;
q = (v * (255 - ((s * remainder) >> 8))) >> 8;
@@ -46,6 +46,7 @@ RGB hsv_to_rgb( HSV hsv )
switch ( region )
{
+ case 6:
case 0:
rgb.r = v;
rgb.g = t;