Skip to content

Feature/serial connection - #180

Open
Outrun207 wants to merge 3 commits into
Affirmatech:masterfrom
Outrun207:feature/serial-connection
Open

Feature/serial connection#180
Outrun207 wants to merge 3 commits into
Affirmatech:masterfrom
Outrun207:feature/serial-connection

Conversation

@Outrun207

Copy link
Copy Markdown

Am successfully running this off of my Raspberry Pi. Powering and connecting to the radio via USB.

Summary

Adds the ability to connect to Meshtastic radios via serial/USB, in addition to the existing Bluetooth and WiFi options.
Serial devices appear as clickable buttons in the web UI — no need to type a path manually.

Why

The Raspberry Pi's onboard Bluetooth adapter has known issues with the SimpleBLE library (frequent scan stop failed
crashes). Serial/USB is a more reliable alternative when the radio is physically connected.

Changes

  • api/src/lib/serialConnection.ts — New NodeSerialConnection class that implements the Meshtastic protobuf-over-serial
    protocol (0x94 0xc3 framing) using the serialport npm package
  • api/src/lib/serial.ts — Serial port detection/listing utility
  • api/src/index.ts — Added /serialPorts endpoint and startup port scan
  • api/src/meshtastic.ts — connect() now detects serial paths (e.g. /dev/ttyACM0) and routes to the serial connection
  • ui/src/Serial.svelte — New UI component showing available serial devices as clickable buttons
  • ui/src/App.svelte — Added Serial component to the layout
  • ui/src/Channels.svelte / ui/src/Message.svelte — Show friendly channel names instead of "Channel 0"

Usage

Connect a Meshtastic radio via USB. It will appear in the web UI under "Serial Devices". Click to connect. Or set
ADDRESS=/dev/ttyACM0 as an environment variable for auto-connect on startup.

Add ability to connect to Meshtastic devices via serial/USB in addition
to the existing Bluetooth and WiFi options. This is more reliable than
BLE on devices like Raspberry Pi where SimpleBLE has known issues.

Changes:
- Add NodeSerialConnection class using the serialport npm package
- Add serial port detection and listing API endpoint (/serialPorts)
- Add Serial.svelte UI component showing available serial devices
- Modify connect() to detect serial paths (/dev/ttyACM*, COM*, etc)
- Serial devices appear as clickable buttons in the web UI

The serial connection implements the Meshtastic protobuf-over-serial
protocol (0x94 0xc3 framing) and supports auto-connect via the
ADDRESS environment variable (e.g. ADDRESS=/dev/ttyACM0).
@aaronsilber

Copy link
Copy Markdown

@Outrun207 I am not an official reviewer but in order to expedite merging this change, my suggestion would be to back out the README.md changes here that pertain to the proposed new Docker container, as that feels out of scope for "adding serial support" unless I am missing something. I would encourage creating a separate PR for the Docker container, one that includes the build spec for the container so it can be adopted into the project completely.

@Soltares

Copy link
Copy Markdown
Contributor

Thank you @Outrun207 for the PR submission! I agree with @aaronsilber regarding the Docker container being a separate PR and integrated into the project. I will try to find time to fully review this as it is a big value-add. My concerns are mainly around how well the serialport dependency will package into the distributable for each respective platform.

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.

4 participants