fix(core): SerialConsole.read устойчив к 'readiness to read but no data' на RPi/USB-serial

pyserial на Raspberry Pi временами кидает SerialException (readiness but no data)
на простоях порта — читаем как пустоту и продолжаем, а не роняем WS-консоль.
This commit is contained in:
toros
2026-09-08 23:42:36 +05:00
parent 912e0a7b28
commit 6ad9df81e6
2 changed files with 16 additions and 6 deletions
+10 -5
View File
@@ -158,13 +158,18 @@ async def ws_console(ws: WebSocket):
await ws.send_bytes(("\r\nATXPI console ready. driver=%s\r\n" % DRIVER).encode())
async def reader():
try:
while True:
while True:
try:
data = await asyncio.to_thread(console.read, 0.25)
if data:
except Exception as e:
log.warning("console.read error: %s", e)
break
if data:
try:
await ws.send_bytes(data)
except Exception:
pass
except Exception as e:
log.warning("ws handle_console send error: %s", e)
break
read_task = asyncio.create_task(reader())
try: