Fix connecting to printer via USB

If the baudrate was anything else than 115200, detection of baudrate could fail
because readline() with a wrong baudrate would never return, even if timeouts
were set.
This commit is contained in:
rrrlasse 2020-09-29 14:24:14 +02:00
parent 1ac59d8857
commit e50df2c1a1

View file

@ -71,7 +71,8 @@ class AutoDetectBaudJob(Job):
timeout_time = time() + wait_response_timeout
while timeout_time > time():
line = serial.readline()
# If baudrate is wrong, then readline() might never return, even with timeouts set. Using read_until with size limit seems to fix this.
line = serial.read_until(size = 100)
if b"ok" in line and b"T:" in line:
successful_responses += 1
if successful_responses >= 1: