Skip to content

Persist 24h usage history to flash across reboots - #124

Open
sememtac wants to merge 3 commits into
HermannBjorgvin:mainfrom
sememtac:feature/history-persistence
Open

Persist 24h usage history to flash across reboots#124
sememtac wants to merge 3 commits into
HermannBjorgvin:mainfrom
sememtac:feature/history-persistence

Conversation

@sememtac

Copy link
Copy Markdown

Widens the usage_history ring to 24h (1440 samples) and persists it to NVS (~3KB blob) every ~10 min, restoring it on boot so the Trend/Burn pages show real history across reboots instead of starting empty. Restored data is discarded if the daemon's wall-clock shows the newest sample is stale (>26h). usage_history_add() gains an epoch arg for the staleness check.

Stacked on #122#121 — review the top commit.

sememtac and others added 3 commits July 23, 2026 18:51
Extends the desk dashboard with more pages, touch-swipe navigation, an
animated burn-rate flame in the corner, and a swipe-to-cycle costume system
for the corner mascot. Physical buttons are unchanged — all new navigation
is via touch gestures. New art is original pixel-art; generators in tools/.

- Pages: Trend (session+weekly sparkline), Burn (%/hr + ETA to 100%), and
  Session / Weekly detail. Swipe left/right cycles them (modulo wrap).
  (ui.cpp, ui.h, usage_history.{cpp,h})
- Touch-swipe navigation, rotation-aware: the raw touch delta is rotated by
  the IMU quadrant so gestures track "screen up" in any orientation. Swipe
  left/right = pages, up/down = costumes; a tap still toggles the splash.
- Burn-rate flame: original pixel flame that flickers each frame and smoothly
  tracks the live session burn rate. It sits to the right of the battery, and
  the battery now shows only when a cell is actually attached (power_hal
  reports -1 otherwise) instead of a misleading empty glyph. Battery-less
  boards just show the flame. (flame_icon.h via tools/gen_flame.py)
- Costumes on the corner mascot: shades, cat ears, sombrero, pom-pom,
  lightsaber, santa, double saber, rainbow; choice persisted to NVS. Each
  prop is cropped to its bounding box to keep the data compact.
  (costumes.h via tools/gen_costumes.py)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Reworks tools/gen_costumes.py so adding a costume for the corner mascot is
approachable: a @Costume("name") decorator registers a prop in one place (was a
separate function + a parallel list), named anatomy landmarks (A.EYE_L /
HEAD_TOP / ...) replace guessed pixel coordinates, per-prop docstrings, a "how to
add a costume" guide, and a generated costumes_guide.png (grid + labeled
landmarks) to position new props. Generated costumes.h is byte-identical -- no
art or firmware change, just a friendlier generator.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Widens the usage_history ring to 24h (1440 samples at 60s polling) and saves it
to NVS (a compact ~3KB blob) every ~10 samples, restoring it on boot so the
Trend/Burn pages show real history across reboots instead of starting empty each
time. Restored data is dropped if the daemon's wall-clock shows the newest sample
is stale (>26h), so a long-unplugged device doesn't display ancient data as
current. usage_history_add() gains an epoch argument for that staleness check.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@HermannBjorgvin

Copy link
Copy Markdown
Owner

Weak title and description, temporally linked to your session which I have 0 context of. Unclear what if any human QA was done on this.

Example: Casually mentions trend/burn pages as if they are known existing features.

Commit history mentions mascot costumes, no mention of them in PR title and description.

Very sloppy PR sorry. This I think is a common problem when using agent is they are not aware enough of how to present their work to another person not privy to the current session.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants