From 5f4d1b05a86a9cb8496fd16ec6a377a30fa51dd4 Mon Sep 17 00:00:00 2001 From: Smittix Date: Thu, 8 Jan 2026 14:37:33 +0000 Subject: [PATCH] Add debug logging for channel recommendation Temporary console.log statements to diagnose why channel recommendation always shows 1 and 36. Co-Authored-By: Claude Opus 4.5 --- templates/index.html | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/templates/index.html b/templates/index.html index c987640..fea5064 100644 --- a/templates/index.html +++ b/templates/index.html @@ -4252,8 +4252,12 @@ channels5g.forEach(ch => channelCounts5[ch] = 0); // Count networks per channel + console.log('Channel recommendation - networks:', Object.keys(wifiNetworks).length); Object.values(wifiNetworks).forEach(net => { const ch = parseInt(net.channel); + if (isNaN(ch)) { + console.warn('Invalid channel for network:', net.essid, 'channel value:', net.channel); + } if (ch >= 1 && ch <= 13) { // 2.4 GHz channels overlap, so count neighbors too for (let i = Math.max(1, ch - 2); i <= Math.min(13, ch + 2); i++) { @@ -4293,6 +4297,12 @@ } }); + // Debug: show final counts + console.log('Channel counts 2.4GHz:', channelCounts24); + console.log('Channel counts 5GHz:', channelCounts5); + console.log('Best 2.4GHz:', best24, 'count:', minCount24); + console.log('Best 5GHz:', best5, 'count:', minCount5); + // Update UI with more context document.getElementById('rec24Channel').textContent = best24; if (totalNetworks === 0) {