nRF24 / CircuitPython_nRF24L01

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

Repo updates #44

Closed 2bndy5 closed 1 year ago

2bndy5 commented 1 year ago

Bug fixes

  1. In testing RF24Mesh.*_dhcp() function, I found a bug and fixed it in RF24Mesh.save_dhcp(). It was crashing when writing the json.dump() output to a binary file handler.
  2. In testing the UrlServiceData class, I found a problem where the byte codes for URL suffices (.com/, .org) were not used. With the new fix, the byte code prefixes (http://, https://www.) are now only used at the start of a given URL.
  3. CircuitPython's/MicroPython's SPI class' write_readinto() requires the MISO and MOSI buffer to be the same length. This mandates more memory allocated for each radio object instantiated.

Other enhancments

RF24.write() will assert the length is in acceptable range only if dynamic_payloads is enabled. This might speed up pre-processing time for transmissions.

codecov-commenter commented 1 year ago

Codecov Report

:exclamation: No coverage uploaded for pull request base (master@9ce1c68). Click here to learn what that means. The diff coverage is n/a.

@@            Coverage Diff            @@
##             master      #44   +/-   ##
=========================================
  Coverage          ?   86.90%           
=========================================
  Files             ?       16           
  Lines             ?     2466           
  Branches          ?        0           
=========================================
  Hits              ?     2143           
  Misses            ?      323           
  Partials          ?        0           

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

2bndy5 commented 1 year ago

There's likely a better way to monkeypatch classes with pytest's monkeypatch fixture, but that would be way more involved as it would require replacing the SPI bus usage with a logging-like function... I'm ok with 40% test code coverage for now.

2bndy5 commented 1 year ago

I couldn't help myself. With a miniature strate machine instead of a physical radio (and a thin SPI IO shim), I was able to test most of the code base. Only certain things that require external physical radio could not be tested (like RF24Mesh handshaking).

I was happy with 40% coverage; now I'm thrilled for > 80% coverage.