mirror of
https://github.com/meshcore-dev/meshcore_py.git
synced 2026-04-20 22:13:49 +00:00
deal with bad established ble cx
This commit is contained in:
parent
3f8c9658a1
commit
3c34c6b34e
2 changed files with 7 additions and 1 deletions
|
|
@ -113,7 +113,12 @@ class BLEConnection:
|
|||
except TimeoutError:
|
||||
return None
|
||||
|
||||
await self.client.start_notify(UART_TX_CHAR_UUID, self.handle_rx)
|
||||
try:
|
||||
await self.client.start_notify(UART_TX_CHAR_UUID, self.handle_rx)
|
||||
except AttributeError :
|
||||
logger.info("Connection is not established, need to restart it")
|
||||
logger.debug("in ble_cx.connect()")
|
||||
return None
|
||||
|
||||
nus = self.client.services.get_service(UART_SERVICE_UUID)
|
||||
if nus is None:
|
||||
|
|
|
|||
|
|
@ -165,6 +165,7 @@ class MeshCore:
|
|||
await self.dispatcher.start()
|
||||
result = await self.connection_manager.connect()
|
||||
if result is None:
|
||||
await self.dispatcher.stop()
|
||||
raise ConnectionError("Failed to connect to device")
|
||||
return await self.commands.send_appstart()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue