Stopwatch counts in real time from a start date, kept over a restart

The stopwatch counted with millis(), so it started at 0 after every
restart and would overflow after 49 days. It now keeps the real start
time (UTC ms) and the time counted before a pause, stored in NVS
(system/stopwatch_store) on every change, so it keeps counting while
the display is off or restarting. Stop pauses, Start continues, and the
Stopwatch tab can set the start to a date and time (local, summer time
by mktime) to count from, e.g. days since an event. Start, stop and set
need the synced time.

New page formats: 12d 4:05:09 and 3w 2d.

Version 2.19.0, tested on the display over OTA (set start, future and
invalid dates refused, pause, restart).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mangavalkandClaude Opus 5.5 committed 2026-10-20 22:22:32 +02:00
1 parent f5e77c7eca
commit 0166d0ee46
20 files changed
+278 -67

No files matched your search

+3
View File
@@ -218,6 +218,9 @@ See README.md for the overview.
answers through a queue of plain structs: never share Strings or other state with it,
and never wait for it in `loop()`. The web UI's test button polls (`{"pending":true}`).
The web server stays in `loop()` on purpose (its handlers touch everything).
- The stopwatch (`logic/stopwatch.h`) counts in real time (UTC ms from `epochMs()`, not
`millis()`), stored in NVS on every change (`system/stopwatch_store.cpp`, bump `VERSION`
when `Stopwatch::State` changes). Start, stop and set need the synced time.
- Entity ids may contain `{plex_user}` (`expandEntity()` in `logic/page`), filled in by
`net/ha_api` with `settings.plex_user` in entity id form (`plexUserSlug()`).
- Bitmaps are cached in RAM (`display/bitmap_store`, also missing names): a LittleFS read