Skip to content

Commit

Permalink
PREVAC TMC13 -> master is only assigned and released once even if mul…
Browse files Browse the repository at this point in the history
…tiple drivers connect to the same physical unit
  • Loading branch information
afischer-sweepme committed Apr 24, 2024
1 parent 2f07e45 commit 6642f85
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/Logger-PREVAC_TMC13/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ def set_GUIparameter(self) -> dict: # noqa: N802

def get_GUIparameter(self, parameter: dict) -> None: # noqa: N802
"""Get parameters from the GUI and set them as attributes."""

self.port_string = parameter["Port"]

# Channel number must be of \x01 format
channel = parameter["Channel"]
self.channel = int(channel).to_bytes(1, byteorder="big").decode("latin1")
Expand Down Expand Up @@ -170,11 +173,15 @@ def connect(self) -> None:
)

self.register_host()
self.assign_master()
self.unique_identifier = "PREVAC_TMC13 - " + self.port_string
if self.unique_identifier not in self.device_communication:
self.assign_master()

def disconnect(self) -> None:
"""End the remote control mode on the device."""
self.release_master()
if self.unique_identifier in self.device_communication:
self.release_master()
del self.device_communication[self.unique_identifier]

def initialize(self) -> None:
"""Get frequency range."""
Expand Down

0 comments on commit 6642f85

Please sign in to comment.