1
0
mirror of https://github.com/KubaPro010/fm-dx-webserver.git synced 2026-02-26 22:13:53 +01:00

Multi TX ID functionality

Return alternative matches from TX search algorithm and show them in frontend panel
This commit is contained in:
Adam Wisher
2025-05-15 09:17:44 +01:00
parent f818262eff
commit 480e362f44
6 changed files with 55 additions and 8 deletions

View File

@@ -149,10 +149,10 @@ function evaluateStation(station) {
return score;
}
// Fetch data from cached database
// Fetch data from maps
async function fetchTx(freq, piCode, rdsPs) {
let match = null;
// let multiMatches = [];
let multiMatches = [];
const now = Date.now();
freq = parseFloat(freq);
@@ -192,7 +192,7 @@ async function fetchTx(freq, piCode, rdsPs) {
loc.score = evaluateStation(loc);
}
match = filteredLocations.reduce((max, obj) => obj.score > max.score ? obj : max, filteredLocations[0]);
// multiMatches = filteredLocations.filter(obj => obj !== match);
multiMatches = filteredLocations.filter(obj => obj !== match);
} else if (filteredLocations.length === 1) {
match = filteredLocations[0];
}
@@ -218,7 +218,7 @@ async function fetchTx(freq, piCode, rdsPs) {
pi: match.pi,
foundStation: true,
reg: match.detectedByPireg,
// others: multiMatches,
others: multiMatches,
};
} else {
return Promise.resolve();