Skip to content

Commit

Permalink
refactor: remove references to restarts
Browse files Browse the repository at this point in the history
  • Loading branch information
GetPsyched committed Jan 20, 2024
1 parent f6472ed commit e8b8680
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions charachorder/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,16 @@ def is_same_device(product_id: int, vendor_id: int) -> bool:

comports = [port for port in ports if is_same_device(port.pid, port.vid)]

# Device is restarting
# Device is disconnected or restarting
if len(comports) == 0:
continue

# Device found
elif len(comports) == 1:
port = comports[0].device

# This is true initially when the device hasn't fully shutdown yet
# This is true when the device is
# restarting but hasn't fully shutdown yet
is_same_session = port == self.port
if is_same_session:
continue
Expand Down
6 changes: 3 additions & 3 deletions charachorder/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ class SerialException(CharaChorderException):


class AutoReconnectFailure(SerialException):
"""An exception raised when auto-reconnect after a restart failed"""
"""An exception raised when auto-reconnect failed"""


class ReconnectTimeout(AutoReconnectFailure):
"""An exception raised when auto-reconnect failed due to a timeout"""

def __init__(self) -> None:
super().__init__(
"Auto reconnect after the restart has failed. You will need to re-create this object to do further Serial I/O"
"An attempt to auto-reconnect has failed due to a timeout. You will need to re-create this object to do further Serial I/O"
)


Expand All @@ -45,7 +45,7 @@ class TooManyDevices(AutoReconnectFailure):

def __init__(self) -> None:
super().__init__(
"It looks like you have two or more devices of the same model connected simultaneously. This causes the restart to not reconnect to the correct device. You will need to re-create this object to do further Serial I/O"
"An attempt to auto-reconnect has failed due to two or more devices of the same model connected simultaneously which means the same device cannot be detected reliably. You will need to re-create this object to do further Serial I/O"
)


Expand Down

0 comments on commit e8b8680

Please sign in to comment.