meshtastic / Meshtastic-Android

Android application for Meshtastic
https://meshtastic.org
GNU General Public License v3.0
751 stars 217 forks source link

[Bug]: Nearly all nodes show as "hops away: unknown" #1304

Closed noon92 closed 1 month ago

noon92 commented 1 month ago

Contact Details

No response

What happened?

Since most recent update of app, nearly all nodes in the node list show as unknown hops away. In the debug log, the hopstart and hoplimit values show correctly, as shown in the debug log I've attached, but in the node list that same node will show hops away as unknown.

Interestingly, it seems that nodes that are zero hops away are displayed properly. Looks like every other node shows as unknown.

App Version 2.5.1 Firmware: 2.3.13

App Version

2.5.1

Phone

Pixel 8

Device

4631

Firmware

2.3.13

Relevant log output

Example packet from debug log:

from: sendingnode (!nodeid)
to: destnode (!ffffffff)
channel: 2
decoded {
  portnum: TELEMETRY_APP
  payload: "abunchoftelemetry"
}
id: 1655078988
rx_time: 1728667827
rx_snr: 8.0
hop_limit: 2
rx_rssi: -78
hop_start: 7

Code of Conduct

ianmcorvidae commented 1 month ago

I probably didn't catch this in my review, my bad. We've got:

                // Generate our own hopsAway, comparing hopStart to hopLimit.
                it.hopsAway = if (packet.hopStart == 0 || packet.hopLimit < packet.hopStart) {
                    -1
                } else {
                    packet.hopStart - packet.hopLimit
                }

and in the second line there, the inequality should be the opposite direction (it's an invalid hops away if the hop limit (remaining hops) is higher than the hop start, not the other way around (which is normal)

ianmcorvidae commented 1 month ago

@jamesarich sorry to not catch this in #1295 -- missed that the inequality needed flipping since the condition had otherwise been inverted

jamesarich commented 1 month ago

fix coming, good catch.