-
Notifications
You must be signed in to change notification settings - Fork 423
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] Revamp internal processing, key checking, new MAC commands, implement DutyCycle & DwellTime #918
Conversation
… implement DutyCycle & DwellTime
BTW, these changes are tested on EU868 only (both OTAA and ABP) - there may be bugs for fixed bands (e.g. US). But hey, there's a Beta label so we'll have to wait for people to try it out to see how it fares. |
And I forgot one earlier:
I think I now got all internal processing converted to MAC commands.. last commit on this PR unless stuff requested by others! |
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.
Thank you for this quite extensive contribution! I reviewed it and left some comments, mostly regarding readability and code clarity.
One thing I would like to stress is please don't use one-line ifs without braces. I've seen those go wrong on multiple occasions. And even if they are accepted in a lot of places (Linux kernel comes to mind), I would stronlgy prefer to avoid them.
examples/LoRaWAN/LoRaWAN_End_Device_ABP/LoRaWAN_End_Device_ABP.ino
Outdated
Show resolved
Hide resolved
examples/LoRaWAN/LoRaWAN_End_Device_Persistent/LoRaWAN_End_Device_Persistent.ino
Outdated
Show resolved
Hide resolved
examples/LoRaWAN/LoRaWAN_End_Device_Persistent/LoRaWAN_End_Device_Persistent.ino
Outdated
Show resolved
Hide resolved
Thanks for working your way completely through the not very small PR.. kudos to you! |
!! Hold on, there's something in the new |
Found a small bug in fixed bands (while testing US915 thanks to my companion). You can keep the PR open so I can fix it somewhere later this week, although the bug is of very low impact because it is almost always fixed after one uplink.
The join-accept's CFList sets a block of eight channels plus one channel from the second span, but that last channel accidentally overwrites one of the first eight channels. As soon as one ADR message comes through (which usually is on the next uplink/downlink), this one channel is removed and the set of eight channels is set again. |
@StevenCellist thank you - I left one more comment, I think this PR can wait until whenever you get around to it. |
Turned out that (as I knew) the channel selection stuff was quite borked. Figured I couldn't even maintain my own logic, so revamped the whole channel setup and mask stuff. Expanding on the earlier mentioned changelog:
HUGE thanks to @HeadBoffin who helped test this all on US915. Tests did not reflect real-life scenarios, just stationary in good reach of gateway, but it appears to be stable and working fine just fine, as well for EU868. |
Thanks so much @StevenCellist (and @HeadBoffin too)! I went through all the changes, and I think everything is good to go - though I won't pretend I completely understand the new channel selection. Let's see how this works in the real world ;) |
@jgromes thank you!! |
BTW - any chance you will do a version bump, e.g. 6.3.1? That'll make it easier for people to try it out. |
I think that would be either the Wiki or the extras directory. Though the wiki is probably better since the README.md already links to it in multiple places.
It's probably about time. There is ongoign work on Si4463 and Si4063, as well as LR11xx, but those are still early in development. |
@StevenCellist I noticed there's a couple more variable arrays, which could be simplified to simple statically allocated arrays. Although there is one which I'm not completely sure about: RadioLib/src/protocols/LoRaWAN/LoRaWAN.cpp Lines 247 to 250 in c1bf281
Is there a maximum size of this array that could be used? |
There could be as many ADR commands as there are values for the chMaskCntl (for fixed bands), which caps out at 8. So 8×5=40 bytes. |
@jgromes bit of an unusual place but also a bit more private: If it's possible, ideally mister HeadBoffin would also get access to that page so we can together build up a useful place :) |
@StevenCellist I think the easiest option is to invite both you and @HeadBoffin as collaborators, that should allow you to edit the wiki. I don't think there's a way to limit the acces to just one page, so you're getting the whole thing - with great power etc. etc. You should get the invite shortly. Though honestly I think it's only right, seeing as you are continuously putting in the effort to support the LoRaWAN stack, which seems to be getting quite a bit of attention. |
WOW... thank you!! It's an honour to be part of RadioLib and an exciting and educational journey. We'll try our best to make it a useful wiki, and you may find that it will probably become a popular place :) |
Four days of intense work, but now in a MUCH better state. Most importantly, any internal processing of settings is now delegated to
execMacCommand()
, which should allow for much better maintainability, because the same setting is not altered at multiple different places. Instead, an internal MAC command is fired in that case and processed like 'normal' MAC commands, except there is no response to the LNS.Changelog as far as I can remember:
I probably have made some platform-dependent mistakes at some places..
Zzzzzzzz 🛌 💤