Added rudementary 3 point bed leveling

This commit is contained in:
Jaime van Kessel 2015-08-19 16:47:48 +02:00
parent 18497329db
commit 07c19498f1
2 changed files with 43 additions and 49 deletions

View file

@ -354,6 +354,15 @@ class PrinterConnection(OutputDevice, QObject, SignalEmitter):
def heatupBed(self, temperature): def heatupBed(self, temperature):
self._sendCommand("M140 S%s" % temperature) self._sendCommand("M140 S%s" % temperature)
@pyqtSlot("long", "long","long")
def moveHead(self, x, y, z):
print("Moving head" , x , " ", y , " " , z)
self._sendCommand("G0 X%s Y%s Z%s"%(x,y,z))
@pyqtSlot()
def homeHead(self):
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
def _sendCommand(self, cmd): def _sendCommand(self, cmd):

View file

@ -8,62 +8,47 @@ import QtQuick.Window 2.1
import UM 1.0 as UM import UM 1.0 as UM
ColumnLayout { Column
{
id: wizardPage id: wizardPage
property string title property int leveling_state: 0
property int pageWidth property bool three_point_leveling: true
property int pageHeight property int platform_width: UM.Models.settingsModel.getMachineSetting("machine_width")
property int platform_height: UM.Models.settingsModel.getMachineSetting("machine_depth")
anchors.fill: parent;
property variant printer_connection: UM.USBPrinterManager.connectedPrinterList.getItem(0).printer
Component.onCompleted: printer_connection.homeHead()
Label
{
text: UM.Models.settingsModel.getItem(UM.Models.settingsModel.find("key", "machine_width")).toString()
//Component.onCompleted:console.log(UM.Models.settingsModel.getMachineSetting("machine_width"))
}
Button
{
text: "Move to next position"
onClicked:
{
if(wizardPage.leveling_state == 0)
{
printer_connection.moveHead(platform_width /2 , platform_height,0)
}
if(wizardPage.leveling_state == 1)
{
printer_connection.moveHead(platform_width , 0,0)
}
if(wizardPage.leveling_state == 2)
{
printer_connection.moveHead(0, 0 ,0)
}
SystemPalette{id: palette} wizardPage.leveling_state++
//signal openFile(string fileName)
//signal closeWizard()
width: wizardPage.pageWidth
height: wizardPage.pageHeight
Connections {
target: elementRoot
onResize: {
wizardPage.width = pageWidth
wizardPage.height = pageHeight
} }
} }
Label { function threePointLeveling(width, height)
text: parent.title {
font.pointSize: 18;
} }
Label {
//: Add Printer wizard page description
text: qsTr("Please select the type of printer:");
}
ScrollView {
Layout.fillWidth: true;
ListView {
id: machineList;
model: UM.Models.availableMachinesModel
delegate: RadioButton {
exclusiveGroup: printerGroup;
text: model.name;
onClicked: {
ListView.view.currentIndex = index;
}
}
}
}
Label {
//: Add Printer wizard field label
text: qsTr("Printer Name:");
}
TextField { id: machineName; Layout.fillWidth: true; text: machineList.model.getItem(machineList.currentIndex).name }
Item { Layout.fillWidth: true; Layout.fillHeight: true; }
ExclusiveGroup { id: printerGroup; }
} }