@@ -157,6 +157,11 @@ func wakeDisplay(force bool) {
157
157
return
158
158
}
159
159
160
+ // Don't try to wake up if the display is turned off.
161
+ if config .DisplayMaxBrightness == 0 {
162
+ return
163
+ }
164
+
160
165
err := setDisplayBrightness (config .DisplayMaxBrightness )
161
166
if err != nil {
162
167
fmt .Printf ("display wake failed, %s\n " , err )
@@ -204,12 +209,14 @@ func watchTsEvents() {
204
209
// if they're not already set. This is done separately to the init routine as the "never dim"
205
210
// option has the value set to zero, but time.NewTicker only accept positive values.
206
211
func startBacklightTickers () {
212
+ LoadConfig ()
207
213
// Don't start the tickers if the display is switched off.
214
+ // Set the display to off if that's the case.
208
215
if config .DisplayMaxBrightness == 0 {
216
+ setDisplayBrightness (0 )
209
217
return
210
218
}
211
219
212
- LoadConfig ()
213
220
if dimTicker == nil && config .DisplayDimAfterSec != 0 {
214
221
fmt .Printf ("display: dim_ticker has started\n " )
215
222
dimTicker = time .NewTicker (time .Duration (config .DisplayDimAfterSec ) * time .Second )
@@ -244,12 +251,12 @@ func startBacklightTickers() {
244
251
func init () {
245
252
go func () {
246
253
waitCtrlClientConnected ()
247
- startBacklightTickers ()
248
254
fmt .Println ("setting initial display contents" )
249
255
time .Sleep (500 * time .Millisecond )
250
256
updateStaticContents ()
251
257
displayInited = true
252
258
fmt .Println ("display inited" )
259
+ startBacklightTickers ()
253
260
wakeDisplay (true )
254
261
requestDisplayUpdate ()
255
262
}()
0 commit comments