Skip to content

Better utility for write() & update(); stream test revised

Compare
Choose a tag to compare
@2bndy5 2bndy5 released this 16 Oct 22:54
· 163 commits to master since this release

Library changes (rf24.py and rf24_lite.py)

  • update() now always returns True
    • this allows for calling the update() function in a conditional statement.
      e.g. if nrf.update() and nrf.pipe is not None: (which is a bit faster than using if nrf.any(): as some of the examples used prior to this change)
  • write() returns a boolean describing if the payload was written to the TX FIFO
  • new master_fifo() function in the stream example to compare with original master() function.
    • master_fifo() uses the write() function to utilize all 3 levels of the TX FIFO. This function can provide some additional incite as to how many failed transmissions get retried when using send(buf, force_retry=2) in the original master() function.
    • master() still uses the send() function, but only manages 1 level of the TX FIFO (as it always has).
  • I got tired of changing the addresses in the 2arduino_handling_data.py example, so I mirrored the use of the radioNumber boolean variable from the TMRh20 library's GettingStarted_HandlingData.ino example. I also adjusted some function calls in this example script to show how this library behaves a little differently internally (as compared to the TMRh20 library); these adjustments now closely match the behavior of the TMRh20 library's behavior.
  • As always, I found more errors in the docs; this time it was about what fifo() returned when the check_empty parameter isn't specified. There were some insignificant typos too.

This release's revised stream test seems to have most significant performance differences on the Raspberry Pi. The following is my test result on the RPi2:

>>> from nrf24l01_stream_test import *
    nRF24L01 Stream test
    Run slave() on receiver
    Run master() on transmitter to use 1 level of the TX FIFO
    Run master_fifo() on transmitter to use all 3 levels of the TX FIFO.
>>> master()
Transmission took 1630.3276280164719 ms
successfully sent 100.0% (32/32)
>>> master_fifo()
Transmission took 1002.7778159976006 ms with 20 failures detected.

HINT: Try playing with the 'ard' and 'arc' attributes to reduce the number of
failures detected. Tests were better with these attributes at higher values, but
notice the transmission time differences.
>>> # max out the auto-retransmit feature's attributes
>>> nrf.arc = 15
>>> nrf.ard = 4000
>>> master_fifo()
Transmission took 990.8866219520569 ms with 0 failures detected. You Win!
>>> master()
Transmission took 1595.034959077835 ms
successfully sent 100.0% (32/32)