Skip to content

Commit

Permalink
Merge pull request #397 from socke7/brightness-curve
Browse files Browse the repository at this point in the history
apply gamma correction to brightness control
  • Loading branch information
Blueforcer authored Nov 19, 2023
2 parents 6c9e756 + bb9ce3b commit 7911dd0
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/PeripheryManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,7 @@ void PeripheryManager_::tick()
if (AUTO_BRIGHTNESS && !MATRIX_OFF)
{
brightnessPercent = sampleAverage / 1023.0 * 100.0;
brightnessPercent = (brightnessPercent * brightnessPercent * brightnessPercent) / (100.0 * 100.0); // apply gamma correction (gamma = 3)
BRIGHTNESS = map(brightnessPercent, 0, 100, MIN_BRIGHTNESS, MAX_BRIGHTNESS);
DisplayManager.setBrightness(BRIGHTNESS);
}
Expand Down

0 comments on commit 7911dd0

Please sign in to comment.