File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
micropython/bluetooth/aioble/aioble Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -262,7 +262,7 @@ def is_connected(self):
262
262
def timeout (self , timeout_ms ):
263
263
return DeviceTimeout (self , timeout_ms )
264
264
265
- async def exchange_mtu (self , mtu = None ):
265
+ async def exchange_mtu (self , mtu = None , timeout_ms = 1000 ):
266
266
if not self .is_connected ():
267
267
raise ValueError ("Not connected" )
268
268
@@ -271,7 +271,8 @@ async def exchange_mtu(self, mtu=None):
271
271
272
272
self ._mtu_event = self ._mtu_event or asyncio .ThreadSafeFlag ()
273
273
ble .gattc_exchange_mtu (self ._conn_handle )
274
- await self ._mtu_event .wait ()
274
+ with self .timeout (timeout_ms ):
275
+ await self ._mtu_event .wait ()
275
276
return self .mtu
276
277
277
278
# Wait for a connection on an L2CAP connection-oriented-channel.
You can’t perform that action at this time.
0 commit comments