Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

app/dynamic_node_id: avoid spurious reallocation #71

Merged
merged 2 commits into from
Nov 13, 2024

Conversation

tpwrules
Copy link
Collaborator

@tpwrules tpwrules commented Nov 12, 2024

Only set a None unique ID in the DNA database if there's no existing unique ID for the node ID and the node's unique ID is not available. This prevents erasing an existing allocation and causing the node to be allocated another ID, while still allowing the node ID to be reserved if a unique ID never becomes available.

Tested and this seems to fix the issue, though this seems very likely to happen with AM32 and I don't have my AM32 hardware available this exact moment so I'm not 1000% confident yet.

Let SQLite verify that for us instead of silently corrupting itself.
@Huibean
Copy link
Member

Huibean commented Nov 12, 2024

LGTM, test with AM32

Only set a None unique ID in the DNA database if there's no existing
unique ID for the node ID and the node's unique ID is not available.
This prevents erasing an existing allocation and causing the node to be
allocated another ID, while still allowing the node ID to be reserved if
a unique ID never becomes available.
@tpwrules
Copy link
Collaborator Author

Testing with AM32, 10 reboots, ESC panel open so we go to main firmware:

  • before change: 10 different node IDs
  • after change: same node ID each time

Quite confident this is fixed now.

@tridge tridge merged commit 19ac176 into dronecan:master Nov 13, 2024
4 checks passed
@tpwrules tpwrules deleted the pr/dna-realloc-fix branch November 13, 2024 05:27
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.

3 participants