From ce54d101292d55f89de998238708c1d0a2892da3 Mon Sep 17 00:00:00 2001 From: Cameron Fleming Date: Tue, 28 Jan 2025 22:13:06 +0000 Subject: [PATCH] fix: Don't wake up the display if it's turned off --- display.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/display.go b/display.go index e8473f0..416401b 100644 --- a/display.go +++ b/display.go @@ -157,6 +157,11 @@ func wakeDisplay(force bool) { return } + // Don't try to wake up if the display is turned off. + if config.DisplayMaxBrightness == 0 { + return + } + err := setDisplayBrightness(config.DisplayMaxBrightness) if err != nil { fmt.Printf("display wake failed, %s\n", err) @@ -204,12 +209,14 @@ 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() { + LoadConfig() // Don't start the tickers if the display is switched off. + // Set the display to off if that's the case. if config.DisplayMaxBrightness == 0 { + setDisplayBrightness(0) return } - LoadConfig() if dimTicker == nil && config.DisplayDimAfterSec != 0 { fmt.Printf("display: dim_ticker has started\n") dimTicker = time.NewTicker(time.Duration(config.DisplayDimAfterSec) * time.Second) @@ -244,12 +251,12 @@ func startBacklightTickers() { func init() { go func() { waitCtrlClientConnected() - startBacklightTickers() fmt.Println("setting initial display contents") time.Sleep(500 * time.Millisecond) updateStaticContents() displayInited = true fmt.Println("display inited") + startBacklightTickers() wakeDisplay(true) requestDisplayUpdate() }()