Skip to content

Commit

Permalink
final review
Browse files Browse the repository at this point in the history
  • Loading branch information
2bndy5 committed Mar 27, 2024
1 parent 1c2eaca commit 2b88f9b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
4 changes: 3 additions & 1 deletion examples/getting_started.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@
radio.payload_size = struct.calcsize("<f")

# for debugging
radio.print_details()
# radio.print_details()
# or for human readable data
# radio.print_pretty_details()


def master(count: int = 5): # count = 5 will only transmit 5 packets
Expand Down
6 changes: 3 additions & 3 deletions examples/interrupt_configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def master():
radio.mask_irq(True, False, False) # args = tx_ds, tx_df, rx_dr
print(" Pinging slave node for an ACK payload...")
pl_iterator[0] = 0
radio.start_write(tx_payloads[0], False) # False means expecting an ACK
radio.start_fast_write(tx_payloads[0])
if _wait_for_irq():
interrupt_handler()

Expand All @@ -153,7 +153,7 @@ def master():
radio.mask_irq(False, False, True) # args = tx_ds, tx_df, rx_dr
print(" Pinging slave node again...")
pl_iterator[0] = 1
radio.start_write(tx_payloads[1], False) # False means expecting an ACK
radio.start_fast_write(tx_payloads[1])
if _wait_for_irq():
interrupt_handler()

Expand All @@ -172,7 +172,7 @@ def master():
print(" Sending a ping to inactive slave node...")
radio.flush_tx() # just in case any previous tests failed
pl_iterator[0] = 2
radio.start_write(tx_payloads[3], False) # False means expecting an ACK
radio.start_fast_write(tx_payloads[3])
if _wait_for_irq():
interrupt_handler()
radio.flush_tx() # flush artifact payload in TX FIFO from last test
Expand Down
10 changes: 7 additions & 3 deletions examples/scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ def scan(timeout: int = 30):
if found_signal:
radio.flush_rx() # flush the RX FIFO because it asserts the RPD flag
endl = False
if curr_channel >= 125:
if curr_channel >= 124:
sweeps += 1
if sweeps % 100 == 0:
if int(sweeps / 100) > 0:
endl = True
curr_channel = curr_channel + 1 if curr_channel < 125 else 0
sweeps = 0

# output the signal counts per channel
sig_cnt = signals[curr_channel]
Expand All @@ -99,6 +99,10 @@ def scan(timeout: int = 30):
sep="",
end="" if curr_channel < 125 else ("\n" if endl else "\r"),
)
curr_channel = curr_channel + 1 if curr_channel < 125 else 0
if endl:
signals = [0] * 126 # reset the signal counts for new line


# finish printing results and end with a new line
while curr_channel < len(signals) - 1:
Expand Down

0 comments on commit 2b88f9b

Please sign in to comment.