From eb8dbf8fd530c26a20a9cd1c65d927a1a70c77a7 Mon Sep 17 00:00:00 2001 From: Adam Wisher <37659188+mrwish7@users.noreply.github.com> Date: Fri, 27 Jun 2025 14:08:47 +0100 Subject: [PATCH] Adjust spE weighting behaviour Don't weight options for spE if a powerful station is found under the threshold --- server/tx_search.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/server/tx_search.js b/server/tx_search.js index b79c766..cdb029c 100644 --- a/server/tx_search.js +++ b/server/tx_search.js @@ -206,8 +206,7 @@ function validPsCompare(rdsPs, stationPs) { return false; } -function evaluateStation(station) { - let esMode = checkEs(); +function evaluateStation(station, esMode) { let weightDistance = station.distanceKm; if (esMode && station.distanceKm > 700) { weightDistance = Math.abs(station.distanceKm - 1500) + 200; @@ -280,8 +279,16 @@ async function fetchTx(freq, piCode, rdsPs) { } if (filteredLocations.length > 1) { + // Check for any 10kW+ stations within 700km, and don't Es weight if any found. + const tropoPriority = filteredLocations.some( + loc => loc.distanceKm < 700 && loc.erp >= 10 + ); + let esMode = false; + if (!tropoPriority) { + esMode = checkEs(); + } for (let loc of filteredLocations) { - loc.score = evaluateStation(loc); + loc.score = evaluateStation(loc, esMode); } // Sort by score in descending order filteredLocations.sort((a, b) => b.score - a.score);