Tighten listening signal detection thresholds

This commit is contained in:
Smittix
2026-02-04 11:41:30 +00:00
parent 812f85b9a9
commit b4edd35f5f

View File

@@ -235,14 +235,17 @@ def scanner_loop():
# Threshold based on squelch setting
# Lower squelch = more sensitive (lower threshold)
# squelch 0 = very sensitive, squelch 100 = only strong signals
if mod == 'wfm':
# WFM: threshold 500-10000 based on squelch
threshold = 500 + (squelch * 95)
else:
# AM/NFM: threshold 300-6500 based on squelch
threshold = 300 + (squelch * 62)
audio_detected = rms > threshold
if mod == 'wfm':
# WFM: threshold 500-10000 based on squelch
threshold = 500 + (squelch * 95)
min_threshold = 1500
else:
# AM/NFM: threshold 300-6500 based on squelch
threshold = 300 + (squelch * 62)
min_threshold = 900
effective_threshold = max(threshold, min_threshold)
audio_detected = rms > effective_threshold
# Send level info to clients
try:
@@ -250,9 +253,9 @@ def scanner_loop():
'type': 'scan_update',
'frequency': current_freq,
'level': int(rms),
'threshold': int(threshold) if 'threshold' in dir() else 0,
'detected': audio_detected
})
'threshold': int(effective_threshold) if 'effective_threshold' in dir() else 0,
'detected': audio_detected
})
except queue.Full:
pass
@@ -269,12 +272,14 @@ def scanner_loop():
_start_audio_stream(current_freq, mod)
try:
scanner_queue.put_nowait({
'type': 'signal_found',
'frequency': current_freq,
'modulation': mod,
'audio_streaming': True
})
scanner_queue.put_nowait({
'type': 'signal_found',
'frequency': current_freq,
'modulation': mod,
'audio_streaming': True,
'level': int(rms),
'threshold': int(effective_threshold)
})
except queue.Full:
pass