From ed9556a479fa54a40221918acba642a9bbb1a901 Mon Sep 17 00:00:00 2001 From: Claudio Ortolina Date: Thu, 7 May 2026 08:24:58 +0100 Subject: [PATCH] [presto] update clock on wake up --- presto/AGENTS.md | 2 +- presto/records_on_the_day.py | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/presto/AGENTS.md b/presto/AGENTS.md index ec7e157a..01e9f3aa 100644 --- a/presto/AGENTS.md +++ b/presto/AGENTS.md @@ -74,7 +74,7 @@ _These rules apply to any scrollable view (day list, detail page, or future addi - Sleep by setting backlight to `0.0`. WiFi stays enabled. - The first touch after sleep must wake the backlight and be consumed — it must not also activate a button or trigger a scroll. -- On wake, only reconnect WiFi if the connection dropped. +- On wake, `set_today()` refreshes the global date from the system clock, WiFi is reconnected if it dropped, and the current view is always redrawn so the today-highlight stays current across midnight. ## API Contract diff --git a/presto/records_on_the_day.py b/presto/records_on_the_day.py index 2f3ecc44..fe0c87e2 100644 --- a/presto/records_on_the_day.py +++ b/presto/records_on_the_day.py @@ -469,7 +469,8 @@ def sleep_display(): def wake_display(): - """Restore the display backlight and reconnect WiFi if needed.""" + """Restore the display backlight, refresh the clock, reconnect WiFi if + needed, and redraw so the today-highlight stays current.""" global _display_awake try: @@ -478,9 +479,14 @@ def wake_display(): pass _display_awake = True + + # Refresh today's date from the system clock (may have crossed midnight). + set_today() + if not wifi_connected(): - if ensure_wifi_connected(): - redraw_current_view() + ensure_wifi_connected() + + redraw_current_view() def wifi_connected():