mirror of
https://github.com/smittix/intercept.git
synced 2026-07-03 07:14:00 -07:00
Fix Morse decoder scope events not reaching frontend
Replace blocking rtl_stdout.read() with select()+os.read() so the decoder thread emits diagnostic heartbeat scope events when rtl_fm produces no PCM data (common in direct sampling mode). Add waiting-state rendering in the scope canvas and hide the generic placeholder/status bar for morse mode. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+21
-1
@@ -7,7 +7,9 @@ from __future__ import annotations
|
||||
|
||||
import contextlib
|
||||
import math
|
||||
import os
|
||||
import queue
|
||||
import select
|
||||
import struct
|
||||
import threading
|
||||
import time
|
||||
@@ -284,8 +286,26 @@ def morse_decoder_thread(
|
||||
)
|
||||
|
||||
try:
|
||||
fd = rtl_stdout.fileno()
|
||||
|
||||
while not stop_event.is_set():
|
||||
data = rtl_stdout.read(CHUNK)
|
||||
ready, _, _ = select.select([fd], [], [], 2.0)
|
||||
if not ready:
|
||||
# No data from SDR — emit diagnostic heartbeat
|
||||
now = time.monotonic()
|
||||
if now - last_scope >= SCOPE_INTERVAL:
|
||||
last_scope = now
|
||||
with contextlib.suppress(queue.Full):
|
||||
output_queue.put_nowait({
|
||||
'type': 'scope',
|
||||
'amplitudes': [],
|
||||
'threshold': 0,
|
||||
'tone_on': False,
|
||||
'waiting': True,
|
||||
})
|
||||
continue
|
||||
|
||||
data = os.read(fd, CHUNK)
|
||||
if not data:
|
||||
break
|
||||
|
||||
|
||||
Reference in New Issue
Block a user