8 Commits

Author SHA1 Message Date
c07284a7d6 ESP32 antenna positioner: dual-axis stepper control + automated 3D pattern measurement
PlatformIO firmware for ESP32 + 2x TMC2209 (UART, StallGuard sensorless homing)
driving NEMA 17 steppers. HTTP API with mDNS discovery (positioner.local).

Python side: async httpx client, PositionerMixin with 6 MCP tools including
measure_pattern_3d which orchestrates the full theta/phi sweep — serpentine
scan path, per-point S21 capture, progress reporting, WebSocket broadcast.

Web UI gains positioner REST endpoints (status, move, home).
New measure_antenna_range prompt for guided workflow.
2026-02-01 22:34:10 -07:00
430caf9e62 Measured pattern import: CSV, EMCAR, NEC2, Touchstone S1P parsers + web UI upload
Add 5 MCP tools (PatternImportMixin) and 1 prompt for importing external
antenna pattern data. Pure-Python parsers with IDW interpolation on the
sphere, single-cut-to-3D synthesis for EMCAR/2-col CSV, and Touchstone S1P
bridge to the analytical pattern engine. Web UI gets a "Load File" button
with multipart upload endpoint and WebSocket broadcast. 78 tools, 14 prompts.
2026-01-31 15:58:19 -07:00
646c92324d 3D antenna radiation pattern visualization: analytical models + Three.js web UI
Add analytical radiation pattern models for 5 antenna types (dipole, monopole,
EFHW, loop, patch) driven by S11 impedance measurements. Pure Python math with
closed-form far-field equations — no numpy or simulation dependencies.

New MCP tools:
- radiation_pattern: scan S11 → find resonance → compute 3D pattern
- radiation_pattern_from_data: compute from known impedance (no hardware)
- radiation_pattern_multi: patterns across a frequency band for animation

Web UI (opt-in via MCNANOVNA_WEB_PORT env var):
- Three.js gain-mapped sphere with OrbitControls
- Surface/wireframe/plane cut display modes with teal→amber color ramp
- Smith chart overlay, dBi reference rings, E/H plane cross-sections
- Real-time WebSocket push on new pattern computation
- FastAPI backend shares process with MCP server, zero new core deps

Frontend: Vite + TypeScript + Three.js, built assets committed to webui/static/.
Optional dependencies: fastapi + uvicorn via pip install mcnanovna[webui].
2026-01-31 15:27:19 -07:00
e0fe09f3b8 Mixin refactor: split NanoVNA into 6 tool modules, add LC/component analysis
Break monolithic nanovna.py (~1750 lines) into focused mixin classes
in tools/ subpackage. NanoVNA now composes MeasurementMixin, ConfigMixin,
DisplayMixin, DeviceMixin, DiagnosticsMixin, and AnalysisMixin — server.py
registration via getattr() works unchanged.

New analysis tools: analyze_component, analyze_lc_series, analyze_lc_shunt,
analyze_lc_match, analyze_s11_resonance. Supporting math in calculations.py
(reactance_to_component, LC resonator analysis, impedance matching).

New prompts: measure_component, measure_lc_series, measure_lc_shunt,
impedance_match, measure_tdr, analyze_crystal, analyze_filter_response.

70 tools, 12 prompts registered.
2026-01-30 19:59:23 -07:00
48e91a755c Async progress notifications for long-running tools, connection keepalive
Convert scan, analyze, capture, and cal to async with MCP progress
reporting via FastMCP Context. Blocking serial I/O wrapped with
asyncio.to_thread() so the event loop stays free to deliver progress
notifications during hardware sweeps.

Add connection keepalive: _ensure_connected validates stale connections
with a sync probe after 30s idle, and retries on cold-start failures
(fixes flaky first-connect after MCP server restart).
2026-01-30 15:05:50 -07:00
4569fea9f9 Full protocol coverage: 60 tools, 5 prompts, S-parameter math
Phase 1 — Add 33 new tool methods to nanovna.py wrapping every
remaining firmware shell command (measure, config, saveconfig,
clearconfig, color, freq, tcxo, vbat_offset, touchcal, touchtest,
refresh, touch, release, sd_list, sd_read, sd_delete, time, i2c,
si, lcd, threads, stat, sample, test, gain, dump, port, offset,
dac, usart_cfg, usart, band) plus server-side analyze tool.
All capability-gated for firmware variants.

Phase 2 — New prompts.py with 5 FastMCP guided workflows:
calibrate (SOLT), export_touchstone (S1P/S2P), analyze_antenna,
measure_cable, compare_sweeps. Includes HAM_BANDS presets from
160m through 23cm.

Phase 3 — New calculations.py with pure-Python S-parameter math:
swr, return_loss, impedance, admittance, phase_deg, insertion_loss,
group_delay, q_factor, capacitance, inductance, find_resonance,
find_bandwidth, analyze_scan.
2026-01-30 14:24:22 -07:00
68a8705baf capture tool returns PNG Image by default, raw RGB565 optional
- Add Pillow dependency for server-side RGB565→PNG conversion
- capture() now returns fastmcp Image (PNG) by default
- Pass raw=True to get the original RGB565 base64 dict
- Eliminates 204K token overflow on default capture calls
2026-01-30 13:42:10 -07:00
eaa4f1d977 Initial implementation of mcnanovna FastMCP server
NanoVNA-H MCP server with 27 tools for VNA control via USB serial.
Protocol layer handles text + binary scan data parsing, three-phase
initialization sequence, and automatic device discovery (VID 0x0483).

Tools: info, sweep, scan, data, frequencies, marker, cal, save, recall,
pause, resume, power, bandwidth, edelay, s21offset, vbat, capture, trace,
transform, smooth, threshold, reset, version, detect, disconnect,
raw_command, cw
2026-01-30 12:27:47 -07:00