Skip to content

Commit ab31e23

Browse files
committed
tests/multi_bluetooth: Use multitest.broadcast instead of sleep.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
1 parent 201f5df commit ab31e23

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

tests/multi_bluetooth/ble_characteristic.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,12 @@ def wait_for_event(event, timeout_ms):
9090
def instance0():
9191
multitest.globals(BDADDR=ble.config("mac"))
9292
((char_handle,),) = ble.gatts_register_services(SERVICES)
93-
print("gap_advertise")
94-
ble.gap_advertise(20_000, b"\x02\x01\x06\x04\xffMPY")
9593
multitest.next()
9694
try:
95+
print("gap_advertise")
96+
ble.gap_advertise(20_000, b"\x02\x01\x06\x04\xffMPY")
97+
multitest.broadcast("peripheral:adv")
98+
9799
# Write initial characteristic value.
98100
ble.gatts_write(char_handle, "periph0")
99101

@@ -146,6 +148,8 @@ def instance0():
146148
def instance1():
147149
multitest.next()
148150
try:
151+
multitest.wait("peripheral:adv")
152+
149153
# Connect to peripheral and then disconnect.
150154
print("gap_connect")
151155
ble.gap_connect(*BDADDR)

tests/multi_bluetooth/ble_gap_device_name.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ def instance0():
7575
print(ble.config("gap_name"))
7676
ble.gap_advertise(20_000)
7777

78+
multitest.broadcast("peripheral:adv:{}".format(iteration))
79+
7880
# Wait for central to connect, then wait for it to disconnect.
7981
wait_for_event(_IRQ_CENTRAL_CONNECT, TIMEOUT_MS)
8082
wait_for_event(_IRQ_CENTRAL_DISCONNECT, 4 * TIMEOUT_MS)
@@ -89,7 +91,7 @@ def instance1():
8991
value_handle = None
9092
for iteration in range(2):
9193
# Wait for peripheral to start advertising.
92-
time.sleep_ms(500)
94+
multitest.wait("peripheral:adv:{}".format(iteration))
9395

9496
# Connect to peripheral.
9597
print("gap_connect")

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy