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
@@ -16,6 +16,7 @@ log = logging.getLogger(__name__)
|
||||
DEFAULT_TZ = "Europe/Prague"
|
||||
REFRESH_HOUR = 3
|
||||
RETRY = timedelta(minutes=15)
|
||||
NIGHT_END_HOUR = 6 # the screen is dimmed from midnight until this hour
|
||||
|
||||
|
||||
def local_now(tz_name: str = DEFAULT_TZ) -> datetime:
|
||||
@@ -33,6 +34,11 @@ def refresh_due(last_attempt: datetime | None, now: datetime, last_ok: bool) ->
|
||||
return last_attempt < today_refresh <= now
|
||||
|
||||
|
||||
def brightness(now: datetime, base: int) -> int:
|
||||
"""Backlight level for `now`: half of `base` from 00:00 to 06:00, `base` otherwise."""
|
||||
return base // 2 if now.hour < NIGHT_END_HOUR else base
|
||||
|
||||
|
||||
def load_cache(
|
||||
lines, data_dir, now: datetime, previous_timetables: list[Timetable], previous_stale: bool
|
||||
) -> tuple[list[Timetable], bool]:
|
||||
|
||||
Reference in new issue
Block a user