Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArjen Hiemstra <a.hiemstra@ultimaker.com>2015-07-15 01:19:35 +0300
committerArjen Hiemstra <a.hiemstra@ultimaker.com>2015-07-15 01:19:35 +0300
commitc1d8e204b7051561e610bc4d1ad6a6a9391519c4 (patch)
tree38976e55c413c4fd57bdbc0f9f3a03f0e8ad0847
parenta3cc4b98b89aa807b87d4c6ac4e42068acf607b2 (diff)
Increase baud rate detection timeout and do not send \n between M105
Improves printer detection rate on MacOSX Contributes to #82
-rw-r--r--plugins/USBPrinting/PrinterConnection.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/plugins/USBPrinting/PrinterConnection.py b/plugins/USBPrinting/PrinterConnection.py
index 9d3c3334ef..cf020c4f49 100644
--- a/plugins/USBPrinting/PrinterConnection.py
+++ b/plugins/USBPrinting/PrinterConnection.py
@@ -201,18 +201,18 @@ 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()
+ line = self._readline()
if line is None:
self.setIsConnected(False) # Something went wrong with reading, could be that close was called.
return
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)