From 795d0fbf6c60d91801fcfe52710a80313374c8b2 Mon Sep 17 00:00:00 2001 From: Brendan <2bndy5@gmail.com> Date: Wed, 6 Mar 2024 08:59:14 -0800 Subject: [PATCH] fix address assignment to pipes in python scanner --- examples_linux/scanner.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/examples_linux/scanner.py b/examples_linux/scanner.py index f1debb1f..2399094a 100644 --- a/examples_linux/scanner.py +++ b/examples_linux/scanner.py @@ -23,6 +23,18 @@ TOTAL_CHANNELS = 126 CACHE_MAX = 5 # the depth of history to calculate peaks +# To detect noise, we'll use the worst addresses possible (a reverse engineering +# tactic). These addresses are designed to confuse the radio into thinking that the +# RF signal's preamble is part of the packet/payload. +noise_address = [ + b"\x55\x55", + b"\xaa\xaa", + b"\x0a\xaa", + b"\xa0\xaa", + b"\x00\xaa", + b"\xab\xaa", +] + class ChannelHistory: def __init__(self) -> None: @@ -92,12 +104,8 @@ def init_radio(): radio.setAutoAck(False) radio.disableCRC() radio.setAddressWidth(2) - radio.openReadingPipe(0, b"\x55\x55") - radio.openReadingPipe(1, b"\xaa\xaa") - radio.openReadingPipe(1, b"\x0a\xaa") - radio.openReadingPipe(1, b"\xa0\xaa") - radio.openReadingPipe(1, b"\x00\xaa") - radio.openReadingPipe(1, b"\xab\xaa") + for pipe, address in enumerate(noise_address): + radio.openReadingPipe(pipe, address) radio.startListening() radio.stopListening() radio.flush_rx()