Halve the screen brightness from midnight to 6 am
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
3ad6dc6963
commit
33d14bd1ab
4 files changed
+20
-2
No files matched your search
@@ -48,7 +48,6 @@ def main() -> None:
|
||||
lcd = LcdCommRevA(com_port=DEVICE) if DEVICE != "AUTO" else LcdCommRevA()
|
||||
lcd.InitializeComm()
|
||||
lcd.SetOrientation(ORIENTATION)
|
||||
lcd.SetBrightness(BRIGHTNESS)
|
||||
|
||||
running = True
|
||||
|
||||
@@ -63,6 +62,7 @@ def main() -> None:
|
||||
last_ok = True
|
||||
mode = None # "board" or "clock"
|
||||
last_minute = last_second = None
|
||||
level = None # backlight level last sent to the screen
|
||||
draw_failures = 0
|
||||
|
||||
# Draw from the existing cache straight away; only refresh at startup if it is old.
|
||||
@@ -100,6 +100,11 @@ def main() -> None:
|
||||
try:
|
||||
if now.minute != last_minute:
|
||||
last_minute = now.minute
|
||||
new_level = app.brightness(now, BRIGHTNESS)
|
||||
if new_level != level:
|
||||
log.info("brightness %d", new_level)
|
||||
lcd.SetBrightness(new_level)
|
||||
level = new_level # only recorded once the screen accepted it
|
||||
image = app.board_image(timetables, now, board_fonts, stale, state_holidays)
|
||||
new_mode = "board" if image is not None else "clock"
|
||||
if new_mode != mode:
|
||||
|
||||
Reference in new issue
Block a user