From 7fdf162f1e30c2880f68490343226b4ce86e15fb Mon Sep 17 00:00:00 2001 From: Smittix Date: Wed, 25 Feb 2026 20:31:30 +0000 Subject: [PATCH] Fix waterfall retaining invalid span after error (#150) When an error occurred with an out-of-range span (e.g. 30 MHz on RTL-SDR), the span input kept the invalid value. Track the last effective span from successful starts and reset the input on error. Co-Authored-By: Claude Opus 4.6 --- static/js/modes/waterfall.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/static/js/modes/waterfall.js b/static/js/modes/waterfall.js index 0f3a05a..df30094 100644 --- a/static/js/modes/waterfall.js +++ b/static/js/modes/waterfall.js @@ -36,6 +36,7 @@ const Waterfall = (function () { let _startMhz = 98.8; let _endMhz = 101.2; + let _lastEffectiveSpan = 2.4; let _monitorFreqMhz = 100.0; let _monitoring = false; @@ -2516,6 +2517,7 @@ const Waterfall = (function () { _drawFreqAxis(); } if (Number.isFinite(msg.effective_span_mhz)) { + _lastEffectiveSpan = msg.effective_span_mhz; const spanEl = document.getElementById('wfSpanMhz'); if (spanEl) spanEl.value = msg.effective_span_mhz; } @@ -2567,6 +2569,10 @@ const Waterfall = (function () { _pendingMonitorTuneMhz = null; _scanStartPending = false; _pendingSharedMonitorRearm = false; + // Reset span input to last known good value so an + // invalid span doesn't persist across restart (#150). + const spanEl = document.getElementById('wfSpanMhz'); + if (spanEl) spanEl.value = _lastEffectiveSpan; // If the monitor was using the shared IQ stream that // just failed, tear down the stale monitor state so // the button becomes clickable again after restart.