Reapply brightness on display config change

This commit is contained in:
Serge
2024-03-01 23:19:44 +01:00
parent c1a6019d57
commit f36a55f086
3 changed files with 30 additions and 5 deletions

View File

@@ -47,6 +47,17 @@ namespace GHelper.Display
}
}
public void SetBrightness(int brightness = -1)
{
if (!AppConfig.IsOLED()) return;
if (brightness >= 0) AppConfig.Set("brightness", brightness);
else brightness = AppConfig.Get("brightness");
if (brightness >= 0) SetGamma(brightness);
}
public void SetGamma(int brightness = 100)
{
var bright = Math.Round((float)brightness / 200 + 0.5, 2);