Skip to content

TX backpack: MAVLink over WebSocket for browser GCS (/mavlink-ws) - #253

Open
tecelskyyivan-alt wants to merge 1 commit into
ExpressLRS:masterfrom
tecelskyyivan-alt:fmp-ws-master
Open

tecelskyyivan-alt wants to merge 1 commit into
ExpressLRS:masterfrom
tecelskyyivan-alt:fmp-ws-master

Conversation

@tecelskyyivan-alt

Copy link
Copy Markdown

Implements #252.

Problem. A GCS running in a phone browser can't reach the TX backpack: browsers have no UDP, and iOS also has no Web Serial / Bluetooth / USB. Today that needs a PC relay (UDP 14550 ↔ WebSocket) or a native app.

Change (+126 lines, 3 files):

  • ws://<backpack>/mavlink-ws on the existing async web server — the same MAVLink stream the backpack sends over UDP; uplink frames are buffered and forwarded from loop().
  • Origin check: only the backpack's own origin (IP / *.local) or clients without an Origin header — a page on the internet can't drive the drone through the user's browser (tested against a foreign origin, direct GitHub Pages origin and a DNS-rebinding Host).
  • /fmp-relay.html — a tiny page served by the backpack that bridges postMessage ↔ WebSocket, so an HTTPS web GCS can talk to the backpack on the LAN. Happy to drop or rename it if you prefer to keep only the WebSocket endpoint.

Tested

  • Builds: ESP_TX_Backpack_via_WIFI (RAM 56.9 %, flash 45.0 %) and ESP32C3_TX_Backpack_via_WIFI (flash 49.2 %) from this branch.
  • Same code on 1.5.7 flashed OTA to a RadioMaster Ranger Micro (ESP8285) on Home WiFi, ArduCopter: WebSocket from a Mac ≈144 msgs / 6 s from sys 1, REQUEST_MESSAGE → AUTOPILOT_VERSION + COMMAND_ACK; iPhone browser connected, mode change and telemetry OK.
  • Used in production by Field Mission Planner (open-source spraying GCS): https://github.com/tecelskyyivan-alt/ardu-field-planner

Note: the minifier in build_html.py joins lines, so inline JS in the relay page uses only /* */ comments.

🤖 Generated with Claude Code

https://claude.ai/code/session_01MaS8egFpf1KPbdxjkDQx6D

…or browser GCS

A phone browser can't do UDP; FMP on GitHub Pages opens /fmp-relay.html from the
backpack as a window, which holds the WebSocket and relays bytes via postMessage.
WS accepts only same-origin pages on an IP/.local host (or non-browser clients).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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