Skip to content

Commit

Permalink
Added work-around for serial port glitch
Browse files Browse the repository at this point in the history
  • Loading branch information
bruno-beloff committed May 11, 2023
1 parent e93dab6 commit a55864a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/scs_host/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
https://packaging.python.org/guides/single-sourcing-package-version/
"""

__version__ = '1.0.13'
__version__ = '1.0.14'
11 changes: 7 additions & 4 deletions src/scs_host/sys/host_serial.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ class HostSerial(Serial):
classdocs
"""

__PORT_PREFIX = "/dev/ttyO" # hard-coded path
__PORT_PREFIX = "/dev/ttyO" # hard-coded path

__POST_OPEN_DELAY = 0.1 # seconds
__POST_RELEASE_DELAY = 0.1 # seconds

# ----------------------------------------------------------------------------------------------------------------

Expand All @@ -40,8 +43,7 @@ def open(self, lock_timeout, comms_timeout):

# port...
self._ser = serial.Serial(port=self.device_identifier, baudrate=self._baud_rate, timeout=comms_timeout)

time.sleep(0.5) # as GE910 - 0.3
time.sleep(self.__POST_OPEN_DELAY)


def close(self):
Expand All @@ -54,6 +56,7 @@ def close(self):
finally:
# lock...
Lock.release(self.__lock_name)
time.sleep(self.__POST_RELEASE_DELAY)


# ----------------------------------------------------------------------------------------------------------------
Expand All @@ -67,4 +70,4 @@ def device_identifier(self):

@property
def __lock_name(self):
return "%s-%s" % (self.__class__.__name__, self._device_identifier)
return "-".join((self.__class__.__name__, str(self._device_identifier).replace("/", "_")))

0 comments on commit a55864a

Please sign in to comment.