tests/multi_bluetooth: Change dict index-and-del to pop, to clear event.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This commit is contained in:
Jim Mussared 2020-11-12 23:05:47 +11:00 committed by Damien George
parent 61d1e4b01b
commit 7e75245d54
6 changed files with 6 additions and 18 deletions

View File

@ -77,9 +77,7 @@ def wait_for_event(event, timeout_ms):
t0 = time.ticks_ms()
while time.ticks_diff(time.ticks_ms(), t0) < timeout_ms:
if event in waiting_events:
result = waiting_events[event]
del waiting_events[event]
return result
return waiting_events.pop(event)
machine.idle()
raise ValueError("Timeout waiting for {}".format(event))

View File

@ -33,9 +33,7 @@ def wait_for_event(event, timeout_ms):
t0 = time.ticks_ms()
while time.ticks_diff(time.ticks_ms(), t0) < timeout_ms:
if event in waiting_events:
result = waiting_events[event]
del waiting_events[event]
return result
return waiting_events.pop(event)
machine.idle()
raise ValueError("Timeout waiting for {}".format(event))

View File

@ -49,9 +49,7 @@ def wait_for_event(event, timeout_ms):
t0 = time.ticks_ms()
while time.ticks_diff(time.ticks_ms(), t0) < timeout_ms:
if event in waiting_events:
result = waiting_events[event]
del waiting_events[event]
return result
return waiting_events.pop(event)
machine.idle()
raise ValueError("Timeout waiting for {}".format(event))

View File

@ -76,9 +76,7 @@ def wait_for_event(event, timeout_ms):
t0 = time.ticks_ms()
while time.ticks_diff(time.ticks_ms(), t0) < timeout_ms:
if event in waiting_events:
result = waiting_events[event]
del waiting_events[event]
return result
return waiting_events.pop(event)
machine.idle()
raise ValueError("Timeout waiting for {}".format(event))

View File

@ -55,9 +55,7 @@ def wait_for_event(event, timeout_ms):
t0 = time.ticks_ms()
while time.ticks_diff(time.ticks_ms(), t0) < timeout_ms:
if event in waiting_events:
result = waiting_events[event]
del waiting_events[event]
return result
return waiting_events.pop(event)
machine.idle()
raise ValueError("Timeout waiting for {}".format(event))

View File

@ -87,9 +87,7 @@ def wait_for_event(event, timeout_ms):
t0 = time.ticks_ms()
while time.ticks_diff(time.ticks_ms(), t0) < timeout_ms:
if event in waiting_events:
result = waiting_events[event]
del waiting_events[event]
return result
return waiting_events.pop(event)
machine.idle()
raise ValueError("Timeout waiting for {}".format(event))