diff --git a/pluto_advanced_rx/config.py b/pluto_advanced_rx/config.py index 3959325..94e3b07 100644 --- a/pluto_advanced_rx/config.py +++ b/pluto_advanced_rx/config.py @@ -160,7 +160,7 @@ # RTL-SDR (gr-soapy) USB transfer size: ~14 ms of samples per transfer at 2.4 MS/s instead of # librtlsdr's ~55 ms, so the waterfall gets evenly spaced rows (see devices/rtlsdr.py). RTL_SOAPY_BUFFLEN_BYTES = 65536 -FFT_COMPUTE_RATE_HZ = 30 # fft_probe's own compute throttle, independent of poll rate/sample rate +FFT_COMPUTE_RATE_HZ = 15 # fft_probe's own compute throttle, independent of poll rate/sample rate WATERFALL_WINDOW = window.WIN_BLACKMAN_hARRIS # matches GNU Radio's own qtgui.waterfall_sink_c default window WATERFALL_COLORMAP = "viridis" # Start-up color/Y-axis levels (no per-frame autoscale), replaced ~1 s after every connect by the diff --git a/pluto_advanced_rx/devices/rtlsdr.py b/pluto_advanced_rx/devices/rtlsdr.py index 5b4520c..0e30f19 100644 --- a/pluto_advanced_rx/devices/rtlsdr.py +++ b/pluto_advanced_rx/devices/rtlsdr.py @@ -196,6 +196,20 @@ def probe_with_timeout(connection, timeout_s=5.0): return e if tcp is not None: return rtl_tcp.probe(*tcp, timeout_s=timeout_s) + # Use enumerate (does NOT open the device) instead of soapy.source: librtlsdr holds + # exclusive USB access, so a probe-open blocks the immediately-following build_source. + try: + import SoapySDR + results = SoapySDR.Device.enumerate("driver=rtlsdr") + if not results: + return RuntimeError("No RTL-SDR devices found!") + if connection: + serials = [r.asdict().get("serial", "") for r in results] + if connection not in serials: + return RuntimeError(f"RTL-SDR with serial {connection!r} not found (found: {serials})") + return None + except ImportError: + pass # python3-soapysdr not installed: fall back to the open-and-close probe below try: device_arg = f"driver=rtlsdr,serial={connection}" if connection else "driver=rtlsdr" soapy.source(device_arg, "fc32", 1, "", "", [""], [""]) diff --git a/web-trx/backend/web_trx/radio_backend.py b/web-trx/backend/web_trx/radio_backend.py index ab192e2..9e98e85 100644 --- a/web-trx/backend/web_trx/radio_backend.py +++ b/web-trx/backend/web_trx/radio_backend.py @@ -79,7 +79,7 @@ logger = logging.getLogger("web_trx.radio_backend") -SPECTRUM_POLL_HZ = 25.0 +SPECTRUM_POLL_HZ = 15.0 RIG_FOLLOW_PERIOD_S = 0.5 PROBE_TIMEOUT_S = 5.0 SCAN_TIMEOUT_S = 5.0