adafruit / Adafruit_CircuitPython_RFM9x

CircuitPython module for the RFM95/6/7/8 LoRa wireless 433/915mhz packet radios.
MIT License
67 stars 44 forks source link

Clarify the 4 bytes added to the beginning of each buffer #38

Open mcsarge opened 4 years ago

mcsarge commented 4 years ago

In working with the library and using it to send to an ESP based LoRa device that does not use this library, I found that this library adds 4 bytes to the start of every buffer for compatibility with RadioHead. I found this extra 4 bytes were being added by examining the code. Solutions:

  1. Add a setting that turns this compatibility off and on (preferred)
  2. Clarify in the examples (and in the header of the adafruit_rfm9x.py) that when sending to or receiving from devices that are not RadioHead compatible, they will need to account for it.
jerryneedell commented 4 years ago

@mcsarge Good suggestions -- This library was intended to be Radiohead compliant, but clarification is always a good idea. There is a parameter that allows the user to select if the header is removed from the packet before it is passed back to the user code on receive but that won't help with the transmitted packet. Adding an option to remove the header will require a few other changes so the receiver will accept packets less than 5 bytes. Is there a minimum packet size in general? Not a big deal, but something to take into account. I can't think of a "downside' to adding the option for go 'leaderless' but would like to hear more thoughts on it.

mcsarge commented 4 years ago

Probably only small packets will be used when doing tests, like I did, On receive, if you configure no header, why would it care what the buffer size is and on transmit, if header is off, still do not care. But if header is on for Tx, it should require >4 bytes and on Rx, I guess drop any buffer <=4.

jerryneedell commented 4 years ago

Probably only small packets will be used when doing tests, like I did, On receive, if you configure no header, why would it care what the buffer size is and on transmit, if header is off, still do not care. But if header is on for Tx, it should require >4 bytes and on Rx, I guess drop any buffer <=4.

No reason to care if no header, but I was just pointing out that it requires additional changes to the code. Not a problem.

mcsarge commented 4 years ago

I can provide an example using the CubeCell board that accounts for the extra 4 bytes or if you change it an example both ways....