From e9f140c735006cf4f05717195bbdcea454919949 Mon Sep 17 00:00:00 2001 From: Cameron Fleming Date: Mon, 27 Jan 2025 20:48:27 +0000 Subject: [PATCH] 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 --- display.go | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/display.go b/display.go index 059b180..4cb619f 100644 --- a/display.go +++ b/display.go @@ -77,7 +77,7 @@ func requestDisplayUpdate() { return } go func() { - wakeDisplay() + wakeDisplay(false) fmt.Println("display updating........................") //TODO: only run once regardless how many pending updates updateDisplay() @@ -149,15 +149,12 @@ func tick_displayOff() { // 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. -func wakeDisplay() { - if backlightState == 0 { +// Set force to true to skip the backlight state check, this should be done if altering the tickers. +func wakeDisplay(force bool) { + if backlightState == 0 && !force { return } - if config.DisplayMaxBrightness == 0 { - config.DisplayMaxBrightness = 100 - } - err := setDisplayBrightness(config.DisplayMaxBrightness) if err != nil { fmt.Printf("display wake failed, %s\n", err) @@ -192,7 +189,7 @@ func watchTsEvents() { return } - wakeDisplay() + wakeDisplay(false) } } @@ -204,7 +201,7 @@ func init() { updateStaticContents() displayInited = true fmt.Println("display inited") - wakeDisplay() + wakeDisplay(false) requestDisplayUpdate() }()