Remove gamma value lower limit to enable inverse gamma correction#5187
Remove gamma value lower limit to enable inverse gamma correction#5187
Conversation
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.
WalkthroughLowered the minimum acceptable gamma correction from 1.0 to 0.1 in validation and UI, so Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Did you check both gamma functions create correct tables for the new range? |
|
I checked the functions, they do work still. |
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.
eeb5144 to
9d55b18
Compare
|
I think I have it figured out - updated lines 511 and 513 to check != 1.0f instead of > 1.0f so gamma correction is enabled for any non-linear value (both below and above 1.0). This should fix the persistence issue after reboot. |
|
Any more testing needed for this? Seems like a low impact change |
Summary
Remove the artificial restriction that prevents gamma values below 1.0, enabling inverse gamma correction.
Motivation
LEDs can appear too dark at low brightness levels. Inverse gamma correction (gamma < 1.0) is needed to brighten the lower end of the brightness curve and make dimmed LEDs more visible.
Currently, gamma values are restricted to > 1.0, which only allows standard gamma correction. This PR removes that limitation.
Changes
set.cppandcfg.cppto allow gamma range 0.1-3.0 (was 1.0-3.0)settings_leds.htmto match (min="0.1")Technical Details
The
NeoGammaWLEDMethod::calcGammaTable()function already supports any gamma value mathematically. This PR simply removes an artificial restriction that prevented values < 1.0.Testing
Tested on v0.15.3 and latest main - inverse gamma values (< 1.0) now work correctly and improve visibility at low brightness levels.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.