diff --git a/plugins/USBPrinting/PrinterConnection.py b/plugins/USBPrinting/PrinterConnection.py index ffcd6d0d75..907cebc012 100644 --- a/plugins/USBPrinting/PrinterConnection.py +++ b/plugins/USBPrinting/PrinterConnection.py @@ -368,14 +368,28 @@ class PrinterConnection(OutputDevice, QObject, SignalEmitter): Logger.log("d", "Setting bed temperature to %s", temperature) self._sendCommand("M140 S%s" % temperature) + @pyqtSlot() + def setMoveToRelative(self): + self._sendCommand("G91") + + @pyqtSlot() + def setMoveToAbsolute(self): + self._sendCommand("G90") + @pyqtSlot("long", "long","long") def moveHead(self, x, y, z): Logger.log("d","Moving head to %s, %s , %s", x, y, z) - self._sendCommand("G0 X%s Y%s Z%s"%(x,y,z)) + self._sendCommand("G0 X%s Y%s Z%s F3000"%(x,y,z)) + + @pyqtSlot("long", "long","long") + def moveHeadRelative(self, x, y, z): + self.setMoveToRelative() + self.moveHead(x,y,z) + self.setMoveToAbsolute() @pyqtSlot() def homeHead(self): - self._sendCommand("G28") + self._sendCommand("G28") ## Directly send the command, withouth checking connection state (eg; printing). # \param cmd string with g-code diff --git a/resources/qml/WizardPages/Bedleveling.qml b/resources/qml/WizardPages/Bedleveling.qml index 105ee81f75..e601cd8436 100644 --- a/resources/qml/WizardPages/Bedleveling.qml +++ b/resources/qml/WizardPages/Bedleveling.qml @@ -19,7 +19,11 @@ Item property int platform_height: UM.MachineManager.getSettingValue("machine_depth") anchors.fill: parent; property variant printer_connection: UM.USBPrinterManager.connectedPrinterList.getItem(0).printer - Component.onCompleted: printer_connection.homeHead() + Component.onCompleted: + { + printer_connection. + printer_connection.homeHead() + } UM.I18nCatalog { id: catalog; name:"cura"} property variant wizard: null; @@ -79,15 +83,23 @@ Item { if(wizardPage.leveling_state == 0) { - printer_connection.moveHead(platform_width, 0 ,0) + printer_connection.moveHeadRelative(0, 0, 3) + printer_connection.homeHead() + printer_connection.moveHeadRelative(0, 0, 3) + printer_connection.moveHeadRelative(platform_width - 10, 0, 0) + printer_connection.moveHeadRelative(0, 0, -3) } if(wizardPage.leveling_state == 1) { - printer_connection.moveHead(platform_width/2, platform_height, 0) + printer_connection.moveHeadRelative(0, 0, 3) + printer_connection.moveHeadRelative(-platform_width/2, platform_height - 10, 0) + printer_connection.moveHeadRelative(0, 0, -3) } if(wizardPage.leveling_state == 2) { - printer_connection.moveHead(0, 0, 0) + printer_connection.moveHeadRelative(0, 0, 3) + printer_connection.moveHeadRelative(-platform_width/2 + 10, -(platform_height + 10), 0) + printer_connection.moveHeadRelative(0, 0, -3) } wizardPage.leveling_state++ if (wizardPage.leveling_state >= 3){