From 76616c02fd904201c8f143128a563d6c63bf5598 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 15 Dec 2025 09:05:03 +0000 Subject: [PATCH 1/4] Initial plan From 0605c3b1ef7714f40d3dff63a260c2cbeb98ecd1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 15 Dec 2025 09:16:02 +0000 Subject: [PATCH 2/4] Apply inverse gamma correction to custom palettes to match built-in palettes Co-authored-by: DedeHai <6280424+DedeHai@users.noreply.github.com> --- wled00/colors.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/wled00/colors.cpp b/wled00/colors.cpp index 6ada4f1f6b..f152560266 100644 --- a/wled00/colors.cpp +++ b/wled00/colors.cpp @@ -268,7 +268,11 @@ void loadCustomPalettes() { uint8_t rgbw[] = {0,0,0,0}; if (colorFromHexString(rgbw, pal[i+1].as())) { // will catch non-string entires tcp[ j ] = (uint8_t) pal[ i ].as(); // index - for (size_t c=0; c<3; c++) tcp[j+1+c] = rgbw[c]; // only use RGB component + // Apply inverse gamma correction to match built-in palettes + uint32_t color = NeoGammaWLEDMethod::inverseGamma32(RGBW32(rgbw[0], rgbw[1], rgbw[2], 0)); + tcp[j+1] = R(color); + tcp[j+2] = G(color); + tcp[j+3] = B(color); DEBUGFX_PRINTF_P(PSTR("%2u -> %3d [%3d,%3d,%3d]\n"), i, int(tcp[j]), int(tcp[j+1]), int(tcp[j+2]), int(tcp[j+3])); j += 4; } @@ -278,7 +282,11 @@ void loadCustomPalettes() { palSize -= palSize % 4; // make sure size is multiple of 4 for (size_t i=0; i()<256; i+=4) { tcp[ i ] = (uint8_t) pal[ i ].as(); // index - for (size_t c=0; c<3; c++) tcp[i+1+c] = (uint8_t) pal[i+1+c].as(); + // Apply inverse gamma correction to match built-in palettes + uint32_t color = NeoGammaWLEDMethod::inverseGamma32(RGBW32(pal[i+1].as(), pal[i+2].as(), pal[i+3].as(), 0)); + tcp[i+1] = R(color); + tcp[i+2] = G(color); + tcp[i+3] = B(color); DEBUGFX_PRINTF_P(PSTR("%2u -> %3d [%3d,%3d,%3d]\n"), i, int(tcp[i]), int(tcp[i+1]), int(tcp[i+2]), int(tcp[i+3])); } } From d16dc5dfaa51efa94a2fcd60de7cdcb7aba77161 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 15 Dec 2025 09:17:32 +0000 Subject: [PATCH 3/4] Complete fix for custom palette gamma correction issue Co-authored-by: DedeHai <6280424+DedeHai@users.noreply.github.com> --- _codeql_detected_source_root | 1 + 1 file changed, 1 insertion(+) create mode 120000 _codeql_detected_source_root diff --git a/_codeql_detected_source_root b/_codeql_detected_source_root new file mode 120000 index 0000000000..945c9b46d6 --- /dev/null +++ b/_codeql_detected_source_root @@ -0,0 +1 @@ +. \ No newline at end of file From 55d4d6c044f4e8a51c3a4108f01115e4e0dce158 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 15 Dec 2025 18:08:02 +0000 Subject: [PATCH 4/4] Revert incorrect gamma correction changes to loadCustomPalettes Co-authored-by: softhack007 <91616163+softhack007@users.noreply.github.com> --- _codeql_detected_source_root | 1 - wled00/colors.cpp | 12 ++---------- 2 files changed, 2 insertions(+), 11 deletions(-) delete mode 120000 _codeql_detected_source_root diff --git a/_codeql_detected_source_root b/_codeql_detected_source_root deleted file mode 120000 index 945c9b46d6..0000000000 --- a/_codeql_detected_source_root +++ /dev/null @@ -1 +0,0 @@ -. \ No newline at end of file diff --git a/wled00/colors.cpp b/wled00/colors.cpp index f152560266..6ada4f1f6b 100644 --- a/wled00/colors.cpp +++ b/wled00/colors.cpp @@ -268,11 +268,7 @@ void loadCustomPalettes() { uint8_t rgbw[] = {0,0,0,0}; if (colorFromHexString(rgbw, pal[i+1].as())) { // will catch non-string entires tcp[ j ] = (uint8_t) pal[ i ].as(); // index - // Apply inverse gamma correction to match built-in palettes - uint32_t color = NeoGammaWLEDMethod::inverseGamma32(RGBW32(rgbw[0], rgbw[1], rgbw[2], 0)); - tcp[j+1] = R(color); - tcp[j+2] = G(color); - tcp[j+3] = B(color); + for (size_t c=0; c<3; c++) tcp[j+1+c] = rgbw[c]; // only use RGB component DEBUGFX_PRINTF_P(PSTR("%2u -> %3d [%3d,%3d,%3d]\n"), i, int(tcp[j]), int(tcp[j+1]), int(tcp[j+2]), int(tcp[j+3])); j += 4; } @@ -282,11 +278,7 @@ void loadCustomPalettes() { palSize -= palSize % 4; // make sure size is multiple of 4 for (size_t i=0; i()<256; i+=4) { tcp[ i ] = (uint8_t) pal[ i ].as(); // index - // Apply inverse gamma correction to match built-in palettes - uint32_t color = NeoGammaWLEDMethod::inverseGamma32(RGBW32(pal[i+1].as(), pal[i+2].as(), pal[i+3].as(), 0)); - tcp[i+1] = R(color); - tcp[i+2] = G(color); - tcp[i+3] = B(color); + for (size_t c=0; c<3; c++) tcp[i+1+c] = (uint8_t) pal[i+1+c].as(); DEBUGFX_PRINTF_P(PSTR("%2u -> %3d [%3d,%3d,%3d]\n"), i, int(tcp[i]), int(tcp[i+1]), int(tcp[i+2]), int(tcp[i+3])); } }