feat(app): Phase 2 — network HIL transport + source/demo UI + raw-HIL TX - #29
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
app/src/transport.h:ITransport— a ~16-method superset interface (the HIL device card reads SerialPort-specific stats),kind() {Serial,Network}, movedESP32Telemetry, andsendCobsDataRaw().SerialPort : public ITransport(all methodsoverride). The six COBS decode counters move from public atomics → private +cobs*()accessors; the one reader inui_panels.cppupdated.Entity::serial→shared_ptr<ITransport>.test_harness_panel's own dev-serial stays a concreteSerialPort(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). Baked0x06(uint24, with swap) unchanged.UdpTransport(app/src/udp_transport.{h,cpp})serial_port.cpp, emitted via winsocksendto()(one datagram = one frame), baked0x06or raw0x07.control_server.cppwinsock+cJSON pattern (no WebSocket dep). Decodes bridgestatus/telemetry/resp/logevents →getLatestTelemetry()/drainLines(), so the existing app pipeline drives it unchanged.Raw-HIL, capability-gated
caps=raw/rawhil=1→Entity::hil_cap_raw. Whenhil_cap_raw && hil_raw_mode,hilTxLoopTX'sinput_pct(pre-cueing, app order, no swap) as float32 on0x07; else baked path unchanged. Old firmware omits the flag → baked. Network connect implies the raw path.Connection + source/demo UI (
ui_panels.cpp)UdpTransport+ TCP control client and bypasses the serial FINGERPRINT handshake (bridge/ESP own identity + cueing). Serial path unchanged.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..m6praw export (change-list a)control_server.cppexport_sequencegainsraw=1→ M6P2 header + 6×float32 LE pre-cueing samples (no swap); baked M6P1 export unchanged.Build-verify (espressif cmake 3.30.2 / VS2022)
app/): configures, compiles, links clean (FetchContent glfw/imgui/implot/cJSON).Open questions
See PR discussion / agent summary — notably network-path handshake semantics,
caps=rawfirmware token spelling, and Burn/upload being a bridge STUB until Phase-3 firmware.🤖 Generated with Claude Code