Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions micropython/drivers/radio/nrf24l01/nrf24l01.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,13 @@ def send(self, buf, timeout=500):
result = None
while result is None and utime.ticks_diff(utime.ticks_ms(), start) < timeout:
result = self.send_done() # 1 == success, 2 == fail

if result is None:
# timed out, cancel sending and power down the module
self.flush_tx()
self.reg_write(CONFIG, self.reg_read(CONFIG) & ~PWR_UP)
raise OSError("timed out")

if result == 2:
raise OSError("send failed")

Expand Down
Loading