summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/multi_bluetooth/ble_characteristic.py8
-rw-r--r--tests/multi_bluetooth/ble_gap_device_name.py4
2 files changed, 9 insertions, 3 deletions
diff --git a/tests/multi_bluetooth/ble_characteristic.py b/tests/multi_bluetooth/ble_characteristic.py
index 492f59dbd..50b12681e 100644
--- a/tests/multi_bluetooth/ble_characteristic.py
+++ b/tests/multi_bluetooth/ble_characteristic.py
@@ -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)
diff --git a/tests/multi_bluetooth/ble_gap_device_name.py b/tests/multi_bluetooth/ble_gap_device_name.py
index 556068114..273c0bd11 100644
--- a/tests/multi_bluetooth/ble_gap_device_name.py
+++ b/tests/multi_bluetooth/ble_gap_device_name.py
@@ -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")