-
Notifications
You must be signed in to change notification settings - Fork 405
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] Change session activation #1093
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again @StevenCellist - looks good from my end! Admittedly I can't really check the complete join/restore logic, but from the POV of code clarity, style, memory handling etc. all seems to be in order :)
The latest commits split the
Additionally, an optional event is added to Checked to run fine on deepsleeping ESP32s for both OTAA and ABP on EU868, but waiting to get verified by an independent tester (@HeadBoffin). |
Additionally, the user now has access to clearing a session, after which calling |
Abbrviating th function nams and th rturn cods dosn't mak things straightforward. Fundamntally works but thr is somthing in th saving of th join on boot == 1 that causs a join on boot == 2. Thraftr it sms to procd normally. |
@HeadBoffin I think your 'e'-key needs replacement ;) |
*/ | ||
void beginOTAA(uint64_t joinEUI, uint64_t devEUI, uint8_t* nwkKey, uint8_t* appKey); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since begin
methods are now void
, and new activate
methods were added, we need to update the examples to reflect that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup.. Nick or I will follow up with that!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A product of the testing!
Examples rework in progress, via separate PR. |
Due to a slight bug introduced in one of my recent patches, I decided after conferring with @HeadBoffin to shift around some of the logic around session restoring / activation.
Restoring the Nonces and Session buffer now immediately restores all the contents of the buffer, instead of waiting for this to happen in begin(). Should make it easier to read and maintain. Now if begin() is called with the
force
argument set to false (default), it will check if a restored session is available for the current activitation information (keys, plan and the like) and returnSESSION_RESTORED
if this is the case - if there was none or not a valid session, it will immediately do a join and return (if succeeded)NEW_SESSION
. Hence there is no need to setforce
to true anymore, simplifying logic and being more intuitive. It is still available for rejoining while a session is active, however.For the examples in this repository there is not much difference (just begin()'s return code and dropping the argument to begin()), but the persistence examples should see nice improvements.
Also, a slight bug has been fixed regarding Nonces not increasing on a failed join (buffer checksum was not recalculated and could result in restoring rejection).
Pending confirmation by @HeadBoffin (already tested to run fine, but slight misuse-testing also welcome), and ready for review.