-
Notifications
You must be signed in to change notification settings - Fork 1k
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
great library - but when opening for reading on pipe0 #496
Comments
Had the same problem, spent a couple hours investigating the issue and came to the same conclusion. |
this doesn't check the whole address, but it checks one more byte. you can add more bytes if you need to. |
Thank you! |
I've given this some thought, and my feeling is that the code should remain the same, but the documentation and probably examples should more clearly specify this behavior. I'll look at that soon. Please see http://maniacalbits.blogspot.com/2013/04/rf24-addressing-nrf24l01-radios-require.html for the general reasoning. A bit of an old post, but many addresses including ones using 0xFF or 0x00 should be avoided and why carefully selected addressing can make an actual difference in outcomes. (again examples should be updated) As my example of "good addressing", RF24Network uses It is possible to add a #define in the config file to enable/disable full address space checking, but there should be plenty of address space while avoiding the bad ones. ??? |
from the link specified for @TMRh20 general reasoning to not fix this:
Although, I am all for detailed documentation and examples. The way it is written, |
Thanks for the reply, @TMRh20 A note in the documentation about the PER issue would certainly be of help to users of the library, that may not be aware of it. However, the original problem remains: That check may coincidentally or intentionally exclude "bad addresses" concerning the PER issue. In conclusion, my opinion is that: This library should not concern with actively avoiding the PER issue with address checks, but may inform the users about it in the documentation and examples. About the original issue: Of course none of this is of utmost importance, and as you say there are plenty of addresses available avoiding the ones causing problems. |
@hexwell Sorry if my post seemed off topic.
That is what I was trying to suggest, rather than adding another byte (or 2) of code to implement your idea of a separate boolean flag. I do appreciate the distinction you made about 2 separate issues. I'm just trying to help. After more thought, I can foresee a problem using the register's reset value as |
@2bndy5 your comments are spot on, no worries. |
I'm wondering why this library forces the RX pipe 0 closed if the first byte of |
Hey @2bndy5 , thanks for your hard work on this library - much appreciated. If this should be in a new issue, please split it out. Just wanted to point out that there's a really important use case for setting the first address byte to
Right now, to get around the limitations of this library, something like this is required: radio.setAutoAck(false);
writeRegister(RF_SETUP, 0x21); // Disable PA, 250kbps, LNA enabled in a single op - no ctor to do this in one go?
radio.setPayloadSize(sz);
radio.setChannel(ch);
writeRegister(EN_RXADDR, 0x00); // this is critical - seems no way to do this with RF24?
writeRegister(SETUP_AW, 0x00); // though perhaps passing in a_width of 2 would work? https://github.com/nRF24/RF24/blob/2819745c727cccc2cf2308595a77c637cc84cd95/RF24.cpp#L1417
radio.openReadingPipe(0, 0xAALL);
radio.openReadingPipe(1, 0x55LL);
radio.disableCRC();
radio.startListening();
// ... where I see 70786aa which looks encouraging to help with some of this - can you clarify how the use case I've outlined might be supported by this commit? I expect other language bindings (like the Python one) will need to have this variable exposed as well...) Thanks! |
I guess I’ve had enough time to think about it. :p
I think it’s probably a good idea to implement it rather than leaving it as an open issue.
… On Oct 6, 2021, at 10:48 PM, Brendan ***@***.***> wrote:
@TMRh20 what would you say to implementing @hexwell's bool idea (to resolve this) as a MSBit in the private member addr_width? I know I'll need to compare the code-size differences because there would be a slight computational hit in setAddressWidth(), open/closeReadingPipe(), and stopListening().
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
|
I'll also compare code-sizes for using a private bool vs repeatedly doing bitwise ops on addr_width (not sure how compiler optimizations will affect this). I'll be adding this into rp2xxx branch when I'm ready to commit. There aren't any changes on that branch that increase the code-size (compared to master). |
Results (using rp2xxx branch)code-size (in bytes) on ATSAMD21 (compiling GettingStarted.ino)
code size (in bytes) on ATMega328P (compiling GettingStarted.ino)
code size (in bytes) on ATTiny85 (compiling the specially designed rf24ping85.ino)
ConclusionAs you can see, using a new dedicated bool is the way to go. While using a dedicated bool flag does allocate 1 more byte of memory, it seems that replacing the comparison @TMRh20 I'm going ahead with a new private bool called |
Hey, great library,
I ran into a bit of a bug when trying to open pipe 0 for reading. The problem is in the startListening() function. You have written
which is supposed to re-load the reading address if one has been stored in the pipe0_reading_address buffer. However, you do not check the whole address, you just check the first byte.
This will obviously cause problems if the first byte in the address to be opened starts with 0x00 as mine did. You should check the whole address.
I fixed it in my copy, so I need nothing from you. just letting you know.
The text was updated successfully, but these errors were encountered: