From 3d0c505178a9dddfb684252c9e23fb206db2270f Mon Sep 17 00:00:00 2001 From: Smittix Date: Wed, 21 Jan 2026 21:04:16 +0000 Subject: [PATCH] Fix TSCM section: timeline, RF scanning, and UI defaults - Fix Signal Timeline not receiving events by using SignalTimeline.create() for TSCM mode to maintain backward compatibility with addEvent() calls - Lower RF detection thresholds for RTL-SDR compatibility (6dB margin, -90dBm floor instead of 10dB/-70dBm) - Reduce RF scan interval from 60s to 30s for quicker feedback - Enable RF/SDR checkbox by default to match WiFi and Bluetooth - Update status message when no signals detected Co-Authored-By: Claude Opus 4.5 --- routes/tscm.py | 9 +++++---- templates/index.html | 7 ++++++- templates/partials/modes/tscm.html | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/routes/tscm.py b/routes/tscm.py index 7b9f4e3..66870fb 100644 --- a/routes/tscm.py +++ b/routes/tscm.py @@ -1152,11 +1152,12 @@ def _scan_rf_signals(sdr_device: int | None, duration: int = 30) -> list[dict]: db_values = [float(x) for x in parts[6:] if x.strip()] # Find peaks above noise floor + # RTL-SDR dongles have higher noise figures, so use permissive thresholds noise_floor = sum(db_values) / len(db_values) if db_values else -100 - threshold = noise_floor + 10 # Signal must be 10dB above noise + threshold = noise_floor + 6 # Signal must be 6dB above noise for idx, db in enumerate(db_values): - if db > threshold and db > -70: # Detect signals above -70dBm + if db > threshold and db > -90: # Detect signals above -90dBm freq_hz = hz_low + (idx * hz_step) freq_mhz = freq_hz / 1000000 @@ -1262,7 +1263,7 @@ def _run_sweep( last_rf_scan = 0 wifi_scan_interval = 15 # Scan WiFi every 15 seconds bt_scan_interval = 20 # Scan Bluetooth every 20 seconds - rf_scan_interval = 60 # Scan RF every 60 seconds (it's slower) + rf_scan_interval = 30 # Scan RF every 30 seconds while _sweep_running and (time.time() - start_time) < duration: current_time = time.time() @@ -1403,7 +1404,7 @@ def _run_sweep( if not rf_signals and last_rf_scan == 0: _emit_event('rf_status', { 'status': 'no_signals', - 'message': 'RF scan completed but no signals detected. Check RTL-SDR connection.', + 'message': 'RF scan completed - no signals above threshold. This may be normal in a quiet RF environment.', }) for signal in rf_signals: diff --git a/templates/index.html b/templates/index.html index 529eb52..69a834b 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1648,7 +1648,12 @@ if (!container) return; // Create timeline using new ActivityTimeline - if (typeof ActivityTimeline !== 'undefined') { + // For TSCM mode, use SignalTimeline.create() to ensure backward compatibility + // with SignalTimeline.addEvent() calls used in TSCM event handlers + if (mode === 'tscm' && typeof SignalTimeline !== 'undefined') { + SignalTimeline.create(modeConfig.container, modeConfig.config); + modeTimelines[mode] = { addEvent: (e) => SignalTimeline.addEvent(e.id, e.strength, e.duration, e.label) }; + } else if (typeof ActivityTimeline !== 'undefined') { modeTimelines[mode] = ActivityTimeline.create(modeConfig.container, modeConfig.config); } } diff --git a/templates/partials/modes/tscm.html b/templates/partials/modes/tscm.html index d08dfe5..43f77a9 100644 --- a/templates/partials/modes/tscm.html +++ b/templates/partials/modes/tscm.html @@ -52,7 +52,7 @@