fix(display): Don't attempt to start the tickers if the display is disabled

If max_brightness is zero, then there's no point in trying to dim it (or
turn it off...)
This commit is contained in:
Cameron Fleming 2025-01-28 21:49:26 +00:00
parent f5035f28c9
commit 9896eba02a
1 changed files with 5 additions and 0 deletions

View File

@ -208,6 +208,11 @@ func watchTsEvents() {
// if they're not already set. This is done separately to the init routine as the "never dim"
// option has the value set to zero, but time.NewTicker only accept positive values.
func startBacklightTickers() {
// Don't start the tickers if the display is switched off.
if config.DisplayMaxBrightness == 0 {
return
}
LoadConfig()
if dimTicker == nil && config.DisplayDimAfterSec != 0 {
fmt.Printf("display: dim_ticker has started\n")