Drive splash animations by session usage rate
Group splash animations into four moods (idle/normal/active/heavy) and pick which group plays based on a 5-min sliding rate of session_pct. Thresholds sit at 0.10/0.20/0.33 %/min so Heavy fires when usage matches or beats the 5-hour session reset pace. Splash auto-rotates within the current group every 20s; group recomputes on every BLE poll and the splash re-picks immediately if it changes mid-display. 4-min minimum window prevents single-sample bumps after boot from falsely landing in Heavy.
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
// Tracks short-term rate of change in session_pct (%/min) so the UI can react
|
||||
// to *how heavily* Claude is being used right now, not just the current bucket
|
||||
// level. Returns one of 4 group indices for the splash to pick animations from.
|
||||
|
||||
// Feed in the latest session percentage every time fresh BLE data arrives.
|
||||
void usage_rate_sample(float session_pct);
|
||||
|
||||
// 0 = idle, 1 = normal, 2 = active, 3 = heavy.
|
||||
// Defaults to 0 when the buffer doesn't have enough samples yet.
|
||||
int usage_rate_group(void);
|
||||
|
||||
// Clear the buffer (e.g. when the 5-hour session window resets).
|
||||
void usage_rate_reset(void);
|
||||
Reference in New Issue
Block a user