You've already forked fm-dx-webserver
mirror of
https://github.com/KubaPro010/fm-dx-webserver.git
synced 2026-02-26 22:13:53 +01:00
Valid PS compare fix for PS under 3 chars
Fix to allow stations with a PS less than 3 characters to be IDed when PS validity checked
This commit is contained in:
@@ -197,6 +197,9 @@ function validPsCompare(rdsPs, stationPs) {
|
||||
|
||||
// Iterate through all tokens and check if any token yields at least three valid (non "_" ) matches.
|
||||
for (let token of psTokens) {
|
||||
// If total non "_" length of token is less than 3, allow match based on that length instead
|
||||
const tokenLength = token.replace(/_/g, "").length;
|
||||
const minMatchLen = tokenLength > 2 ? 3 : tokenLength;
|
||||
// If the token's length does not match the standardized rdsPs length, skip this token.
|
||||
if (token.length !== standardizedRdsPs.length) continue;
|
||||
|
||||
@@ -208,7 +211,7 @@ function validPsCompare(rdsPs, stationPs) {
|
||||
matchCount++;
|
||||
}
|
||||
}
|
||||
if (matchCount >= 3) {
|
||||
if (matchCount >= minMatchLen) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -393,4 +396,4 @@ function deg2rad(deg) {
|
||||
|
||||
module.exports = {
|
||||
fetchTx
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user