tests/multi_bluetooth: Use multitest.broadcast instead of sleep.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This commit is contained in:
parent
201f5df91e
commit
ab31e23f7a
@ -90,10 +90,12 @@ def wait_for_event(event, timeout_ms):
|
||||
def instance0():
|
||||
multitest.globals(BDADDR=ble.config("mac"))
|
||||
((char_handle,),) = ble.gatts_register_services(SERVICES)
|
||||
print("gap_advertise")
|
||||
ble.gap_advertise(20_000, b"\x02\x01\x06\x04\xffMPY")
|
||||
multitest.next()
|
||||
try:
|
||||
print("gap_advertise")
|
||||
ble.gap_advertise(20_000, b"\x02\x01\x06\x04\xffMPY")
|
||||
multitest.broadcast("peripheral:adv")
|
||||
|
||||
# Write initial characteristic value.
|
||||
ble.gatts_write(char_handle, "periph0")
|
||||
|
||||
@ -146,6 +148,8 @@ def instance0():
|
||||
def instance1():
|
||||
multitest.next()
|
||||
try:
|
||||
multitest.wait("peripheral:adv")
|
||||
|
||||
# Connect to peripheral and then disconnect.
|
||||
print("gap_connect")
|
||||
ble.gap_connect(*BDADDR)
|
||||
|
@ -75,6 +75,8 @@ def instance0():
|
||||
print(ble.config("gap_name"))
|
||||
ble.gap_advertise(20_000)
|
||||
|
||||
multitest.broadcast("peripheral:adv:{}".format(iteration))
|
||||
|
||||
# Wait for central to connect, then wait for it to disconnect.
|
||||
wait_for_event(_IRQ_CENTRAL_CONNECT, TIMEOUT_MS)
|
||||
wait_for_event(_IRQ_CENTRAL_DISCONNECT, 4 * TIMEOUT_MS)
|
||||
@ -89,7 +91,7 @@ def instance1():
|
||||
value_handle = None
|
||||
for iteration in range(2):
|
||||
# Wait for peripheral to start advertising.
|
||||
time.sleep_ms(500)
|
||||
multitest.wait("peripheral:adv:{}".format(iteration))
|
||||
|
||||
# Connect to peripheral.
|
||||
print("gap_connect")
|
||||
|
Loading…
Reference in New Issue
Block a user