Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FastLED/FastLED.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kriegsman <1334634+kriegsman@users.noreply.github.com>2021-03-23 02:50:31 +0300
committerMark Kriegsman <1334634+kriegsman@users.noreply.github.com>2021-03-23 02:50:31 +0300
commit74fe6267e1c2cc27b0ce76882ccf125f132a6b7d (patch)
tree11da501d652ac1671ff2cd1eadb4002652c9fd12
parent64463ef742e161eccd5de9c79bb660970502ffde (diff)
Minor cleanup to HSV code. It had been compiling differently recently on AVR Arduinos, leading (sometimes) to a visible red pixel in the middle of the yellow part of the rainbow, and possibly other color glitches. I believe this fixes #1188.
-rw-r--r--src/hsv2rgb.cpp30
1 files changed, 14 insertions, 16 deletions
diff --git a/src/hsv2rgb.cpp b/src/hsv2rgb.cpp
index 1fb8d56b..f1d20896 100644
--- a/src/hsv2rgb.cpp
+++ b/src/hsv2rgb.cpp
@@ -442,19 +442,17 @@ void hsv2rgb_rainbow( const CHSV& hsv, CRGB& rgb)
} else {
//nscale8x3_video( r, g, b, sat);
#if (FASTLED_SCALE8_FIXED==1)
- if( r ) r = scale8_LEAVING_R1_DIRTY( r, sat);
- if( g ) g = scale8_LEAVING_R1_DIRTY( g, sat);
- if( b ) b = scale8_LEAVING_R1_DIRTY( b, sat);
+ r = scale8_LEAVING_R1_DIRTY( r, sat);
+ g = scale8_LEAVING_R1_DIRTY( g, sat);
+ b = scale8_LEAVING_R1_DIRTY( b, sat);
+ cleanup_R1();
#else
- if( r ) r = scale8_LEAVING_R1_DIRTY( r, sat) + 1;
- if( g ) g = scale8_LEAVING_R1_DIRTY( g, sat) + 1;
- if( b ) b = scale8_LEAVING_R1_DIRTY( b, sat) + 1;
+ if( r ) r = scale8( r, sat) + 1;
+ if( g ) g = scale8( g, sat) + 1;
+ if( b ) b = scale8( b, sat) + 1;
#endif
- cleanup_R1();
-
uint8_t desat = 255 - sat;
desat = scale8( desat, desat);
-
uint8_t brightness_floor = desat;
r += brightness_floor;
g += brightness_floor;
@@ -471,15 +469,15 @@ void hsv2rgb_rainbow( const CHSV& hsv, CRGB& rgb)
} else {
// nscale8x3_video( r, g, b, val);
#if (FASTLED_SCALE8_FIXED==1)
- if( r ) r = scale8_LEAVING_R1_DIRTY( r, val);
- if( g ) g = scale8_LEAVING_R1_DIRTY( g, val);
- if( b ) b = scale8_LEAVING_R1_DIRTY( b, val);
+ r = scale8_LEAVING_R1_DIRTY( r, val);
+ g = scale8_LEAVING_R1_DIRTY( g, val);
+ b = scale8_LEAVING_R1_DIRTY( b, val);
+ cleanup_R1();
#else
- if( r ) r = scale8_LEAVING_R1_DIRTY( r, val) + 1;
- if( g ) g = scale8_LEAVING_R1_DIRTY( g, val) + 1;
- if( b ) b = scale8_LEAVING_R1_DIRTY( b, val) + 1;
+ if( r ) r = scale8( r, val) + 1;
+ if( g ) g = scale8( g, val) + 1;
+ if( b ) b = scale8( b, val) + 1;
#endif
- cleanup_R1();
}
}