mirror of
https://github.com/zjs81/meshcore-open.git
synced 2026-04-20 22:13:48 +00:00
Adjust ranking calculation for direct repeaters by adding offset to SNR for improved accuracy
This commit is contained in:
parent
fdfc1f6d25
commit
14cec533ac
1 changed files with 2 additions and 1 deletions
|
|
@ -59,12 +59,13 @@ class DirectRepeater {
|
|||
return -1; // Stale repeaters get lowest rank
|
||||
}
|
||||
// Higher SNR gets higher rank and recency within maxAgeMinutes breaks ties.
|
||||
final snrOffset = snr + 31.75;
|
||||
final ageMs =
|
||||
DateTime.now().millisecondsSinceEpoch -
|
||||
lastUpdated.millisecondsSinceEpoch;
|
||||
final maxAgeMs = maxAgeMinutes * 60 * 1000;
|
||||
final recencyScore = (maxAgeMs - ageMs).clamp(0, maxAgeMs);
|
||||
return (snr * 1000).round() + recencyScore;
|
||||
return (snrOffset * 1000).round() + recencyScore;
|
||||
}
|
||||
|
||||
bool isStale() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue