Case battery: stop showing stale charging; read after the layout

Review fixes for the charging-case battery:

- The case reports whether the glasses are docked. An empty caseInfo
  (the reply out of the case) now parses as "not docked, no level"
  instead of nothing, and undocking is reported even when the level and
  charge state are unchanged. TS keeps the last level but clears
  caseCharging while the glasses are out of the case.
- The phone line shows the charging mark only while it is live: G2 and
  Case only with a link to the glasses (connected or charging), and Case
  only while docked. Levels stay as the last known ones.
- The session-start case read waits until the layout is up, so a
  firmware that ignored it could no longer hold up the first frame. When
  the glasses are already charging at connect, the charging-mode read is
  the only one; the old duplicate read and its "late ACK" log are gone.
- Case dedup state resets on every connect, as wearState does, so each
  session's read reaches TS.
- caseCharging uses > 0 like the headset, and is normalized to 0/1.
- iOS now feeds the reading into the shell battery state, and the
  assistant's describeState includes the case level.
- The batteryLine accessors move above connectionStatusLabel's doc
  comment.
This commit is contained in:
Om Alve committed 2026-11-02 12:01:12 +05:30
1 parent 9c0535014a
commit fa7f33bfe8
15 files changed
+199 -61

No files matched your search

+6
View File
@@ -221,6 +221,12 @@ function describeState(): string {
const charging = battery.headsetCharging ? ", charging" : "";
parts.push(`Headset battery: ${battery.headset}%${charging}.`);
}
if (battery.case !== null) {
// caseCharging is null while the glasses are out of the case: the level is the last one seen.
const detail = battery.caseCharging === null ? " (last reading, glasses not in the case)"
: battery.caseCharging ? ", charging" : "";
parts.push(`Charging case battery: ${battery.case}%${detail}.`);
}
parts.push(`Local time: ${formatDateTime(new Date())}.`);
return parts.join(" ");
}