mirror of
https://github.com/smittix/intercept.git
synced 2026-06-16 09:29:45 -07:00
Switch Morse startup to IQ-first and harden timeout handling
This commit is contained in:
+14
-13
@@ -354,8 +354,17 @@ 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:
|
||||
# Keep rtl_fm attempts first (cheap), then switch to IQ capture fallback.
|
||||
# IQ-first strategy: avoid repeated rtl_fm/rtl_sdr handoffs that can
|
||||
# leave the tuner in a bad state on some Linux builds.
|
||||
command_attempts: list[dict[str, Any]] = [
|
||||
{
|
||||
'source': 'iq',
|
||||
'direct_sampling_mode': 2,
|
||||
},
|
||||
{
|
||||
'source': 'iq',
|
||||
'direct_sampling_mode': None,
|
||||
},
|
||||
{
|
||||
'source': 'rtl_fm',
|
||||
'use_direct_sampling': True,
|
||||
@@ -370,17 +379,13 @@ def start_morse() -> Response:
|
||||
'add_resample_rate': True,
|
||||
'add_dc_fast': True,
|
||||
},
|
||||
{
|
||||
'source': 'iq',
|
||||
'direct_sampling_mode': 2,
|
||||
},
|
||||
]
|
||||
else:
|
||||
command_attempts = [
|
||||
{
|
||||
'source': 'iq',
|
||||
'direct_sampling_mode': None,
|
||||
},
|
||||
]
|
||||
else:
|
||||
command_attempts = [
|
||||
{
|
||||
'source': 'rtl_fm',
|
||||
'use_direct_sampling': False,
|
||||
@@ -388,10 +393,6 @@ def start_morse() -> Response:
|
||||
'add_resample_rate': True,
|
||||
'add_dc_fast': True,
|
||||
},
|
||||
{
|
||||
'source': 'iq',
|
||||
'direct_sampling_mode': None,
|
||||
},
|
||||
]
|
||||
|
||||
rtl_process: subprocess.Popen | None = None
|
||||
@@ -571,7 +572,7 @@ def start_morse() -> Response:
|
||||
)
|
||||
decoder_thread.start()
|
||||
|
||||
startup_deadline = time.monotonic() + 1.2
|
||||
startup_deadline = time.monotonic() + (2.5 if source == 'iq' else 1.2)
|
||||
startup_ok = False
|
||||
startup_error = ''
|
||||
|
||||
|
||||
Reference in New Issue
Block a user