Forward rtl_fm stderr to Morse frontend diagnostic log

rtl_fm prints device info, tuning, and errors to stderr but the morse
route only logged these server-side. Now stderr lines are forwarded to
the morse queue as info events, displayed in a compact diagnostic log
below the scope canvas. After 10s with no audio data, the scope text
escalates to prompt the user to check the SDR log.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Smittix
2026-02-26 09:43:28 +00:00
parent c0c066904c
commit bfae73cabf
4 changed files with 70 additions and 4 deletions

View File

@@ -278,6 +278,7 @@ def morse_decoder_thread(
CHUNK = 4096 # bytes per read (2048 samples at 16-bit mono)
SCOPE_INTERVAL = 0.1 # scope updates at ~10 Hz
last_scope = time.monotonic()
waiting_since: float | None = None
decoder = MorseDecoder(
sample_rate=sample_rate,
@@ -293,6 +294,8 @@ def morse_decoder_thread(
if not ready:
# No data from SDR — emit diagnostic heartbeat
now = time.monotonic()
if waiting_since is None:
waiting_since = now
if now - last_scope >= SCOPE_INTERVAL:
last_scope = now
with contextlib.suppress(queue.Full):
@@ -302,12 +305,14 @@ def morse_decoder_thread(
'threshold': 0,
'tone_on': False,
'waiting': True,
'waiting_seconds': round(now - waiting_since, 1),
})
continue
data = os.read(fd, CHUNK)
if not data:
break
waiting_since = None
events = decoder.process_block(data)