@@ -157,6 +157,11 @@ func wakeDisplay(force bool) {
157157 return
158158 }
159159
160+ // Don't try to wake up if the display is turned off.
161+ if config .DisplayMaxBrightness == 0 {
162+ return
163+ }
164+
160165 err := setDisplayBrightness (config .DisplayMaxBrightness )
161166 if err != nil {
162167 fmt .Printf ("display wake failed, %s\n " , err )
@@ -204,12 +209,14 @@ func watchTsEvents() {
204209// if they're not already set. This is done separately to the init routine as the "never dim"
205210// option has the value set to zero, but time.NewTicker only accept positive values.
206211func startBacklightTickers () {
212+ LoadConfig ()
207213 // Don't start the tickers if the display is switched off.
214+ // Set the display to off if that's the case.
208215 if config .DisplayMaxBrightness == 0 {
216+ setDisplayBrightness (0 )
209217 return
210218 }
211219
212- LoadConfig ()
213220 if dimTicker == nil && config .DisplayDimAfterSec != 0 {
214221 fmt .Printf ("display: dim_ticker has started\n " )
215222 dimTicker = time .NewTicker (time .Duration (config .DisplayDimAfterSec ) * time .Second )
@@ -244,12 +251,12 @@ func startBacklightTickers() {
244251func init () {
245252 go func () {
246253 waitCtrlClientConnected ()
247- startBacklightTickers ()
248254 fmt .Println ("setting initial display contents" )
249255 time .Sleep (500 * time .Millisecond )
250256 updateStaticContents ()
251257 displayInited = true
252258 fmt .Println ("display inited" )
259+ startBacklightTickers ()
253260 wakeDisplay (true )
254261 requestDisplayUpdate ()
255262 }()
0 commit comments