From 01448f5ab1eb9e4e2df7a89a8afee6b94a90907c Mon Sep 17 00:00:00 2001 From: Szymon Porwolik Date: Wed, 5 Nov 2025 21:28:44 +0100 Subject: [PATCH] Fix for https://github.com/wavelog/wavelog/pull/2487 --- assets/js/dxwaterfall.js | 38 ++++---------------------------------- assets/js/sections/qso.js | 17 ++--------------- 2 files changed, 6 insertions(+), 49 deletions(-) diff --git a/assets/js/dxwaterfall.js b/assets/js/dxwaterfall.js index 550a88975..a17c831b2 100644 --- a/assets/js/dxwaterfall.js +++ b/assets/js/dxwaterfall.js @@ -286,38 +286,15 @@ function getCATTimings() { } /** - * Handle CAT frequency update with adaptive debounce - * Uses getCATTimings() to apply appropriate delays for WebSocket (fast) vs Polling (slow) - * Returns true if frequency should be updated, false if blocked by debounce - * Also handles frequency confirmation and cache invalidation + * Handle CAT frequency update + * Handles frequency confirmation and cache invalidation * @param {number} radioFrequency - Frequency from CAT in Hz - * @param {Function} updateCallback - Function to call if update should proceed - * @returns {boolean} - True if update was allowed, false if blocked + * @param {Function} updateCallback - Function to call to update UI + * @returns {boolean} - True if update was processed */ function handleCATFrequencyUpdate(radioFrequency, updateCallback) { - // Get adaptive timing based on connection type (WebSocket vs Polling) - var timings = getCATTimings(); var now = Date.now(); - // Check if we're in a debounce period - if (typeof window.catFrequencyDebounce !== 'undefined' && window.catFrequencyDebounce) { - var timeSinceLastUpdate = now - (window.catFrequencyDebounce.lastUpdate || 0); - - // If we're within the commit delay window, skip this update - if (timeSinceLastUpdate < timings.commitDelay) { - DX_WATERFALL_UTILS.log.debug('[DX Waterfall] CAT DEBOUNCE: Skipping update (within ' + timings.commitDelay + 'ms window, ' + timeSinceLastUpdate + 'ms since last)'); - return false; - } - } - - // Initialize debounce tracking if needed - if (typeof window.catFrequencyDebounce === 'undefined') { - window.catFrequencyDebounce = { lastUpdate: 0 }; - } - - // Update debounce timestamp - window.catFrequencyDebounce.lastUpdate = now; - // Check if frequency actually changed BEFORE updating UI var frequencyChanged = false; var isInitialLoad = false; @@ -414,13 +391,6 @@ function handleCATFrequencyUpdate(radioFrequency, updateCallback) { dxWaterfall.invalidateFrequencyCache(); } } - - // Clear any existing auto-populate timer (not used anymore, but clean up if exists) - if (window.catFrequencyDebounce.autoPopulateTimer) { - clearTimeout(window.catFrequencyDebounce.autoPopulateTimer); - window.catFrequencyDebounce.autoPopulateTimer = null; - } - } return true; diff --git a/assets/js/sections/qso.js b/assets/js/sections/qso.js index 464af28e2..d311c8d8c 100644 --- a/assets/js/sections/qso.js +++ b/assets/js/sections/qso.js @@ -2232,21 +2232,8 @@ $('.mode').on('change', function () { $('#band').on('change', function () { const selectedBand = $(this).val(); - // Skip if this is a programmatic change from CAT/waterfall - if (typeof window.programmaticBandChange !== 'undefined' && window.programmaticBandChange) { - return; - } - - // Skip resetting frequency if CAT is currently updating - if (typeof cat_updating_frequency !== 'undefined' && cat_updating_frequency) { - return; - } - - // Clear the QSO form when band is manually changed - $('#btn_reset').click(); - - // Band selector is now display-only - it follows the radio frequency - // Manual band changes do NOT update the frequency or tune the radio + // Band selector is display-only - it follows the radio frequency + // Band changes do NOT clear the form or update the frequency or tune the radio // The radio controls the form, not the other way around });