adafruit / Adafruit_CircuitPython_RFM69

CircuitPython module for the RFM69 series of 433/915 mhz packet radios.
MIT License
31 stars 28 forks source link

Implement "reliable datagram" #24

Closed jerryneedell closed 4 years ago

jerryneedell commented 4 years ago

Implemented compatibility with the RadioHead library "Reliable DataGram" mode. see #20. Received packets ar "ACKed" and Transmitted packets wait for ACK response.

It has been difficult to make this work reliably. Packets will still be missed occasionally but now they will be reported. There are attributes taht can be "tweaked" to help

rfm69.ack_delay -- set a delay before the ACK packet is sent - this is necessary when the receive unit an MCU communication to a Raspberry Pi . The MCU can send it's ACK packet before the Raspberry Pi has resumed "listening". The default setting is "None" but setting it to .1 seconds may be necessary. The Arduino RadioHead library does not allow for this "ack_delay" and it it may be difficult to get this to work, especially with a Raspberry Pi.

rfm69.retries -- set the number of ack retries

All of the existing examples will still execute without change.

There are "breaking changes" fo anyone that had been setting the RadioHead headers directly. There are now attributes for setting the header parameters and the rx_filter parameter for the receive function has been removed.

There are examples for using this mode in rfm69_node1_ack.py and rfm69_node2_ack.py

other new examples rfm69_header.py -- receive packets and display the header and packet contents rfm69_node1.py -- uses adresses without ACK rfm69_node2.py -- companion to rfm69_node1.py rfm68_rpi_simpletest.py - no LED and set pins for RaspBerry Pi rfm69_node1_bonnet.py -- similar to rfm69_node1.py but for use with RPi and bonnet -- uses buttons to sent packets

jerryneedell commented 4 years ago

This PR will require updating to accommodate #28. I recommend suspending testing or review until I resolve the conflicts.

jerryneedell commented 4 years ago

updated to accommodate #28

FoamyGuy commented 4 years ago

I am set up to test these now so far I've been able to successfully test rfm69_node1.py and rfm69_node2.py. I did have to change some of the pins used to these in order for it to work for me on Feather M0 RFM69HCW:

# Define pins connected to the chip.
CS = digitalio.DigitalInOut(board.RFM69_CS)
RESET = digitalio.DigitalInOut(board.RFM69_RST)

After that I was able to send/receive the counting messages between a pair of devices. I think these pins probably depend on what devices and setup you are using?

jerryneedell commented 4 years ago

I am set up to test these now so far I've been able to successfully test rfm69_node1.py and rfm69_node2.py. I did have to change some of the pins used to these in order for it to work for me on Feather M0 RFM69HCW:

# Define pins connected to the chip.
CS = digitalio.DigitalInOut(board.RFM69_CS)
RESET = digitalio.DigitalInOut(board.RFM69_RST)

After that I was able to send/receive the counting messages between a pair of devices. I think these pins probably depend on what devices and setup you are using?

yes -- this pins do have to be adjusted for the device being used

jerryneedell commented 4 years ago

Great work Jerry. Thank you for this. I tested all of the examples that I could with two Feather M0 RFM69HCW devices and it was all working as intended.

Thank you for testing and for your comments.

jerryneedell commented 4 years ago

@tannewt when you have a chance, let me know if you would like any additional changes and if you think this is OK to merge.