mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-02-15 18:23:18 -05:00
fix: Correctly compare hopStart and hopLimit for received packets
fixes: #1304 The calculation of `hopsAway` was using an incorrect comparison between `hopStart` and `hopLimit`. This commit fixes the logic to correctly determine the number of hops a packet has traveled.
This commit is contained in:
@@ -1101,7 +1101,7 @@ class MeshService : Service(), Logging {
|
||||
it.rssi = packet.rxRssi
|
||||
|
||||
// Generate our own hopsAway, comparing hopStart to hopLimit.
|
||||
it.hopsAway = if (packet.hopStart == 0 || packet.hopLimit < packet.hopStart) {
|
||||
it.hopsAway = if (packet.hopStart == 0 || packet.hopLimit > packet.hopStart) {
|
||||
-1
|
||||
} else {
|
||||
packet.hopStart - packet.hopLimit
|
||||
|
||||
Reference in New Issue
Block a user