Skip to content

Merge varia-radar-overlay-widget into next-version#8

Closed
eried wants to merge 7 commits into
next-versionfrom
merge/varia-radar-into-next-version
Closed

Merge varia-radar-overlay-widget into next-version#8
eried wants to merge 7 commits into
next-versionfrom
merge/varia-radar-into-next-version

Conversation

@eried

@eried eried commented Jun 19, 2026

Copy link
Copy Markdown
Owner

Integrates the Varia radar overlay widget + HUD reconnect/resilience + an Overlay Studio save fix into next-version.

next-version already carries hud-auto-discovery + the Varia dashboard support (shared merge base), so this merge was conflict-free and builds green (:app, :hud, :hud-protocol tests).

What this adds on top of next-version

  • Varia radar overlay-studio widget (OverlayElementType.RADAR) — Lane / Mirror / Minimal modes, rendered in the phone Overlay Studio and mirrored to the HUD's Custom screen via customOverlayJson. New compact RadarTargetWire on the wire (PROTOCOL_MINOR 7→8); HudDemoSource synthesizes cars for emulator testing.
  • Snappy HUD reconnect + resilience — phone ping 15s→5s, HUD Ktor 15s/30s→5s/12s, watchdog 30s→10s + mDNS revive, a partial CPU wake lock (+WAKE_LOCK perm), a connection-token guard so a stale handler can't clobber a fresh reconnect, and disconnect diagnostics. The visual disconnect splash stays on the existing 10s grace (relaxed) — decoupled from the faster internal detection. Targets a tester whose HUD link died after ~2 min and needed a reboot.
  • Overlay Studio save fix — "Overwrite" now overwrites in place (was saving name (1) due to SAF delete()+createFile() racing the provider), plus a Cancel / Keep both / Overwrite dialog.

Testing

  • Unit: :hud-protocol wire round-trip + additive back-compat (radar fields, MINOR bump).
  • Emulator: radar widget rendered in all 3 modes on the phone studio and HUD; HUD reconnect logging verified. The Motoeye freeze root cause still wants a device logcat (diagnostics added for that).
  • SAF overwrite best confirmed on-device.

🤖 Generated with Claude Code

eried and others added 7 commits June 19, 2026 11:24
New OverlayElementType.RADAR Overlay Studio control with three view modes
(Lane / Mirror / Minimal), rendered both in the phone Overlay Studio and,
via the existing customOverlayJson pipe, on the HUD's Custom screen. The
radar data already exists on the phone (RadarRepository); this surfaces it
for video overlays and the helmet HUD.

hud-protocol:
- HudState gains radarConnected / radarBatteryPercent / radarTargets
  (List<RadarTargetWire>); PROTOCOL_MINOR 7 -> 8 (additive, old HUDs ignore).
- OverlayElementType.RADAR + radarMode / radarRangeM /
  radarShowDistanceLabels on OverlayElement.

app:
- HudServer.snapshot() maps the live RadarRepository frame to the wire.
- HudDemoSource synthesises closing cars so the widget is testable on an
  emulator without a Varia.
- RadarElement renderer (3 modes; threat colours from theme status tokens)
  + Studio editor wiring (picker entry, icon, config sheet, defaults) +
  OverlayPresetJson radar fields (save/load + wire payload).

hud:
- RadarElement renderer twin; StudioElementData carries the radar frame;
  CustomOverlayScreen's hand-rolled parser reads the radar fields.

tests:
- Wire round-trip + additive-compat (frozen v1.0 still decodes, MINOR bump).

The Varia is rear-facing with no bearing, so Mirror lights both sides by
the worst threat level (spelled out in the config hint).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A "12 m" string centred as a whole left the digits sitting left of centre
(the unit's width pushed them over). Put the distance number on its own
centred line with the unit + closing speed on a smaller line below, so the
number reads dead-centre between the chevrons in both the phone Studio and
the HUD.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Addresses a tester whose HUD link died after ~2 min and only a Motoeye
reboot recovered it, plus the goal that reconnect be snappy internally
without flashing the disconnect alert on a brief blip.

Detection / reconnect (internal, fast):
- Phone OkHttp pingInterval 15s -> 5s: a frozen/half-open HUD (frame sends
  still succeed into the TCP buffer) is now caught by a missed pong in ~5s,
  not 15s, so the dial loop rediscovers + reconnects promptly.
- HUD Ktor pingPeriod 15s -> 5s, timeout 30s -> 12s: frees the connection
  (peer/status) and unblocks the incoming loop within ~12s of the phone
  vanishing instead of 30s.
- connSeq guard: a stale, slowly-timing-out handler can no longer clobber
  the status/peer of a newer connection from a fast reconnect.

Resilience (self-recover without a reboot):
- Partial CPU wake lock while the link is up (+ WAKE_LOCK permission) so the
  Ktor server, UDP beacon and watchdog can't be frozen by a suspend window.
- Watchdog interval 30s -> 10s so a wedged listener restarts in ~20-30s; it
  now also revives the mDNS advertise if it was down, without a full restart.

Visual alert stays relaxed: the disconnect splash remains gated by HudApp's
existing 10s reconnect grace, decoupled from the now-faster internal
detection so a quick reconnect never flashes it.

Diagnostics: HudServer records watchdogRestarts / lastEndReason /
lastDisconnectMs and logs the end reason + a per-connection token so the
next "link died" report carries the cause.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Tapping Overwrite on a same-named preset actually saved "name (1)" instead
of replacing it. Cause: savePreset did delete()+createFile() over the
Storage Access Framework, which races the provider and dedupes the new
file's display name to "name (1).json". Now it writes IN PLACE to the
existing document (createFile only when the name is new), with "wt" so a
shorter preset can't leave stale trailing bytes.

The overwrite confirmation is now a three-way choice -- Cancel / Keep both /
Overwrite. "Keep both" saves under the next free "name (n)" (the old
accidental behaviour, now intentional); Overwrite replaces in place.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Lands the work that's on top of the shared hud-auto-discovery base:
- Varia radar overlay-studio widget (Lane / Mirror / Minimal), rendered in
  the phone studio and on the HUD Custom screen.
- Snappy HUD reconnect + resilience (5s/12s heartbeats, 10s watchdog, CPU
  wake lock, mDNS revive, connection-token guard, diagnostics).
- Overlay Studio "Overwrite" now overwrites in place (no "name (1)"
  duplicate) + a Keep both / Overwrite / Cancel choice.

next-version already carries hud-auto-discovery + Varia dashboard support;
those are the shared base, so the merge was conflict-free. Build green
(app + hud + hud-protocol tests).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@eried eried closed this Jun 19, 2026
@eried eried deleted the merge/varia-radar-into-next-version branch June 19, 2026 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant