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

@@ -416,7 +416,8 @@ function handleData(wss, receivedData, rdsWss) {
azi: currentTx.azimuth,
id: currentTx.id,
pi: currentTx.pi,
reg: currentTx.reg
reg: currentTx.reg,
otherMatches: currentTx.others
};
}
})

View File

@@ -416,7 +416,7 @@ router.get('/log_fmlist', (req, res) => {
client: {
request_ip: clientIp
},
type: (req.query.type && dataHandler.dataToSend.txInfo.dist > 700) ? req.query.type : 'tropo',
type: req.query.type ? req.query.type : 'tropo',
log_msg: "Logged PS: " + dataHandler.dataToSend.ps.replace(/\s+/g, '_') + ", PI: " + dataHandler.dataToSend.pi + ", Signal: " + (dataHandler.dataToSend.sig - 11.25).toFixed(0) + " dBµV",
});

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();