From 99db7f1faf081eb5f60b887dcdca09860c41b438 Mon Sep 17 00:00:00 2001 From: Smittix Date: Thu, 26 Feb 2026 12:28:53 +0000 Subject: [PATCH] Prefer no-squelch rtl_fm startup profile for Morse --- routes/morse.py | 9 +++++---- tests/test_morse.py | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/routes/morse.py b/routes/morse.py index 4108944..bfc9761 100644 --- a/routes/morse.py +++ b/routes/morse.py @@ -306,17 +306,18 @@ def start_morse() -> Response: can_try_direct_sampling = bool(sdr_device.sdr_type == SDRType.RTL_SDR and freq < 24.0) if can_try_direct_sampling: - # Prefer direct2 with explicit squelch-off, then retry with safer variants - # if the command starts but never emits PCM. + # Cross-platform note: some rtl_fm builds treat "-l 0" as hard squelch and + # emit no PCM. Try the no-"-l" form first, then legacy variants. command_attempts = [ - {'use_direct_sampling': True, 'force_squelch_off': True}, {'use_direct_sampling': True, 'force_squelch_off': False}, + {'use_direct_sampling': True, 'force_squelch_off': True}, + {'use_direct_sampling': False, 'force_squelch_off': False}, {'use_direct_sampling': False, 'force_squelch_off': True}, ] else: command_attempts = [ - {'use_direct_sampling': False, 'force_squelch_off': True}, {'use_direct_sampling': False, 'force_squelch_off': False}, + {'use_direct_sampling': False, 'force_squelch_off': True}, ] rtl_process: subprocess.Popen | None = None diff --git a/tests/test_morse.py b/tests/test_morse.py index 3a9dac2..f3d4f6a 100644 --- a/tests/test_morse.py +++ b/tests/test_morse.py @@ -379,9 +379,9 @@ class TestMorseLifecycleRoutes: assert start_resp.get_json()['status'] == 'started' assert len(popen_cmds) >= 2 assert '-E' in popen_cmds[0] and 'direct2' in popen_cmds[0] - assert '-l' in popen_cmds[0] + assert '-l' not in popen_cmds[0] assert '-E' in popen_cmds[1] and 'direct2' in popen_cmds[1] - assert '-l' not in popen_cmds[1] + assert '-l' in popen_cmds[1] stop_resp = client.post('/morse/stop') assert stop_resp.status_code == 200