This commit is contained in:
2022-06-05 15:56:40 +02:00
parent 8e53b4346b
commit 5405db9e7e
4 changed files with 9 additions and 12 deletions

View File

@@ -10,11 +10,10 @@ class SerialDevice:
self.baudrate = baudrate
self.verbose = verbose
def send_command(self, command: str, verbose: bool = False) -> str:
verbose = verbose or self.verbose
def send_command(self, command: str) -> str:
with Serial(self.serial_port, self.baudrate, timeout=1) as s:
if verbose:
if self.verbose:
print("Send:", command)
s.write(command.encode())
@@ -30,7 +29,7 @@ class SerialDevice:
else:
response = ""
if verbose:
if self.verbose:
print("Resp:", response)
if not response:
print("No response")