Skip to content

Commit

Permalink
Fix issue with reading from devices that keep sending data
Browse files Browse the repository at this point in the history
  • Loading branch information
GraysonBellamy committed Jun 11, 2024
1 parent 731d021 commit 8381eee
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
23 changes: 12 additions & 11 deletions pyalicat/comm.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,17 +195,18 @@ async def _write_readall(
await self._write(command)
line = bytearray()
arr_line: list[str] = []
while True:
c = None
with anyio.move_on_after(
self.timeout / 1000
): # if keep reading none, then timeout
while c is None: # Keep reading until a character is read
c = await self._read()
await anyio.lowlevel.checkpoint()
if c is None: # if we reach timeout,
break
line += c
with anyio.move_on_after(self.timeout / 1000):
while True:
c = None
with anyio.move_on_after(
self.timeout / 1000
): # if keep reading none, then timeout
while c is None: # Keep reading until a character is read
c = await self._read()
await anyio.lowlevel.checkpoint()
if c is None: # if we reach timeout,
break
line += c
arr_line = line.decode("ascii").splitlines()
self.isOpen = False
return arr_line
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "pyAlicat"
version = "0.0.6"
version = "0.0.7"
description = "Python API for acquisition and control of Alicat mass flow meters and controllers."
packages = [{include = "pyalicat"}]
include = [{path = "pyalicat/codes.json", format = ["sdist", "wheel"]}]
Expand Down

0 comments on commit 8381eee

Please sign in to comment.