Skip to content

Commit 18ae51f

Browse files
committed
feat(display.go): wakeDisplay() force
Adds the force boolean to wakedisplay() which allows skipping the backlightState == 0 check, this means you can force a ticker reset, even if the display is currently in the "full bright" state
1 parent 9fe659b commit 18ae51f

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

display.go

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func requestDisplayUpdate() {
7777
return
7878
}
7979
go func() {
80-
wakeDisplay()
80+
wakeDisplay(false)
8181
fmt.Println("display updating........................")
8282
//TODO: only run once regardless how many pending updates
8383
updateDisplay()
@@ -149,15 +149,12 @@ func tick_displayOff() {
149149

150150
// wakeDisplay sets the display brightness back to config.DisplayMaxBrightness and stores the time the display
151151
// last woke, ready for displayTimeoutTick to put the display back in the dim/off states.
152-
func wakeDisplay() {
153-
if backlightState == 0 {
152+
// Set force to true to skip the backlight state check, this should be done if altering the tickers.
153+
func wakeDisplay(force bool) {
154+
if backlightState == 0 && !force {
154155
return
155156
}
156157

157-
if config.DisplayMaxBrightness == 0 {
158-
config.DisplayMaxBrightness = 100
159-
}
160-
161158
err := setDisplayBrightness(config.DisplayMaxBrightness)
162159
if err != nil {
163160
fmt.Printf("display wake failed, %s\n", err)
@@ -192,7 +189,7 @@ func watchTsEvents() {
192189
return
193190
}
194191

195-
wakeDisplay()
192+
wakeDisplay(false)
196193
}
197194
}
198195

@@ -204,7 +201,7 @@ func init() {
204201
updateStaticContents()
205202
displayInited = true
206203
fmt.Println("display inited")
207-
wakeDisplay()
204+
wakeDisplay(false)
208205
requestDisplayUpdate()
209206
}()
210207

0 commit comments

Comments
 (0)