deal with bad established ble cx

This commit is contained in:
Florent 2025-10-27 14:45:48 +01:00
parent 3f8c9658a1
commit 3c34c6b34e
2 changed files with 7 additions and 1 deletions

View file

@ -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:

View file

@ -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()