jpbarraca / pynrf24

Python port of the RF24 library for NRF24L01+ radios.
GNU General Public License v2.0
152 stars 84 forks source link

Update nrf24.py #5

Closed Angus71 closed 9 years ago

Angus71 commented 10 years ago

Hi jpbarraca,

When using your code for setting up two BeagleBone Black's to talk to each other via nRF24L01+ modules I found some problem I wanted to share with you for a review.

To actually use the provided code I had to make some changes (See below). Without the modification in write_payload I wasn't able to setup any communication between two BeagleBoard Nodes. When the size of the data to be send does not match the actual payload size (As in the provided examples). Also the problem I found in write may lead to problems, if the communication isn't okay, as it bails out always via timeout. The API of read was extended to actually be able to specify the "size" of the buffer (Which isn't needed in python, but it might be needed. If buf_len is set to -1 the complete "payload" is copied into "buf".

Fixed problem with write_payload

Fixed problem in write

Added buf_len parameter to read_payload

Removed \r\n in print_status

plopp commented 10 years ago

I made an experiment with the exact same hardware, two BBBs and two nrf24 and this library and stumbled upon the same problem. Didn't have time to check into it any further. Good update!

billprozac commented 9 years ago

@Angus71 , Thanks for the work. I have been working with a different board and assumed the issues I was having was related to the HW.

@jpbarraca , if you have the time to merge these changes, please do so since I don't think this lib works without them. Great work, BTW.