Skip to content

Commit

Permalink
cleaning for v0.1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
teauxfu committed Apr 19, 2021
1 parent db7c47b commit 1c920fe
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,6 @@ See the `API Documentation`_ for more usage examples.
:target: https://github.com/psf/black
:alt: Style

.. |pylint| image:: https://mperlet.github.io/pybadge/badges/9.86.svg
.. |pylint| image:: https://mperlet.github.io/pybadge/badges/9.87.svg
:target: https://github.com/mperlet/pybadge
:alt: Vanilla Pylint Score
2 changes: 1 addition & 1 deletion py_hplc/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""An unoffical Python wrapper for the SSI-Teledyne Next Generation class HPLC pumps."""
# make these available at package level
from py_hplc.pump_base import NextGenPumpBase
from py_hplc.pump import NextGenPump
from py_hplc.pump_base import NextGenPumpBase
4 changes: 2 additions & 2 deletions py_hplc/pump.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def leak_detected(self) -> bool:

def set_leak_mode(self, mode: int) -> int:
"""Sets the pump's current leak mode as an int.
0 if disabled. 1 if detected leak will fault. 2 if it will not fault.
"""
# there seems to not be a way to query the current value without setting it
Expand All @@ -308,7 +308,7 @@ def set_leak_mode(self, mode: int) -> int:
"or 2 (won't fault)."
)
self.command(f"lm{mode}") # OK,LM:<mode>/

# properties for pumps with a solvent select feature ------------------------------
# todo solvent select commands need testing
@property
Expand Down
10 changes: 5 additions & 5 deletions py_hplc/pump_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ def open(self) -> None:
"""Opens the serial port associated with the pump.
Raises: SerialException: An exception describing what went wrong. In this case,
we failed to open the serial port.
"""
we failed to open the serial port.
"""
try:
self.serial.open()
self.logger.info("Serial port connected")
Expand Down Expand Up @@ -134,7 +134,7 @@ def write(self, msg: str, delay: float = 0.015) -> str:
A response will be returned after at least (2 * delay) seconds.
Delay defaults to 0.015 s per pump documentation.
If we fail to get a "OK" response, we will wait 0.1 s before attempting again,
If we fail to get a "OK" response, we will wait 0.1 s before attempting again,
up to 3 attempts.
Returns the pump's response string.
Expand All @@ -159,15 +159,15 @@ def write(self, msg: str, delay: float = 0.015) -> str:
self.serial.reset_input_buffer()
self.serial.reset_output_buffer()
time.sleep(delay) # let the buffers clear (could defer here if async)

# it seems getting pre-encoded strings from a dict is only slightly faster,
# and only some of the time, when compared to just encoding args on the fly
self.serial.write(msg.encode() + b"\r")
self.logger.debug("Sent %s (attempt %s/3)", msg, tries)
self.serial.flush() # sleeps on a tight loop until everything is written
if msg == "#": # this won't give a response
break

time.sleep(delay) # let the pump respond
response = self.read()
if "OK" not in response: # need to retry
Expand Down

0 comments on commit 1c920fe

Please sign in to comment.