[SX126x/SX128x] Start reading from Rx buffer offset #1185
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As discussed in #1159 and similar to #1184, this will let SX126x and SX128x radios read the data in its buffer from the offset as returned by GetRxBufferStatus in order to match the data with the returned packet length of the last packet in case you skipped reading a packet. The behaviour is the same for both radios and this is the relevant part of the datasheet:
So we're now changing to the second method, with the downside that there's a higher chance you will overwrite Rx data when transmitting. However, I would argue that it's easier to make sure you don't transmit before reading available data than to make sure you always read the data in time.
For the SX126x, I had to remove the call to
setBufferBaseAddress()
, since it will force the data to start at 0, while the returned pointer is still from the previous packet (if you don't go to standby in between). I tested that this works with and without going to standby in between.For the SX128x, there was no call to
setBufferBaseAddress()
, but it callsstandBy()
inreadData()
and therefore the returned pointer will be correct. I'm not sure if it's really necessary anymore to callstandBy()
here (and thus the interrupt example wouldn't need to callstartReceive()
again), but since I don't have the hardware, I haven't tested this.