-
Notifications
You must be signed in to change notification settings - Fork 3
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
using submodules of pybind11 and RF24* repos #5
Conversation
putting this back on hold till pybind11 releases v2.7.0 which will have explicit type conversion to/from python's native `bytearray` type
Having some trouble installing this following your docs at https://github.com/2bndy5/pyRF24/tree/add-submodules
build output
|
You need to init the submodules. Use
If it takes you should see the output of git cloning the RF24* libs and pybind11 as they are all submodules. Then try again, but you might need to delete a
You will see more verbose output by using
|
you might need to use
to ensure all submodules are checked out. |
Using Most of the examples are checking out fine, but with the general_network_test.py I keep getting random segmentation faults. It can take a few tries up to like 7, and only seems to happen when using RF24Mesh as a child node when sending. |
hmm try
I'm not sure if I updated it since I pushed those commits to master about initializing variables in the c'tor. That's what I had to do to fix the seg faults when using RF24Mesh. Although, a periodic seg fault is not something I experienced. I'll re-check that behavior. |
I used the "nRF Connect" app on my phone to verify fake_ble_test.py. Its pretty cool 🤓 |
I get an error on reinstall:
*also it said It is a cool app. I've got it on mine as well. I tried to write some BLE code once before, but it didn't go well. 🙃 |
The little endian is the biggest hurtle in c++. That and the CRC24 needed... |
Ahh yeah, that makes sense lol. I should have looked closer at the error msg... bah. |
Now I'm having trouble getting RF24Mesh to work as either master or child role. It worked when I tested it with RPi4 and my itsybitsy RP2040, but now I'm trying it with RPI4 and RPi2. So far I haven't seen a seg fault, but I did find |
@TMRh20 I think I need more context to reproduce the seg fault. I tried the generic net test again and it is working for both master and child roles between RPi4 and RPi2. I did notice (using I changed all the py bindings to accept buffer objects by value instead of reference. I'm not sure this will fix any seg faults since pybind11 does some implicit casting of parameters concerning pass-by-ref vs pass-by-val. I've also improved the generic net test example so that |
After reinstalling on my RPi4 with your latest changes, I can't reproduce the seg fault. Tried it on my Model B Rev 2 and its working fine as well. |
I figured out a way to install this package on non-Linux OSs to make use of only the stub files (type hinting used by IDEs and static type checkers like mypy). Executing anything in the python REPL will still yield errors like |
This addresses #3, fixes #1 and provides python wrappers for RF24, RF24Network, & RF24Mesh libs in 1 installable package.
RF24::setAutoAck()
from C++ isRF24.set_auto_ack()
in python.channel
payload_size
pa_level
(value set/get as enumeration). Noteset_pa_level()
still exists to controllna_enabled
parameter.crc_length
(value set/get as enumeration)data_rate
(value set/get as enumeration)address_width
dynamic_payloads
ack_payloads
rpd
(read-only)open_*x_pipe()
functions only accept addresses as a buffer protocol object (native python's bytes or bytearray objects). The deprecated versions ofopen****ingPipe()
(which accept a uint64_t as addresses) are not supported, although this may change in the future if requested.help()
function to get more info about the API (iehelp(RF24.begin)
will show exactly what is hosted in the docs as RST syntax).NOTE: Distributing this pkg for use with pip install from pypi uploads is yet another beast of an issue. I'll open another issue (see #6 ) to discuss it, but I think it will require either self-hosted CI runners (using privately owned/maintained RPi devices) or some kind of VM that emulates the RPi architecture and corresponding OS "bitness" (building 32bit binary distributable wheels is a problem from 64bit host machines).