From eeb51449c4796b3d30c2b60dbda2ec1103fb317b Mon Sep 17 00:00:00 2001 From: Flo Date: Fri, 12 Dec 2025 19:38:52 +0100 Subject: [PATCH 1/3] Enable inverse gamma correction (gamma < 1.0) Allow gamma values from 0.1 to 3.0 instead of restricting to > 1.0. This enables inverse gamma curves for use cases requiring brightened mid-tones and compressed highlights. Changes: - Update backend validation in set.cpp and cfg.cpp to accept 0.1-3.0 - Update HTML form min value from 1 to 0.1 The calcGammaTable() function already supports any gamma value mathematically, so this just removes an artificial restriction. --- wled00/cfg.cpp | 2 +- wled00/data/settings_leds.htm | 2 +- wled00/set.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/wled00/cfg.cpp b/wled00/cfg.cpp index 47ba152c96..1105101dfb 100644 --- a/wled00/cfg.cpp +++ b/wled00/cfg.cpp @@ -512,7 +512,7 @@ bool deserializeConfig(JsonObject doc, bool fromFS) { else gammaCorrectBri = false; if (light_gc_col > 1.0f) gammaCorrectCol = true; else gammaCorrectCol = false; - if (gammaCorrectVal <= 1.0f || gammaCorrectVal > 3) { + if (gammaCorrectVal < 0.1f || gammaCorrectVal > 3) { gammaCorrectVal = 1.0f; // no gamma correction gammaCorrectBri = false; gammaCorrectCol = false; diff --git a/wled00/data/settings_leds.htm b/wled00/data/settings_leds.htm index 47c4f514d8..f683c964f1 100644 --- a/wled00/data/settings_leds.htm +++ b/wled00/data/settings_leds.htm @@ -937,7 +937,7 @@

Defaults

Apply preset at boot (0 uses values from above)

Use Gamma correction for color: (strongly recommended)
Use Gamma correction for brightness: (not recommended)
- Use Gamma value:

+ Use Gamma value:

Brightness factor: %

Transitions

Default transition time: ms
diff --git a/wled00/set.cpp b/wled00/set.cpp index 087e9b39f2..9c85c8ca5a 100644 --- a/wled00/set.cpp +++ b/wled00/set.cpp @@ -341,7 +341,7 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage) gammaCorrectBri = request->hasArg(F("GB")); gammaCorrectCol = request->hasArg(F("GC")); gammaCorrectVal = request->arg(F("GV")).toFloat(); - if (gammaCorrectVal <= 1.0f || gammaCorrectVal > 3) { + if (gammaCorrectVal < 0.1f || gammaCorrectVal > 3) { gammaCorrectVal = 1.0f; // no gamma correction gammaCorrectBri = false; gammaCorrectCol = false; From 9d55b186146034c13b0998838a80965642901b22 Mon Sep 17 00:00:00 2001 From: Flo Date: Fri, 12 Dec 2025 19:38:52 +0100 Subject: [PATCH 2/3] Enable inverse gamma correction (gamma < 1.0) Allow gamma values from 0.1 to 3.0 instead of restricting to > 1.0. This enables inverse gamma curves for use cases requiring brightened mid-tones and compressed highlights. Changes: - Update backend validation in set.cpp and cfg.cpp to accept 0.1-3.0 - Update HTML form min value from 1 to 0.1 The calcGammaTable() function already supports any gamma value mathematically, so this just removes an artificial restriction. --- wled00/cfg.cpp | 10 +++++----- wled00/data/settings_leds.htm | 2 +- wled00/set.cpp | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/wled00/cfg.cpp b/wled00/cfg.cpp index 47ba152c96..9972205ec1 100644 --- a/wled00/cfg.cpp +++ b/wled00/cfg.cpp @@ -508,11 +508,11 @@ bool deserializeConfig(JsonObject doc, bool fromFS) { 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; - else gammaCorrectBri = false; - if (light_gc_col > 1.0f) gammaCorrectCol = true; - else gammaCorrectCol = false; - if (gammaCorrectVal <= 1.0f || gammaCorrectVal > 3) { + if (light_gc_bri != 1.0f) gammaCorrectBri = true; + else gammaCorrectBri = false; + if (light_gc_col != 1.0f) gammaCorrectCol = true; + else gammaCorrectCol = false; + if (gammaCorrectVal < 0.1f || gammaCorrectVal > 3) { gammaCorrectVal = 1.0f; // no gamma correction gammaCorrectBri = false; gammaCorrectCol = false; diff --git a/wled00/data/settings_leds.htm b/wled00/data/settings_leds.htm index 47c4f514d8..f683c964f1 100644 --- a/wled00/data/settings_leds.htm +++ b/wled00/data/settings_leds.htm @@ -937,7 +937,7 @@

Defaults

Apply preset at boot (0 uses values from above)

Use Gamma correction for color: (strongly recommended)
Use Gamma correction for brightness: (not recommended)
- Use Gamma value:

+ Use Gamma value:

Brightness factor: %

Transitions

Default transition time: ms
diff --git a/wled00/set.cpp b/wled00/set.cpp index 087e9b39f2..9c85c8ca5a 100644 --- a/wled00/set.cpp +++ b/wled00/set.cpp @@ -341,7 +341,7 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage) gammaCorrectBri = request->hasArg(F("GB")); gammaCorrectCol = request->hasArg(F("GC")); gammaCorrectVal = request->arg(F("GV")).toFloat(); - if (gammaCorrectVal <= 1.0f || gammaCorrectVal > 3) { + if (gammaCorrectVal < 0.1f || gammaCorrectVal > 3) { gammaCorrectVal = 1.0f; // no gamma correction gammaCorrectBri = false; gammaCorrectCol = false; From 6b15f924bee8616689e9e8dca15f7a08195e0ecb Mon Sep 17 00:00:00 2001 From: Damian Schneider Date: Sun, 8 Feb 2026 17:46:41 +0100 Subject: [PATCH 3/3] adjust placeholder value to new default --- wled00/data/settings_leds.htm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wled00/data/settings_leds.htm b/wled00/data/settings_leds.htm index b04e57fe9f..469617f148 100644 --- a/wled00/data/settings_leds.htm +++ b/wled00/data/settings_leds.htm @@ -958,7 +958,7 @@

Defaults

Apply preset at boot (0 uses values from above)

Use Gamma correction for color: (strongly recommended)
Use Gamma correction for brightness: (not recommended)
- Use Gamma value:

+ Use Gamma value:

Brightness factor: %

Transitions

Default transition time: ms