fix: pass config directory (not file path) to radiosonde_auto_rx -c flag

The -c flag expects a directory containing station.cfg, but we were
passing the full file path, so auto_rx could never find its config.
Also fix sonde_type priority to prefer subtype over type.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Smittix
2026-03-02 15:12:30 +00:00
parent bd67195238
commit f8e5d61fa9

View File

@@ -313,11 +313,11 @@ def _process_telemetry(msg: dict) -> dict | None:
balloon: dict[str, Any] = {'id': str(serial)}
# Sonde type (RS41, RS92, DFM, M10, etc.)
if 'type' in msg:
balloon['sonde_type'] = msg['type']
# Sonde type (RS41, RS92, DFM, M10, etc.) — prefer subtype if available
if 'subtype' in msg:
balloon['sonde_type'] = msg['subtype']
elif 'type' in msg:
balloon['sonde_type'] = msg['type']
# Timestamp
if 'datetime' in msg:
@@ -544,12 +544,12 @@ def start_radiosonde():
gpsd_enabled=gpsd_enabled,
)
# Build command - auto_rx -c expects a file path, not a directory
cfg_abs = os.path.abspath(cfg_path)
# Build command - auto_rx -c expects a config DIRECTORY containing station.cfg
cfg_dir = os.path.dirname(os.path.abspath(cfg_path))
if auto_rx_path.endswith('.py'):
cmd = [sys.executable, auto_rx_path, '-c', cfg_abs]
cmd = [sys.executable, auto_rx_path, '-c', cfg_dir]
else:
cmd = [auto_rx_path, '-c', cfg_abs]
cmd = [auto_rx_path, '-c', cfg_dir]
# Set cwd to the auto_rx directory so 'from autorx.scan import ...' works
auto_rx_dir = os.path.dirname(os.path.abspath(auto_rx_path))