mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-08 07:27:29 -06:00
Added bit more logging to USBConnection
This should make the debugging easier out in the field.
This commit is contained in:
parent
68798a0c81
commit
87a0543d0c
1 changed files with 4 additions and 2 deletions
|
@ -251,7 +251,7 @@ class USBPrinterOutputDevice(PrinterOutputDevice):
|
||||||
# If the programmer connected, we know its an atmega based version.
|
# If the programmer connected, we know its an atmega based version.
|
||||||
# Not all that useful, but it does give some debugging information.
|
# Not all that useful, but it does give some debugging information.
|
||||||
for baud_rate in self._getBaudrateList(): # Cycle all baud rates (auto detect)
|
for baud_rate in self._getBaudrateList(): # Cycle all baud rates (auto detect)
|
||||||
Logger.log("d","Attempting to connect to printer with serial %s on baud rate %s", self._serial_port, baud_rate)
|
Logger.log("d", "Attempting to connect to printer with serial %s on baud rate %s", self._serial_port, baud_rate)
|
||||||
if self._serial is None:
|
if self._serial is None:
|
||||||
try:
|
try:
|
||||||
self._serial = serial.Serial(str(self._serial_port), baud_rate, timeout = 3, writeTimeout = 10000)
|
self._serial = serial.Serial(str(self._serial_port), baud_rate, timeout = 3, writeTimeout = 10000)
|
||||||
|
@ -260,7 +260,7 @@ class USBPrinterOutputDevice(PrinterOutputDevice):
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
if not self.setBaudRate(baud_rate):
|
if not self.setBaudRate(baud_rate):
|
||||||
continue # Could not set the baud rate, go to the next
|
continue # Could not set the baud rate, go to the next
|
||||||
|
|
||||||
time.sleep(1.5) # Ensure that we are not talking to the bootloader. 1.5 seconds seems to be the magic number
|
time.sleep(1.5) # Ensure that we are not talking to the bootloader. 1.5 seconds seems to be the magic number
|
||||||
sucesfull_responses = 0
|
sucesfull_responses = 0
|
||||||
|
@ -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:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue