From c23eb232675554b4952d3898a76470d5d659fe82 Mon Sep 17 00:00:00 2001 From: Joren Van Onder Date: Wed, 2 Mar 2016 16:27:31 +0100 Subject: [PATCH] [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. --- addons/hw_scale/controllers/main.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/hw_scale/controllers/main.py b/addons/hw_scale/controllers/main.py index 4d12b2aa825..730b9bb9c68 100644 --- a/addons/hw_scale/controllers/main.py +++ b/addons/hw_scale/controllers/main.py @@ -94,8 +94,8 @@ class Scale(Thread): bytesize = serial.SEVENBITS, stopbits = serial.STOPBITS_ONE, parity = serial.PARITY_EVEN, - timeout = 0.02, - writeTimeout= 0.02) + timeout = 1, + writeTimeout = 1) connection.write("W") self.probed_device_paths.append(path) @@ -104,6 +104,8 @@ class Scale(Thread): _logger.debug(path + ' is scale') self.path_to_scale = path self.set_status('connected','Connected to '+device) + connection.timeout = 0.02 + connection.writeTimeout = 0.02 return connection else: _logger.debug('Already probed: ' + path)