forked from M-Labs/artiq
device/thorlabs_tcube: fix port read
This commit is contained in:
parent
50888865e7
commit
3c09577ed0
@ -193,12 +193,12 @@ class _Tcube:
|
||||
await self.port.write(message.pack())
|
||||
|
||||
async def recv(self):
|
||||
header = await self.port.read(6)
|
||||
header = await self.port.read_exactly(6)
|
||||
logger.debug("received header: %s", header)
|
||||
data = b""
|
||||
if header[4] & 0x80:
|
||||
(length, ) = st.unpack("<H", header[2:4])
|
||||
data = await self.port.read(length)
|
||||
data = await self.port.read_exactly(length)
|
||||
r = Message.unpack(header + data)
|
||||
logger.debug("receiving: %s", r)
|
||||
return r
|
||||
|
Loading…
Reference in New Issue
Block a user