nRF24 / CircuitPython_nRF24L01

CircuitPython driver library for the nRF24L01 transceiver.
http://circuitpython-nrf24l01.rtfd.io/
MIT License
45 stars 11 forks source link

CircuitPython throws a syntax error on line 428 of rf24.py #40

Closed jerryneedell closed 2 years ago

jerryneedell commented 2 years ago

I tried executing the nrf24l01_simple_test.py on a feather m4 express running both CircuitpYhton 7.3.0 and 8.0 alpha.1 and I get a syntax error on line 428 of rf24.py

https://github.com/nRF24/CircuitPython_nRF24L01/blob/master/circuitpython_nrf24l01/rf24.py#L428

simply adding a comma to line 427 fixes the problem changing

print(
            f"Auto retry delay__________"
            f"{((self._retry_setup & 0xF0) >> 4) * 250 + 250} microseconds",
        )

to

print(
            f"Auto retry delay__________",
            f"{((self._retry_setup & 0xF0) >> 4) * 250 + 250} microseconds",
        )

resolves the issue on the feather m4 express.

The library runs OK as is on a Raspberry Pi.

jerryneedell commented 2 years ago

Using a + instead of a comma may be preferred -- the comma adds a space between the strings, the + concatenates.

2bndy5 commented 2 years ago

A + is preferable. I've been developing the next release on the no-more-upy branch, and I think this is already solved there (had some problems in cirPy v7.x about using f-strs).

2bndy5 commented 2 years ago

Looks like I already reverted back to using https://github.com/nRF24/CircuitPython_nRF24L01/blob/43e9ae0de2f328faa4ef4e08f1488d4f7cc21cf9/circuitpython_nrf24l01/rf24.py#L443-L446 on my bleeding edge branch.

jerryneedell commented 2 years ago

Thanks for the quick response.

2bndy5 commented 2 years ago

Your feedback is always welcome. I'm just slow to release (for HW testing reasons).

jerryneedell commented 2 years ago

FYI -- I updated to the new release and ran the simple_ test between a Pi (3B+) and a Feather M4 Express running CP 8.0 alpha.1 -- worked fine! Thanks

2bndy5 commented 2 years ago

I just finished testing all the examples on my Feather RP2040 (w/ CirPy v7.3.0) and my RPi4. Thus, the release.