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
+6 -1
View File
@@ -96,7 +96,12 @@ class SerialConsole(ConsoleBackend):
if not self._ser:
raise RuntimeError("консоль не открыта")
self._ser.timeout = timeout
return self._ser.read(4096)
try:
return self._ser.read(4096)
except Exception:
# Raspberry Pi + USB-serial: на простоях порт может сообщать
# "readiness to read but no data" — это не фатально, читаем дальше.
return b""
def make_power() -> PowerBackend: