Skip to content

Commit

Permalink
Merge 8f09234 into 3b8dfc9
Browse files Browse the repository at this point in the history
  • Loading branch information
drkingpo authored Oct 31, 2020
2 parents 3b8dfc9 + 8f09234 commit e233ffb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
9 changes: 7 additions & 2 deletions ant/base/ant.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def __init__(self):
self._last_data = array.array("B", [])

self._running = True
self._RxScanMode = False

self._driver.open()

Expand Down Expand Up @@ -177,7 +178,7 @@ def _worker(self):
# Channel event
elif (
message._id == Message.ID.RESPONSE_CHANNEL
and message.data[1] == 0x01
and message._data[1] == 0x01
):
_logger.debug("Got channel event, %r", message)
self._events.put(
Expand All @@ -198,7 +199,10 @@ def _worker(self):
_logger.debug("No new data this period")

# Send messages in queue, on indicated time slot
if message._id == Message.ID.BROADCAST_DATA:
if (
message._id == Message.ID.BROADCAST_DATA
and self._RxScanMode == False
):
time.sleep(0.1)
_logger.debug(
"Got broadcast data, examine queue to see if we should send anything back"
Expand Down Expand Up @@ -289,6 +293,7 @@ def open_channel(self, channel):
self.write_message(message)

def open_rx_scan_mode(self):
self._RxScanMode = True
message = Message(Message.ID.OPEN_RX_SCAN_MODE, [0, 1]) # [0-Channel, 1-Enable]
self.write_message(message)

Expand Down
4 changes: 1 addition & 3 deletions examples/continuous_scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

# Definition of Variables
NETWORK_KEY = [0xB9, 0xA5, 0x21, 0xFB, 0xBD, 0x72, 0xC3, 0x45]

TimeProgramStart = time.time() # get start time

def on_data_scan(data):
deviceNumber = data[10] * 256 + data[9]
Expand All @@ -36,8 +36,6 @@ def main():
print("ANT+ Open Rx Scan Mode Demo")
logging.basicConfig(filename="example.log", level=logging.DEBUG)

TimeProgramStart = time.time() # get start time

node = Node()
node.set_network_key(0x00, NETWORK_KEY) # 1. Set Network Key
# CHANNEL CONFIGURATION
Expand Down

0 comments on commit e233ffb

Please sign in to comment.