Bed should no longer be damaged when leveling

CURA-1102
This commit is contained in:
Jaime van Kessel 2016-03-16 15:18:11 +01:00
parent 762f964221
commit 9a6615213c
2 changed files with 32 additions and 6 deletions

View file

@ -368,14 +368,28 @@ class PrinterConnection(OutputDevice, QObject, SignalEmitter):
Logger.log("d", "Setting bed temperature to %s", temperature) Logger.log("d", "Setting bed temperature to %s", temperature)
self._sendCommand("M140 S%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") @pyqtSlot("long", "long","long")
def moveHead(self, x, y, z): def moveHead(self, x, y, z):
Logger.log("d","Moving head to %s, %s , %s", 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() @pyqtSlot()
def homeHead(self): def homeHead(self):
self._sendCommand("G28") self._sendCommand("G28")
## Directly send the command, withouth checking connection state (eg; printing). ## Directly send the command, withouth checking connection state (eg; printing).
# \param cmd string with g-code # \param cmd string with g-code

View file

@ -19,7 +19,11 @@ Item
property int platform_height: UM.MachineManager.getSettingValue("machine_depth") property int platform_height: UM.MachineManager.getSettingValue("machine_depth")
anchors.fill: parent; anchors.fill: parent;
property variant printer_connection: UM.USBPrinterManager.connectedPrinterList.getItem(0).printer 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"} UM.I18nCatalog { id: catalog; name:"cura"}
property variant wizard: null; property variant wizard: null;
@ -79,15 +83,23 @@ Item
{ {
if(wizardPage.leveling_state == 0) 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) 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) 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++ wizardPage.leveling_state++
if (wizardPage.leveling_state >= 3){ if (wizardPage.leveling_state >= 3){