[FIX] hw_scale: use a larger timeout during initial probe
I'm not sure why the serial timeout is so aggressive, but I assume there is a reason for it. During probing however, we shouldn't use such an aggressive timeout because if we miss the device during initial startup we'll never find it since we only probe devices once.
This commit is contained in:
parent
290eb4ea2e
commit
c23eb23267
|
@ -94,8 +94,8 @@ class Scale(Thread):
|
||||||
bytesize = serial.SEVENBITS,
|
bytesize = serial.SEVENBITS,
|
||||||
stopbits = serial.STOPBITS_ONE,
|
stopbits = serial.STOPBITS_ONE,
|
||||||
parity = serial.PARITY_EVEN,
|
parity = serial.PARITY_EVEN,
|
||||||
timeout = 0.02,
|
timeout = 1,
|
||||||
writeTimeout= 0.02)
|
writeTimeout = 1)
|
||||||
|
|
||||||
connection.write("W")
|
connection.write("W")
|
||||||
self.probed_device_paths.append(path)
|
self.probed_device_paths.append(path)
|
||||||
|
@ -104,6 +104,8 @@ class Scale(Thread):
|
||||||
_logger.debug(path + ' is scale')
|
_logger.debug(path + ' is scale')
|
||||||
self.path_to_scale = path
|
self.path_to_scale = path
|
||||||
self.set_status('connected','Connected to '+device)
|
self.set_status('connected','Connected to '+device)
|
||||||
|
connection.timeout = 0.02
|
||||||
|
connection.writeTimeout = 0.02
|
||||||
return connection
|
return connection
|
||||||
else:
|
else:
|
||||||
_logger.debug('Already probed: ' + path)
|
_logger.debug('Already probed: ' + path)
|
||||||
|
|
Loading…
Reference in New Issue