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

[LoRaWAN] Improve persistence behaviour, add dwell time error, clear up debug output #980

Merged
merged 18 commits into from
Feb 27, 2024
Merged

Conversation

StevenCellist
Copy link
Collaborator

Changelog is pretty much in the commit titles (except that I didn't re-fork so there are two old commits as well).
Fixes #976, now also tested through PIO Remote at @HeadBoffin's setup that is starting to get running. Before this makes it into a new version, we can hopefully give it a good shot through a certain 'test-suite', we're getting there!

Most important change is that join-accept information is now only saved through node.saveSession(); node.beginOTAA() now only saves the Nonces to adhere to LW spec. The resulting behaviour should also be less confusing for new users.
This change is achieved by keeping the keys in EEPROM all zero until saveSession() is called. As soon as beginOTAA() is called, it checks if the keys are all zero (in which case a new join must be issued with the existing, increased Nonces); if the keys are present, saveSession() was apparently called at some point and we can safely assume that restoring is fine.
ABP mode does about the same, except that it can't do a new join, so if its keys are all zeroes it will restart from 0-frame counters.

@StevenCellist
Copy link
Collaborator Author

WIP.
@jgromes maybe an idea to have a label for that? Just a random thought.

@jgromes
Copy link
Owner

jgromes commented Feb 21, 2024

@StevenCellist we can convert a PR back to a draft if you need more time for working on this.

@StevenCellist
Copy link
Collaborator Author

Just more improvements in progress with the help of my friend. Keeping it a PR will maybe help people finding it in case they want to use it. But draft also fine by me.. mostly: don't merge yet :)

@StevenCellist
Copy link
Collaborator Author

Now also fixes #968, expecting more WIP

@StevenCellist StevenCellist linked an issue Feb 22, 2024 that may be closed by this pull request
@StevenCellist StevenCellist changed the title [LoRaWAN] Improve persistence behaviour, add dwell time error up debug output [LoRaWAN] Improve persistence behaviour, add dwell time error, clear up debug output Feb 22, 2024
@StevenCellist
Copy link
Collaborator Author

StevenCellist commented Feb 22, 2024

PR changelog:

Co-Authored-By: HeadBoffin <[email protected]>
Copy link
Owner

@jgromes jgromes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@StevenCellist very good job as always! I left I couple comments/clarifications.

src/protocols/LoRaWAN/LoRaWAN.cpp Outdated Show resolved Hide resolved
src/protocols/LoRaWAN/LoRaWAN.cpp Outdated Show resolved Hide resolved
src/protocols/LoRaWAN/LoRaWAN.cpp Show resolved Hide resolved
src/protocols/LoRaWAN/LoRaWAN.cpp Outdated Show resolved Hide resolved
@jgromes
Copy link
Owner

jgromes commented Feb 25, 2024

@StevenCellist FYI I pushed a minor update to LoRaWAN in 9f0bdff

@StevenCellist
Copy link
Collaborator Author

Thanks for the heads-up. I will fix the mentioned points tomorrow!

@StevenCellist
Copy link
Collaborator Author

In addition to earlier changelog (missed + new item):

  • [LoRaWAN] Improve debug output readability
  • [LoRaWAN] Ignore rejoin when a session is active and join is not forced

PR is tested on the following configurations:

  • US915 OTAA
  • EU868 OTAA
  • EU868 ABP

Actually now also confirmed that forced MAC uplinks (when too large to piggyback) also work as intended!

@HeadBoffin is willing to give it a quick go tomorrow; once he's given his blessing, it's ready for merge!
@jgromes can we maybe do a (small) version bump to get the FCnt bug fix out, as well as all the other QoL changes? Work is underway for the wiki, and having a solid release to work with would help :)

@HeadBoffin
Copy link
Collaborator

Smoke test of non-persistant & persistent looks good to go!

@jgromes jgromes merged commit 5766d38 into jgromes:master Feb 27, 2024
28 of 29 checks passed
@jgromes
Copy link
Owner

jgromes commented Feb 27, 2024

Amazing guys, thanks for this!

@StevenCellist I see no reason to not bump to 6.4.3, I will do that ASAP.

@StevenCellist
Copy link
Collaborator Author

@jgromes I heard that @HeadBoffin is looking to update the examples a bit more - maybe we can wait one or two days to get them into the next release as well? :)

@jgromes
Copy link
Owner

jgromes commented Feb 28, 2024

@StevenCellist sure, we can wait a bit. I also wanted to merge #990 before this next update, which has been done, so update of examples is probably the last thing left.

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.

LoRaWAN OTAA saves join session data in background but not f_cnt Test LoRaWAN LinkCheck & DeviceTime
3 participants