Skip to content

Conversation

@compumike
Copy link

While thinking about #1488 I realized that the logic for updating lastHeard was different from that used in the firmware.

In the firmware, updates to last_heard, rx_snr, rx_time, via_mqtt, hops_away are all set in one small function NodeDB::updateFrom, which receives all packets:

https://github.com/meshtastic/firmware/blob/28f53d132aa0d3903482ea9b475527068389244a/src/mesh/NodeDB.cpp#L1733-L1762

I think it simplifies things to use essentially the same logic in the client, especially since we update lastHeard etc from the radio whenever we connect and re-fetch the node database.

This change:

  • 🐞 fixes a bug that lastHeard was being updated whenever we sent a DM, due to addContactFromURL calling upsertNodeInfoPacket with a synthetic packet
  • deals with the position packets more consistently (only using rxTime to update lastHeard like the firmware does, and never position.timestamp which can be in the future)
  • makes it so messages/ACKs/traceroutes/telemetry (for example) also update lastHeard and rxSnr etc
  • factors out some common code
  • and generally synchronizes this logic with the firmware.

I've tested it on iOS and macOS clients. The result seems to be a more active node list, no nodes with times in the future, and immediate updates to SNR/RSSI when viewing nearby nodes!

Checklist

  • My code adheres to the project's coding and style guidelines.
  • I have conducted a self-review of my code.
  • I have commented my code, particularly in complex areas.
  • I have verified whether these changes require an update to existing documentation or if new documentation is needed, and created an issue in the docs repo if applicable.
  • I have tested the change to ensure that it works as intended.

…ssi/hopsAway update logic from NodeDB::updateFrom
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant