mirror of https://github.com/jetkvm/kvm.git
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
This commit is contained in:
parent
34e42fd37c
commit
e9f140c735
15
display.go
15
display.go
|
@ -77,7 +77,7 @@ func requestDisplayUpdate() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
go func() {
|
go func() {
|
||||||
wakeDisplay()
|
wakeDisplay(false)
|
||||||
fmt.Println("display updating........................")
|
fmt.Println("display updating........................")
|
||||||
//TODO: only run once regardless how many pending updates
|
//TODO: only run once regardless how many pending updates
|
||||||
updateDisplay()
|
updateDisplay()
|
||||||
|
@ -149,15 +149,12 @@ func tick_displayOff() {
|
||||||
|
|
||||||
// wakeDisplay sets the display brightness back to config.DisplayMaxBrightness and stores the time the display
|
// wakeDisplay sets the display brightness back to config.DisplayMaxBrightness and stores the time the display
|
||||||
// last woke, ready for displayTimeoutTick to put the display back in the dim/off states.
|
// last woke, ready for displayTimeoutTick to put the display back in the dim/off states.
|
||||||
func wakeDisplay() {
|
// Set force to true to skip the backlight state check, this should be done if altering the tickers.
|
||||||
if backlightState == 0 {
|
func wakeDisplay(force bool) {
|
||||||
|
if backlightState == 0 && !force {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if config.DisplayMaxBrightness == 0 {
|
|
||||||
config.DisplayMaxBrightness = 100
|
|
||||||
}
|
|
||||||
|
|
||||||
err := setDisplayBrightness(config.DisplayMaxBrightness)
|
err := setDisplayBrightness(config.DisplayMaxBrightness)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("display wake failed, %s\n", err)
|
fmt.Printf("display wake failed, %s\n", err)
|
||||||
|
@ -192,7 +189,7 @@ func watchTsEvents() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
wakeDisplay()
|
wakeDisplay(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,7 +201,7 @@ func init() {
|
||||||
updateStaticContents()
|
updateStaticContents()
|
||||||
displayInited = true
|
displayInited = true
|
||||||
fmt.Println("display inited")
|
fmt.Println("display inited")
|
||||||
wakeDisplay()
|
wakeDisplay(false)
|
||||||
requestDisplayUpdate()
|
requestDisplayUpdate()
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue