Skip to content

feat(app): Phase 2 — network HIL transport + source/demo UI + raw-HIL TX - #29

Merged
knaufinator merged 1 commit into
phoenixfrom
feat/app-phase2-network-transport
Jul 19, 2026
Merged

feat(app): Phase 2 — network HIL transport + source/demo UI + raw-HIL TX#29
knaufinator merged 1 commit into
phoenixfrom
feat/app-phase2-network-transport

Conversation

@knaufinator

Copy link
Copy Markdown
Owner

App-side of the HIL network bridge (HIL_BRIDGE.md Phase 2; DECISIONS rounds 3 + 4). The app can now drive the ESP32 "mini" over the Voron bridge (UDP motion + line-JSON TCP control) alongside direct USB serial, and can stream pre-cueing RAW telemetry so the single on-device cue engine owns the feel for demo and live.

What's in it

Transport abstraction

  • New app/src/transport.h: ITransport — a ~16-method superset interface (the HIL device card reads SerialPort-specific stats), kind() {Serial,Network}, moved ESP32Telemetry, and sendCobsDataRaw().
  • SerialPort : public ITransport (all methods override). The six COBS decode counters move from public atomics → private + cobs*() accessors; the one reader in ui_panels.cpp updated.
  • Entity::serialshared_ptr<ITransport>. test_harness_panel's own dev-serial stays a concrete SerialPort (separate tool — not migrated).

New COBS raw channel

  • cobs.h: COBS_CH_DATA_RAW = 0x07 (6×float32 LE, pre-cueing, app axis order surge=0/sway=1). Baked 0x06 (uint24, with swap) unchanged.

UdpTransport (app/src/udp_transport.{h,cpp})

  • Same COBS frames as serial_port.cpp, emitted via winsock sendto() (one datagram = one frame), baked 0x06 or raw 0x07.
  • Opens the bridge line-JSON TCP control port (default 8789), reusing the control_server.cpp winsock+cJSON pattern (no WebSocket dep). Decodes bridge status/telemetry/resp/log events → getLatestTelemetry()/drainLines(), so the existing app pipeline drives it unchanged.

Raw-HIL, capability-gated

  • FINGERPRINT handler parses caps=raw / rawhil=1Entity::hil_cap_raw. When hil_cap_raw && hil_raw_mode, hilTxLoop TX's input_pct (pre-cueing, app order, no swap) as float32 on 0x07; else baked path unchanged. Old firmware omits the flag → baked. Network connect implies the raw path.

Connection + source/demo UI (ui_panels.cpp)

  • Serial|Network selector + host / UDP / TCP fields; Network Connect builds UdpTransport + TCP control client and bypasses the serial FINGERPRINT handshake (bridge/ESP own identity + cueing). Serial path unchanged.
  • OFF/DEMO/LIVE source selector + play + demo panel (list_files/mem/select_demo/upload_file[Burn]/delete) inside the HIL card, Network-only, driving the bridge TCP-JSON verbs. New fields persisted in settings.

.m6p raw export (change-list a)

  • control_server.cpp export_sequence gains raw=1M6P2 header + 6×float32 LE pre-cueing samples (no swap); baked M6P1 export unchanged.

Build-verify (espressif cmake 3.30.2 / VS2022)

  • Unit tests: 47/47 pass.
  • SIL app (app/): configures, compiles, links clean (FetchContent glfw/imgui/implot/cJSON).
  • No hardware run; not merged.

Open questions

See PR discussion / agent summary — notably network-path handshake semantics, caps=raw firmware token spelling, and Burn/upload being a bridge STUB until Phase-3 firmware.

🤖 Generated with Claude Code

Adds the app-side of the HIL network bridge path (HIL_BRIDGE.md Phase 2,
DECISIONS rounds 3+4). The app can now drive the ESP32 "mini" over the Voron
bridge (UDP motion + line-JSON TCP control) in addition to direct USB serial,
and can stream pre-cueing RAW telemetry so the single on-device cue engine
owns the feel for demo and live alike.

Transport abstraction
- New app/src/transport.h: ITransport — a ~16-method SUPERSET interface (the
  HIL device card reads SerialPort-specific stats), plus a kind() {Serial,
  Network} enum and the moved ESP32Telemetry struct. Adds sendCobsDataRaw().
- SerialPort now implements ITransport (override on all methods). Its six COBS
  decode counters move from public atomics to private + cobs*() accessors; the
  one reader in ui_panels.cpp is updated. Adds sendCobsDataRaw().
- Entity::serial is now shared_ptr<ITransport> (app.h). test_harness_panel's
  own dev-serial stays a concrete SerialPort (separate tool — not migrated).

New COBS raw channel
- cobs.h: COBS_CH_DATA_RAW = 0x07 (6x float32 LE, pre-cueing, app axis order
  surge=0/sway=1 — device cues then swaps). Baked 0x06 (uint24, with swap)
  stays for back-compat.

UdpTransport (app/src/udp_transport.{h,cpp})
- Builds the SAME COBS frames as serial_port.cpp and emits them via winsock
  sendto() (one datagram = one frame), baked 0x06 or raw 0x07.
- Opens the bridge's line-JSON TCP control port (default 8789), reusing the
  control_server.cpp winsock+cJSON pattern (no WebSocket dep). Decodes bridge
  status/telemetry/resp/log events → getLatestTelemetry()/drainLines() so the
  existing app pipeline drives it unchanged. Exposes source/demo control.

Raw-HIL, capability-gated
- FINGERPRINT handler parses caps=raw / rawhil=1 → Entity::hil_cap_raw. When
  hil_cap_raw && hil_raw_mode, hilTxLoop TX's input_pct (pre-cueing, app order,
  no swap) as float32 on 0x07; else the baked path is unchanged. Old firmware
  omits the flag → baked. Network connect implies the raw path (cap+mode on).

Connection + source/demo UI (ui_panels.cpp)
- Serial|Network transport selector + host / UDP / TCP fields; Network Connect
  builds UdpTransport + TCP control client and bypasses the serial FINGERPRINT
  handshake (bridge/ESP own identity + cueing). Serial path unchanged.
- Source selector OFF/DEMO/LIVE + play + demo panel (list_files/mem/
  select_demo/upload_file[Burn]/delete) inside the HIL card, Network-only,
  driving the bridge TCP-JSON verbs. New fields persisted in settings.

.m6p raw export (change-list a)
- control_server.cpp export_sequence gains raw=1 → M6P2 header + 6x float32 LE
  pre-cueing samples (no swap); baked M6P1 export unchanged.

Build-verify: espressif cmake 3.30.2 / VS2022. Unit tests 47/47 pass; SIL app
(app/) configures, compiles and links clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@knaufinator
knaufinator marked this pull request as ready for review July 19, 2026 12:50
@knaufinator
knaufinator merged commit 6dc66f1 into phoenix Jul 19, 2026
4 checks passed
@knaufinator
knaufinator deleted the feat/app-phase2-network-transport branch July 19, 2026 12:50
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