mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
Increase baud rate detection timeout and do not send \n between M105
Improves printer detection rate on MacOSX Contributes to #82
This commit is contained in:
parent
a3cc4b98b8
commit
c1d8e204b7
1 changed files with 5 additions and 3 deletions
|
@ -201,9 +201,10 @@ class PrinterConnection(SignalEmitter):
|
|||
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 sec seems to be the magic number
|
||||
sucesfull_responses = 0
|
||||
timeout_time = time.time() + 5
|
||||
timeout_time = time.time() + 15
|
||||
self._serial.write(b"\n")
|
||||
self._sendCommand("M105") # Request temperature, as this should (if baudrate is correct) result in a command with "T:" in it
|
||||
|
||||
while timeout_time > time.time():
|
||||
line = self._readline()
|
||||
if line is None:
|
||||
|
@ -212,7 +213,6 @@ class PrinterConnection(SignalEmitter):
|
|||
|
||||
if b"T:" in line:
|
||||
self._serial.timeout = 0.5
|
||||
self._serial.write(b"\n")
|
||||
self._sendCommand("M105")
|
||||
sucesfull_responses += 1
|
||||
if sucesfull_responses >= self._required_responses_auto_baud:
|
||||
|
@ -220,6 +220,8 @@ class PrinterConnection(SignalEmitter):
|
|||
self.setIsConnected(True)
|
||||
Logger.log("i", "Established printer connection on port %s" % self._serial_port)
|
||||
return
|
||||
|
||||
Logger.log("e", "Baud rate detection for %s failed", self._serial_port)
|
||||
self.close() # Unable to connect, wrap up.
|
||||
self.setIsConnected(False)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue