mirror of
https://github.com/zjs81/meshcore-open.git
synced 2026-07-19 23:31:03 +10:00
Adjust ranking calculation for direct repeaters by adding offset to SNR for improved accuracy
This commit is contained in:
@@ -59,12 +59,13 @@ class DirectRepeater {
|
|||||||
return -1; // Stale repeaters get lowest rank
|
return -1; // Stale repeaters get lowest rank
|
||||||
}
|
}
|
||||||
// Higher SNR gets higher rank and recency within maxAgeMinutes breaks ties.
|
// Higher SNR gets higher rank and recency within maxAgeMinutes breaks ties.
|
||||||
|
final snrOffset = snr + 31.75;
|
||||||
final ageMs =
|
final ageMs =
|
||||||
DateTime.now().millisecondsSinceEpoch -
|
DateTime.now().millisecondsSinceEpoch -
|
||||||
lastUpdated.millisecondsSinceEpoch;
|
lastUpdated.millisecondsSinceEpoch;
|
||||||
final maxAgeMs = maxAgeMinutes * 60 * 1000;
|
final maxAgeMs = maxAgeMinutes * 60 * 1000;
|
||||||
final recencyScore = (maxAgeMs - ageMs).clamp(0, maxAgeMs);
|
final recencyScore = (maxAgeMs - ageMs).clamp(0, maxAgeMs);
|
||||||
return (snr * 1000).round() + recencyScore;
|
return (snrOffset * 1000).round() + recencyScore;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isStale() {
|
bool isStale() {
|
||||||
|
|||||||
Reference in New Issue
Block a user