-
Dear Bitcraze team! from crazyradio import Crazyradio
class RadioStreamer:
def __init__(self, devid=0, mode=Crazyradio.MODE_PTX, channel=100, data_rate=Crazyradio.DR_2MPS):
self.radio = Crazyradio(devid=devid)
self.radio.set_channel(channel)
self.radio.set_data_rate(data_rate)
self.radio.set_mode(mode)
class RadioReciever:
def __init__(self, devid=1, mode=Crazyradio.MODE_PRX, channel=100, data_rate=Crazyradio.DR_2MPS):
self.radio = Crazyradio(devid=devid)
self.radio.set_channel(channel)
self.radio.set_data_rate(data_rate)
self.radio.set_mode(mode) Afterwards, I send my data in arrays using the send_packet method of the transmitting radio, and receive them using the receive method of the receiving radio. This has worked so far when both the transmitting and receiving radios were the old Crazyradio PA, but it seems to me that the Crazyradio 2.0 when configured to emulate the Crazyradio PA cannot receive the packets in this configuration. Specifically, the read command in the Crazyradio.receive method on line 302 of crazyradio.py times out: def receive(self, timeout=1000):
""" Try to receive a packet or return None, if nothing was received within
the specified timeout. Only valid if radio is in PRX mode."""
try:
if (pyusb1 is False):
return self.handle.bulkRead(0x81, 64, timeout)
else:
return self.handle.read(0x81, 64, timeout=timeout) # this times out on Crazyradio 2.0
except usb.USBError:
pass This happens only when a Crazyradio 2.0 is receiving:
Do you have any ideas on why this may be happening and how to remedy it? Obviously, this is only the outline of my code, and the devil may well be hiding in the details. If no easy solution is found, I will extract the relevant parts of my project into a minimal example, and provide it for you for testing, but I'm hoping I just overlooked something obvious. Thanks a lot for your help! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Unfortunatly what is happening here is not an evil detail but the elephant in the room: PRX is not implemented on Crazyradio2 yet, it is just a stub. Your use case is awesome by the way, I always wanted to use Crazyradios for communication between PC but never had a reason to do it :-). So unfortunatly for now the only solution would be to use Crazyradio-PAs for the PRX role and Crazyradio-2 for the PTX role. Hopefully you have enough Crazyradio PA. I think we should just implement PRX mode. I do not know when I will have time to get to it though, likely not before 2 weeks. I made an issue to track progress. |
Beta Was this translation helpful? Give feedback.
Unfortunatly what is happening here is not an evil detail but the elephant in the room: PRX is not implemented on Crazyradio2 yet, it is just a stub.
Your use case is awesome by the way, I always wanted to use Crazyradios for communication between PC but never had a reason to do it :-).
So unfortunatly for now the only solution would be to use Crazyradio-PAs for the PRX role and Crazyradio-2 for the PTX role. Hopefully you have enough Crazyradio PA.
I think we should just implement PRX mode. I do not know when I will have time to get to it though, likely not before 2 weeks. I made an issue to track progress.