increase intial sleep for port check, otherwise it ccould fail on pi4

This commit is contained in:
hathach 2023-11-29 18:11:50 +07:00
parent 83840041a8
commit c1dbeb55b4
No known key found for this signature in database
GPG Key ID: F5D50C6D51D17CBA

View File

@ -65,13 +65,14 @@ def open_serial_dev(port):
if os.path.exists(port):
try:
# slight delay since kernel may occupy the port briefly
time.sleep(0.2)
time.sleep(0.5)
timeout = timeout - 0.5
ser = serial.Serial(port, timeout=1)
break
except serial.SerialException:
pass
time.sleep(0.8)
timeout = timeout - 1
time.sleep(0.5)
timeout = timeout - 0.5
assert timeout, 'Device not available or Cannot open port'
return ser