diff --git a/wled00/FX.cpp b/wled00/FX.cpp index c76c9e6b9..887c26ad9 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -1918,7 +1918,8 @@ uint16_t mode_colorwaves_pride_base(bool isPride2015) { bri8 += (255 - brightdepth); if (isPride2015) { - CRGB newcolor = CHSV(hue8, sat8, bri8); + CRGBW newcolor = CRGB(CHSV(hue8, sat8, bri8)); + newcolor.color32 = gamma32inv(newcolor.color32); SEGMENT.blendPixelColor(i, newcolor, 64); } else { SEGMENT.blendPixelColor(i, SEGMENT.color_from_palette(hue8, false, PALETTE_SOLID_WRAP, 0, bri8), 128); diff --git a/wled00/cfg.cpp b/wled00/cfg.cpp index 72ace8dbf..6d5698f42 100644 --- a/wled00/cfg.cpp +++ b/wled00/cfg.cpp @@ -520,7 +520,7 @@ bool deserializeConfig(JsonObject doc, bool fromFS) { CJSON(strip.autoSegments, light[F("aseg")]); CJSON(useRainbowWheel, light[F("rw")]); - CJSON(gammaCorrectVal, light["gc"]["val"]); // default 2.8 + CJSON(gammaCorrectVal, light["gc"]["val"]); // default 2.2 float light_gc_bri = light["gc"]["bri"]; float light_gc_col = light["gc"]["col"]; if (light_gc_bri > 1.0f) gammaCorrectBri = true; diff --git a/wled00/colors.cpp b/wled00/colors.cpp index ff6f3ab58..ea5c9779c 100644 --- a/wled00/colors.cpp +++ b/wled00/colors.cpp @@ -598,3 +598,17 @@ uint32_t IRAM_ATTR_YN NeoGammaWLEDMethod::Correct32(uint32_t color) b = gammaT[b]; return RGBW32(r, g, b, w); } + +uint32_t IRAM_ATTR_YN NeoGammaWLEDMethod::inverseGamma32(uint32_t color) +{ + if (!gammaCorrectCol) return color; + uint8_t w = W(color); + uint8_t r = R(color); + uint8_t g = G(color); + uint8_t b = B(color); + w = gammaT_inv[w]; + r = gammaT_inv[r]; + g = gammaT_inv[g]; + b = gammaT_inv[b]; + return RGBW32(r, g, b, w); +} diff --git a/wled00/fcn_declare.h b/wled00/fcn_declare.h index 8e4233f2c..d2f62870d 100644 --- a/wled00/fcn_declare.h +++ b/wled00/fcn_declare.h @@ -158,6 +158,7 @@ class NeoGammaWLEDMethod { public: [[gnu::hot]] static uint8_t Correct(uint8_t value); // apply Gamma to single channel [[gnu::hot]] static uint32_t Correct32(uint32_t color); // apply Gamma to RGBW32 color (WLED specific, not used by NPB) + [[gnu::hot]] static uint32_t inverseGamma32(uint32_t color); // apply inverse Gamma to RGBW32 color static void calcGammaTable(float gamma); // re-calculates & fills gamma tables static inline uint8_t rawGamma8(uint8_t val) { return gammaT[val]; } // get value from Gamma table (WLED specific, not used by NPB) static inline uint8_t rawInverseGamma8(uint8_t val) { return gammaT_inv[val]; } // get value from inverse Gamma table (WLED specific, not used by NPB) @@ -167,6 +168,7 @@ class NeoGammaWLEDMethod { }; #define gamma32(c) NeoGammaWLEDMethod::Correct32(c) #define gamma8(c) NeoGammaWLEDMethod::rawGamma8(c) +#define gamma32inv(c) NeoGammaWLEDMethod::inverseGamma32(c) #define gamma8inv(c) NeoGammaWLEDMethod::rawInverseGamma8(c) [[gnu::hot, gnu::pure]] uint32_t color_blend(uint32_t c1, uint32_t c2 , uint8_t blend); inline uint32_t color_blend16(uint32_t c1, uint32_t c2, uint16_t b) { return color_blend(c1, c2, b >> 8); };