-
Notifications
You must be signed in to change notification settings - Fork 26
enable interrupt handling for received packets #19
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good - requesting identical changes on the RFM9x PR for this issue: adafruit/Adafruit_CircuitPython_RFM9x#33 (review)
Thanks!
requested changes implemented - thanks |
@brentru are there any other changes you want made. Do you want any other reviews? |
hi @jerryneedell |
I’ll try that. Can you describe the problems you are having? |
@Pythonaire this discussion suggests that a PULLUP is not desirable. matthijskooijman/arduino-lmic#46 Perhaps we should not be setting it at all. I will ask around for some guidance on this. |
|
It may just be a bad packet being received. Using the interrupt will not really help with issues of corrupted packets or missed packets. It may be useful to think about implementing something like the "reliable-datagram" that is used by the RadioHead library but that requires acknowledgement and retries. |
My fault, the pull_up_down stands for the initial(!) resistor state not the behavior, so PUD_DOWN is right. And yes, you are right, to reduce power consumption, I decided to take the "middle way". I use RH Datagram on client side, to have the chance to wait until all data are send properly. But not waiting for server acknowledgments. After the interrupt, I insert a if condition to see the received packets are not None. So , it seems in this special case the received packet was "corrupt". Fortunately, I didn't seen that before, so must be accidentally. |
@brentru Are you satisfied with the updates I made and OK to merge this or do you want more changes? I am going to start working on another PR soon so it would be good to get this one out of the way -- same for the RFM9x PR I'm happy to make any other changes you want if there is something else you would like to see. |
@jerryneedell yep, I'm going to merge in both and release. was afk for a few days but I'm back now. |
Updating https://www.github.com/adafruit/Adafruit_CircuitPython_MCP4728 to 1.0.1 from 1.0.0: > Merge remote-tracking branch 'adafruit/master' > Fixing CP-isnt-CPython bug Updating https://github.com/adafruit/Adafruit_CircuitPython_RFM69 to 1.3.0 from 1.2.5: > Merge pull request adafruit/Adafruit_CircuitPython_RFM69#19 from jerryneedell/jerryn_interrupt > Merge pull request adafruit/Adafruit_CircuitPython_RFM69#17 from adafruit/dherrada-patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_RFM9x to 1.2.0 from 1.1.7: > Merge pull request adafruit/Adafruit_CircuitPython_RFM9x#33 from jerryneedell/jerryn_interrupt > Merge pull request adafruit/Adafruit_CircuitPython_RFM9x#30 from adafruit/dherrada-patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_BusDevice to 4.1.0 from 4.0.1: > Merge pull request adafruit/Adafruit_CircuitPython_BusDevice#36 from adafruit/dherrada-patch-1 > Merge pull request adafruit/Adafruit_CircuitPython_BusDevice#35 from CapableRobot/skip-init-write Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA: > Added the following libraries: Adafruit_CircuitPython_BLE_Apple_Notification_Center, Adafruit_CircuitPython_BLE_Magic_Light, Adafruit_CircuitPython_Display_Notification
Change send/receive functions to allow for the use of interrupts in the user code.
the changes are invoked if receive is called with timeout=None
in this case the initial call to listen is skipped assuming a packet has already been received
the user code must call listen.
send was modified to accept a kwarg keep_listenting -- if set to True then listen is call after the packet is sent.
add example for interrupt usage for Raspberry Pi
add example that transmits periodically.
Tested on Raspberry Pi Zero-W
and on feather_m0 (tested transmit example and that existing code still runs)
These changes should not impact any existing code.