Let MCU detection recover faster
Use small timeouts to recover faster if there is a misdetection for whatever reason (truncated packet, user program toggles port, etc.).
This commit is contained in:
parent
b72c5a60fb
commit
e0afd851ae
@ -718,9 +718,9 @@ class StcBaseProtocol:
|
||||
self.ser = serial.Serial(port=self.port, baudrate=self.baud_handshake,
|
||||
parity=self.PARITY)
|
||||
|
||||
# conservative timeout values
|
||||
self.ser.timeout = 10.0
|
||||
self.ser.interCharTimeout = 1.0
|
||||
# fast timeout values to deal with detection errors
|
||||
self.ser.timeout = 0.5
|
||||
self.ser.interCharTimeout = 0.5
|
||||
|
||||
print("Waiting for MCU, please cycle power: ", end="")
|
||||
sys.stdout.flush()
|
||||
@ -735,6 +735,10 @@ class StcBaseProtocol:
|
||||
except (StcFramingException, serial.SerialTimeoutException): pass
|
||||
print("done")
|
||||
|
||||
# conservative timeout values
|
||||
self.ser.timeout = 15.0
|
||||
self.ser.interCharTimeout = 1.0
|
||||
|
||||
self.initialize_status(status_packet)
|
||||
self.initialize_model()
|
||||
self.initialize_options(status_packet)
|
||||
|
Loading…
Reference in New Issue
Block a user