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:
@@ -8,6 +8,7 @@
|
||||
#include "power.h"
|
||||
#include "imu.h"
|
||||
#include "splash.h"
|
||||
#include "usage_rate.h"
|
||||
|
||||
// Physical buttons (global, screen-independent):
|
||||
// BTN_BACK (GPIO 0) — left, send Space (Claude Code voice mode push-to-talk)
|
||||
@@ -402,6 +403,14 @@ void loop() {
|
||||
// Process incoming BLE data
|
||||
if (ble_has_data()) {
|
||||
if (parse_json(ble_get_data(), &usage)) {
|
||||
int g_before = usage_rate_group();
|
||||
usage_rate_sample(usage.session_pct);
|
||||
int g_after = usage_rate_group();
|
||||
if (g_after != g_before) {
|
||||
Serial.printf("usage rate: group %d -> %d (s=%.2f%%)\n",
|
||||
g_before, g_after, usage.session_pct);
|
||||
if (splash_is_active()) splash_pick_for_current_rate();
|
||||
}
|
||||
ui_update(&usage);
|
||||
ble_send_ack();
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user