firmware: flip to idle on the daemon's {"ok": false} no-data beat#65
Open
nathanjohnpayne wants to merge 1 commit into
Open
firmware: flip to idle on the daemon's {"ok": false} no-data beat#65nathanjohnpayne wants to merge 1 commit into
nathanjohnpayne wants to merge 1 commit into
Conversation
The idle screen (merged in HermannBjorgvin#64) appears after the data-freshness timer lapses (~90s). This lets it appear *immediately* when the daemon explicitly signals it has no data via an {"ok": false} payload — token expired, refresh failed, no token — instead of waiting out the window holding stale numbers. ui_update treats ok:false as "no fresh data": it keeps the last numbers (so they update cleanly when data resumes) but doesn't refresh the freshness timer, and the view-state gate adds data_ok so it resolves to the idle screen. Pairs with the daemon-side beat in HermannBjorgvin#63. Harmless without it (ok:true is the steady state); useful the moment a daemon that sends the beat is paired. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #64 (idle screen, merged): make the idle screen appear immediately when the daemon explicitly says it has no data, instead of waiting out the ~90s freshness window.
The daemon (see #63) sends
{"ok": false}when it genuinely can't get usage data — token expired, refresh failed, no token. This handles that beat:ui_updatetreatsok:falseas "no fresh data" — it keeps the last numbers (so they update cleanly when data resumes) but doesn't refresh the freshness timer, and the view-state gate addsdata_okso it resolves to the idle screen right away.Harmless on its own —
ok:trueis the steady state and behaves exactly as before; useful the moment a daemon that emits the beat (#63) is paired.Merge order: land this before #63, so deployed firmware understands the beat. (Firmware without this change would treat
{"ok":false}as a usage payload and render 0%.)Verified end-to-end on an AMOLED-2.16: daemon
{"ok":false}→ idle ("No data…") within a second.🤖 Generated with Claude Code