feat(oled): charge ETA, persistent lightbar, charging-aware idle ladder

Status screen: show an estimated time-to-full ("~43m") while charging,
self-calibrating from each 10% battery notch with Li-ion taper correction
(discard the partial plug-in step; 3-sample moving average; per-step weight
1.0/1.5/2.2 for bulk/80-90/90-100%). Shows "~--m" until the first full step.

Lightbar: the chosen mode + 4 favorites now persist to config flash and
stick across every screen (and through gameplay/audio). A single
lightbar_service() owns the LED via the persistent state[] block (new
state_set_led/state_get_led) with a host-override gate (g_lightbar_override)
so the host's AllowLedColor can't stomp a firmware-chosen mode. New HOST
passthrough mode (default) keeps the game in control of the LED out of the
box. The charging amber pulse (255,100,0) is folded in as top priority.

Idle ladder: keep the panel at the dim/dot tier (never full-off) while
charging so users stop unplugging to wake it (which reset the charge ETA).
Fix idle detection to deadzone stick jitter [120,140] + skip the counter
byte (idata[6]) so the dot tier engages with a controller connected
(mirrors bt.cpp's inactivity heuristic).

New Config_body fields: lightbar_mode + lb_fav_{r,g,b}[4].

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
MarcelineVPQ
2026-05-23 19:38:51 -06:00
co-authored by Claude Opus 4.7
parent 219a9dd58a
commit 4edcd20181
5 changed files with 347 additions and 58 deletions
+10
View File
@@ -23,6 +23,16 @@ struct __attribute__((packed)) Config_body {
uint8_t auto_haptics_enable; // 0=Off, 1=Fallback (default), 2=Mix, 3=Replace
uint8_t auto_haptics_gain; // [0,200] percent, default 100
uint8_t auto_haptics_lowpass; // 0=80Hz, 1=160Hz (default), 2=250Hz, 3=400Hz
// Lightbar (OLED Edition Phase H): persisted so the chosen mode/colors
// survive reboot and stick across all screens. lightbar_mode indexes the
// OLED Lightbar screen's mode list — 0=LIVE, 1..4=FAV0..3, 5=BREATHING,
// 6=RAINBOW, 7=FADE, 8=HOST (passthrough, the safe default that lets the
// host/game own the LED). Keep this numbering in sync with kNumLbModes /
// kLbModeHost in src/oled.cpp. Erased flash (0xFF) → HOST + white favorites.
uint8_t lightbar_mode;
uint8_t lb_fav_r[4];
uint8_t lb_fav_g[4];
uint8_t lb_fav_b[4];
};
struct __attribute__((packed)) Config {