Skip to content

Commit

Permalink
apply gamma correction to brightness control
Browse files Browse the repository at this point in the history
  • Loading branch information
socke7 committed Nov 13, 2023
1 parent 6c9e756 commit bb9ce3b
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 bb9ce3b

Please sign in to comment.