chiark / gitweb /
Remove \n from sendCommand
authorYouness Alaoui <kakaroto@kakaroto.homelinux.net>
Thu, 12 Nov 2015 20:27:24 +0000 (15:27 -0500)
committerYouness Alaoui <kakaroto@kakaroto.homelinux.net>
Thu, 12 Nov 2015 20:27:24 +0000 (15:27 -0500)
The sendCommand is already adding a \n, having the \n in the argument
made it send an empty line to the serialCommunication process
which would then interpret it as an unknown (empty) command, which
caused [''] to be printed in stderr.

Fixes T321

Cura/util/printerConnection/serialConnection.py

index 81af3196830e54288e11c79a858331d17b66bf4d..a33528820dd990cfddf6da04193dbe8a16ad1ba9 100644 (file)
@@ -171,7 +171,7 @@ class serialConnection(printerConnectionBase.printerConnectionBase):
                                if x is not None and y is not None:
                                        # Set E relative positioning
                                        self.sendCommand("M83")
-                                       
+
                                        # Retract 1mm
                                        retract = ("E-%f" % retract_amount)
 
@@ -179,21 +179,21 @@ class serialConnection(printerConnectionBase.printerConnectionBase):
                                        newZ = self._ZPosition + moveZ
                                        if maxZ < newZ:
                                                newZ = maxZ
-                                               
+
                                        if newZ > self._ZPosition:
                                                move = ("Z%f " % (newZ))
                                        else: #No z movement, too close to max height 
                                                move = ""
-                                       retract_and_move = "G1 {} {}F120\n".format(retract, move)
+                                       retract_and_move = "G1 {} {}F120".format(retract, move)
                                        self.sendCommand(retract_and_move)
 
                                        #Move the head away
-                                       self.sendCommand("G1 X%f Y%f F9000\n" % (parkX, parkY))
+                                       self.sendCommand("G1 X%f Y%f F9000" % (parkX, parkY))
 
                                        #Disable the E steppers
-                                       self.sendCommand("M84 E0\n")
+                                       self.sendCommand("M84 E0")
                                        # Set E absolute positioning
-                                       self.sendCommand("M82\n")
+                                       self.sendCommand("M82")
 
                                        self._pausePosition = (x, y, self._ZPosition, f, e)
                        self._process.stdin.write("PAUSE\n")
@@ -202,22 +202,22 @@ class serialConnection(printerConnectionBase.printerConnectionBase):
                                retract_amount = profile.getProfileSettingFloat('retraction_amount')
                                # Set E relative positioning
                                self.sendCommand("M83")
-                               
+
                                #Prime the nozzle when changing filament
-                               self.sendCommand("G1 E%f F120\n" % (retract_amount)) #Push the filament out
-                               self.sendCommand("G1 E-%f F120\n" % (retract_amount)) #retract again
+                               self.sendCommand("G1 E%f F120" % (retract_amount)) #Push the filament out
+                               self.sendCommand("G1 E-%f F120" % (retract_amount)) #retract again
 
                                # Position the toolhead to the correct position again
-                               self.sendCommand("G1 X%f Y%f Z%f F%d\n" % self._pausePosition[0:4])
+                               self.sendCommand("G1 X%f Y%f Z%f F%d" % self._pausePosition[0:4])
 
                                # Prime the nozzle again
-                               self.sendCommand("G1 E%f F120\n" % (retract_amount))
+                               self.sendCommand("G1 E%f F120" % (retract_amount))
                                # Set proper feedrate
-                               self.sendCommand("G1 F%d\n" % (self._pausePosition[3]))
+                               self.sendCommand("G1 F%d" % (self._pausePosition[3]))
                                # Set E absolute position to cancel out any extrude/retract that occured
-                               self.sendCommand("G92 E%f\n" % (self._pausePosition[4]))
+                               self.sendCommand("G92 E%f" % (self._pausePosition[4]))
                                # Set E absolute positioning
-                               self.sendCommand("M82\n")
+                               self.sendCommand("M82")
                        self._process.stdin.write("RESUME\n")
                        self._pausePosition = None