config: add pymc_tcp / pymc_usb radio_type branches

Wires the TCPLoRaRadio and USBLoRaRadio drivers that landed in pyMC_core
on 2026-05-13 (PR pyMC-dev/pyMC_core#68) into get_radio_for_board() so
they can be selected from a repeater config file without any code change
in main.py / api_endpoints.

Both branches follow the existing pattern: read host/port (TCP) or
serial port (USB) plus auth/LBT options from their own config section,
share the LoRa parameters from the common `radio` section, fall back to
the firmware-default sync word 0x12, and surface ImportError as a clear
RuntimeError if the installed pymc_core is too old to ship the drivers.

config.yaml.example documents both sections and updates the radio_type
header comment with the full supported list. Five new tests in
tests/test_radio_config.py monkeypatch the radio classes and verify the
section/parameter wiring + missing-required-field errors.

No web UI / endpoint changes — the deployment this targets edits the
config file directly. A GUI wizard for these radio types can land
separately if there's appetite.
This commit is contained in:
itk80 committed 2026-05-13 17:30:09 +02:00
1 parent 0e7bb05208
commit 541b25b47c
3 files changed
+246 -2

No files matched your search

+22
View File
@@ -314,6 +314,9 @@ identities:
# Supported:
# - sx1262 (Linux spidev + system GPIO)
# - sx1262_ch341 (CH341 USB-to-SPI + CH341 GPIO 0-7)
# - kiss (KISS-modem over a serial port; alias: kiss-modem)
# - pymc_tcp (pymc_usb firmware modem over Wi-Fi/TCP)
# - pymc_usb (pymc_usb firmware modem over USB-CDC)
radio_type: sx1262
# CH341 USB-to-SPI adapter settings (only used when radio_type: sx1262_ch341)
@@ -352,6 +355,25 @@ radio:
# port: "/dev/ttyUSB0"
# baud_rate: 9600
# pymc_usb firmware modem over Wi-Fi/TCP (when radio_type: pymc_tcp).
# Requires pyMC_core with the TCPLoRaRadio driver (PR pyMC-dev/pyMC_core#68,
# merged into dev on 2026-05-13).
# pymc_tcp:
# host: "pymc-3e2834.local" # modem hostname / mDNS name / LAN IP
# port: 5055 # firmware default
# token: "" # empty = no auth; set to match firmware NVS token
# connect_timeout: 5.0 # seconds; deferred-connect retries with backoff on failure
# lbt_enabled: true # Listen-Before-Talk via firmware CAD
# lbt_max_attempts: 5
# pymc_usb firmware modem over USB-CDC (when radio_type: pymc_usb).
# Requires pyMC_core with the USBLoRaRadio driver (PR pyMC-dev/pyMC_core#68).
# pymc_usb:
# port: "/dev/ttyACM0" # USB-CDC device; udev rule may symlink to /dev/lora-modem
# baudrate: 921600 # must match firmware monitor_speed
# lbt_enabled: true
# lbt_max_attempts: 5
# SX1262 Hardware Configuration
# NOTE:
# - When radio_type: sx1262, these pins are BCM GPIO numbers.