exmorse / pyRadioHeadNRF24

RadioHead NRF24 Python wrapper for Raspberry Pi
5 stars 4 forks source link

setMode query #2

Open PClough opened 7 years ago

PClough commented 7 years ago

Hi, Thank you for this library wrapper, took me a while to realise I couldn't just hit F5 in Geany programmer and instead had to use sudo ./server.py in the terminal after changing the directory to the folder above. I also noticed that your __init__.py file had 3 underscores after init instead of 2.

Anyway, I would like to add the ability to use the setModeIdle(), setModeTx() and setModeRx() functions. I can see they are built into the RH_NRF24.cpp and RH_NRF24.h so I tried adding

def setModeIdle(self):
    radiohead.setModeIdle()
def setModeTx(self):
    radiohead.setModeTx()
def setModeRx(self):
    radiohead.setModeRx()   

to pyRadioHeadNRF24.py.

However I am getting this error, could you help please?

Traceback (most recent call last):
  File "./Control_Node111_v3.py", line 20, in <module>
    nrf24.setModeIdle()
  File "/home/pi/pyRadioHeadNRF24/pyRadioHeadNRF24.py", line 148, in setModeIdle
    radiohead.setModeIdle()
  File "/usr/lib/python2.7/dist-packages/cffi/api.py", line 718, in __getattr__
    make_accessor(name)
  File "/usr/lib/python2.7/dist-packages/cffi/api.py", line 713, in make_accessor
    raise AttributeError(name)
AttributeError: setModeIdle

btw I am utilising the nrf24L01 (https://www.amazon.co.uk/gp/product/B010N32SGM/ref=oh_aui_detailpage_o09_s00?ie=UTF8&psc=1) on my Pi3.

Thanks!

exmorse commented 7 years ago

Thanks for reporting. The problem was that the setMode functions were not implemented in adapter.cpp.

It should be fixed with the last commit. Unfortunately at the moment I am not able to test it on nrf24 modules.