Added bit more logging to USBConnection

This should make the debugging easier out in the field.
This commit is contained in:
Jaime van Kessel 2016-08-09 09:37:31 +02:00
parent 68798a0c81
commit 87a0543d0c

View file

@ -270,11 +270,13 @@ class USBPrinterOutputDevice(PrinterOutputDevice):
while timeout_time > time.time(): while timeout_time > time.time():
line = self._readline() line = self._readline()
if line is None: if line is None:
Logger.log("d", "No response from serial connection received.")
# Something went wrong with reading, could be that close was called. # Something went wrong with reading, could be that close was called.
self.setConnectionState(ConnectionState.closed) self.setConnectionState(ConnectionState.closed)
return return
if b"T:" in line: if b"T:" in line:
Logger.log("d", "Correct response for auto-baudrate detection received.")
self._serial.timeout = 0.5 self._serial.timeout = 0.5
sucesfull_responses += 1 sucesfull_responses += 1
if sucesfull_responses >= self._required_responses_auto_baud: if sucesfull_responses >= self._required_responses_auto_baud: