gsd 4 months ago
parent
commit
f9895513d5
  1. 6
      mesht_device.py
  2. 5
      pb.py

6
mesht_device.py

@ -265,11 +265,7 @@ class MeshtDevice:
async def recv(self):
data = await self.transport.recv()
try:
fr = pb.decode(data, FROMRADIO_SCHEMA)
except UnicodeDecodeError:
logger.error("Cannot decode msg with string")
fr = {}
fr = pb.decode(data, FROMRADIO_SCHEMA)
logger.debug(f"FromRadio: {fr}")
self._maybe_store_channel(fr)
self._maybe_store_lora_config(fr)

5
pb.py

@ -447,7 +447,10 @@ def decode(buf, schema=None, _depth=0, _max_depth=_MAX_NESTING_DEPTH):
elif spec and spec.get("kind") == "packed":
v = _decode_packed(chunk, t)
elif t == "string":
v = chunk.decode("utf-8")
try:
v = chunk.decode("utf-8")
except UnicodeDecodeError:
v = None
elif t == "bytes" or spec is None:
v = chunk
else:

Loading…
Cancel
Save