virtualabs / radiobit

Micro:Bit Radio framework
146 stars 33 forks source link

esb only works with RATE_2MBIT #2

Closed zerog2k closed 6 years ago

zerog2k commented 6 years ago

esb mode seems to only work when my PTX is using 2Mbps datarate. (Setting 1Mbps doesnt receive anything.)

radio.on()
radio.config(data_rate=radio.RATE_1MBIT, ...)
radio.esb()
...

is 2Mbps being hardcoded in esb? https://github.com/virtualabs/radiobit/blob/master/micropython/source/microbit/modradio.cpp#L553-L555

virtualabs commented 6 years ago

When enabling the ESB mode, the data_rate is forced to 2Mbit by default, but there is a way to change it dynamically:

radio.on()
radio.config(...)
radio.esb()
radio.config(data_rate=radio.RATE_1MBIT)

It is a bit tricky but that should do the job ;)

zerog2k commented 6 years ago

thanks that works for me