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):
262262 def timeout (self , timeout_ms ):
263263 return DeviceTimeout (self , timeout_ms )
264264
265- async def exchange_mtu (self , mtu = None ):
265+ async def exchange_mtu (self , mtu = None , timeout_ms = 1000 ):
266266 if not self .is_connected ():
267267 raise ValueError ("Not connected" )
268268
@@ -271,7 +271,8 @@ async def exchange_mtu(self, mtu=None):
271271
272272 self ._mtu_event = self ._mtu_event or asyncio .ThreadSafeFlag ()
273273 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 ()
275276 return self .mtu
276277
277278 # Wait for a connection on an L2CAP connection-oriented-channel.
You can’t perform that action at this time.
0 commit comments