Files
clawdmeter/firmware/src/data.h
T
wenilandClaude Opus 4.8 b8d4daa03f v2 Phase 5: Now Playing — Windows media session on the watch
The daemon reads the Windows "now playing" media session (WinRT SMTC) and
adds np/nt/na to the BLE payload; the watch shows a play/pause glyph, a
scrolling title, artist and status. Best-effort and token-independent, so
it works even when the rate-limit data is unavailable.

Cyrillic titles: Styrene B has no Cyrillic glyphs, so the title/artist use
new composite fonts (font_styrene_cyr_{28,20}) — Latin from Styrene B,
Cyrillic + typographic punctuation from Montserrat, merged by lv_font_conv.
Latin titles stay on-brand; only Cyrillic falls back to Montserrat.

- daemon: read_now_playing() via winrt-Windows.Media.Control (lazy import,
  never raises; PLAYING->1, PAUSED->2, else 0; title/artist truncated,
  empty fields omitted)
- firmware: UsageData np_state/np_title/np_artist + parser; the real Now
  Playing screen replaces the shared stub (SCREEN_NOWPLAYING)
- fonts: assets/Montserrat-Medium.ttf, font_styrene_cyr_{28,20}.c
- tools: patch_lvgl9_font.py (automates the 4 LVGL 9 font patches),
  screenshot_win.py (Windows serial screenshot via pyserial + Pillow)
- README: document Cyrillic composite font generation

Verified on hardware (waveshare_amoled_206): idle state, a live Latin
title (scrolling), and Cyrillic (Prohozhdenie / Dunduk) all render.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 00:41:15 +03:00

25 lines
1.2 KiB
C

#pragma once
#include <Arduino.h>
struct UsageData {
float session_pct; // 5-hour window utilization (0-100)
int session_reset_mins; // minutes until session resets
float weekly_pct; // 7-day window utilization (0-100)
int weekly_reset_mins; // minutes until weekly resets
char status[16]; // "allowed" or "limited"
bool ok; // data parse succeeded
bool valid; // false until first successful parse
// Today's Claude Code usage (Phase 4 — computed by the daemon from local
// transcripts). Tokens can exceed 2^31 on a heavy day, so use 64-bit.
long long tokens_today; // total tokens today (input+output+cache)
long long output_today; // output tokens today (what Claude generated)
int cost_cents_today; // equivalent API cost today, US cents
int messages_today; // assistant requests (API turns) today
// Now Playing (Phase 5 — daemon relays the Windows media session).
int np_state; // 0 = nothing playing, 1 = playing, 2 = paused
char np_title[64]; // current track title (UTF-8, may be empty)
char np_artist[64]; // current track artist (UTF-8, may be empty)
};