Skip to content
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

Implement "reliable datagram" #24

Open
wants to merge 18 commits into
base: master
from

Conversation

@jerryneedell
Copy link
Contributor

jerryneedell commented Mar 13, 2020

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 jerryneedell requested a review from brentru Mar 13, 2020
@jerryneedell jerryneedell changed the title Implemnt "reliable datagram" Implement "reliable datagram" Mar 13, 2020
@brentru brentru requested review from adafruit/circuitpythonlibrarians and removed request for brentru Mar 13, 2020
@jerryneedell

This comment has been minimized.

Copy link
Contributor Author

jerryneedell commented Mar 17, 2020

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

@jerryneedell

This comment has been minimized.

Copy link
Contributor Author

jerryneedell commented Mar 20, 2020

updated to accommodate #28

@jerryneedell jerryneedell requested review from adafruit/circuitpythonlibrarians and removed request for adafruit/circuitpythonlibrarians Mar 23, 2020
Copy link
Contributor

tannewt left a comment

Here are my thoughts. No major concerns. I didn't actually test it.

adafruit_rfm69.py Show resolved Hide resolved
adafruit_rfm69.py Outdated Show resolved Hide resolved
adafruit_rfm69.py Outdated Show resolved Hide resolved
adafruit_rfm69.py Outdated Show resolved Hide resolved
adafruit_rfm69.py Outdated Show resolved Hide resolved
Copy link
Contributor

tannewt left a comment

Two comment nits but looks good otherwise. Thanks!

"""
# initialize timeouts and delays delays
self.ack_wait = 0.5
"""Sets the delay time before attemting a retry after not receiving an AC"""

This comment has been minimized.

Copy link
@tannewt

tannewt Mar 30, 2020

Contributor
Suggested change
"""Sets the delay time before attemting a retry after not receiving an AC"""
"""The delay time before attempting a retry after not receiving an ACK"""

For attributes no need to say "Set..." it's covered by assignment and is deceiving because they can be read as well.

This comment has been minimized.

Copy link
@jerryneedell

jerryneedell Mar 31, 2020

Author Contributor

Done

# initialize packet header
# node address - default is broadcast
self.node = _RH_BROADCAST_ADDRESS
"""First byte of the RadioHead header.

This comment has been minimized.

Copy link
@tannewt

tannewt Mar 30, 2020

Contributor

I'd say which byte it is at the end because it doesn't actually say what it is.

This comment has been minimized.

Copy link
@jerryneedell

jerryneedell Mar 31, 2020

Author Contributor

Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.