Change timeout
This commit is contained in:
@@ -13,17 +13,13 @@ class SerialDevice:
|
|||||||
|
|
||||||
def send_command(self, command: str) -> str:
|
def send_command(self, command: str) -> str:
|
||||||
|
|
||||||
with Serial(self.serial_port, self.baudrate, timeout=1) as s:
|
with Serial(self.serial_port, self.baudrate, timeout=3) as s:
|
||||||
if self.verbose:
|
if self.verbose:
|
||||||
print(self.prefix, "send:", command)
|
print(self.prefix, "send:", command)
|
||||||
|
|
||||||
s.write(command.encode())
|
s.write(command.encode())
|
||||||
|
|
||||||
response_raw = None
|
response_raw = s.readline()
|
||||||
|
|
||||||
count = 0
|
|
||||||
while count < 10 and not (response_raw := s.readline()):
|
|
||||||
pass
|
|
||||||
|
|
||||||
if response_raw:
|
if response_raw:
|
||||||
response = response_raw.decode().strip()
|
response = response_raw.decode().strip()
|
||||||
|
|||||||
Reference in New Issue
Block a user