diff --git a/mainwindow.cpp b/mainwindow.cpp
index 8908e01..6c6eca3 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -315,6 +315,21 @@ void MainWindow::on_btmpoff_clicked()
{
sendLine("M140 S0");
}
+
+void MainWindow::bedcenter()
+{
+ int x, y;
+
+ if(settings.value("printer/bedx").toInt()) x = settings.value("printer/bedx").toInt();
+ else x = 200;
+
+ if(settings.value("printer/bedy").toInt()) y = settings.value("printer/bedy").toInt();
+ else y = 200;
+
+ QString command = "G1 X" + QString::number(x/2) + "Y" + QString::number(y/2);
+ sendLine(command);
+}
+
//Buttons end
void MainWindow::readSerial()
diff --git a/mainwindow.h b/mainwindow.h
index d2c905a..89329a0 100644
--- a/mainwindow.h
+++ b/mainwindow.h
@@ -75,6 +75,7 @@ private slots:
void zhome();
void ezero();
void homeall();
+ void bedcenter();
void on_sendbtn_clicked();
void on_fanonbtn_clicked();
void on_fanoffbtn_clicked();
diff --git a/mainwindow.ui b/mainwindow.ui
index b6be493..9ec94a7 100644
--- a/mainwindow.ui
+++ b/mainwindow.ui
@@ -10,6 +10,12 @@
498
+
+
+ 0
+ 0
+
+
RepRaptor
@@ -673,8 +679,8 @@
yminus()
- 292
- 146
+ 274
+ 145
383
@@ -689,7 +695,7 @@
yplus()
- 292
+ 274
88
@@ -705,7 +711,7 @@
xminus()
- 256
+ 236
120
@@ -737,8 +743,8 @@
zminus()
- 362
- 156
+ 353
+ 153
209
@@ -826,6 +832,22 @@
+
+ centerbtn
+ clicked()
+ MainWindow
+ bedcenter()
+
+
+ 283
+ 114
+
+
+ 321
+ 40
+
+
+
open()
@@ -844,5 +866,6 @@
eminus()
ezero()
yhome()
+ bedcenter()
diff --git a/settingswindow.cpp b/settingswindow.cpp
index f1ece73..1877854 100644
--- a/settingswindow.cpp
+++ b/settingswindow.cpp
@@ -13,6 +13,12 @@ SettingsWindow::SettingsWindow(QWidget *parent) :
if(settings.value("core/statusinterval").toInt()) ui->statusbox->setValue(settings.value("core/statusinterval").toInt());
else ui->senderbox->setValue(3000);
+ if(settings.value("printer/bedx").toInt()) ui->bedxbox->setValue(settings.value("printer/bedx").toInt());
+ else ui->bedxbox->setValue(200);
+
+ if(settings.value("printer/bedy").toInt()) ui->bedybox->setValue(settings.value("printer/bedy").toInt());
+ else ui->bedybox->setValue(200);
+
}
SettingsWindow::~SettingsWindow()
@@ -24,4 +30,6 @@ void SettingsWindow::on_buttonBox_accepted()
{
settings.setValue("core/senderinterval", ui->senderbox->value());
settings.setValue("core/statusinterval", ui->statusbox->value());
+ settings.setValue("printer/bedy", ui->bedybox->value());
+ settings.setValue("printer/bedx", ui->bedxbox->value());
}
diff --git a/settingswindow.ui b/settingswindow.ui
index fbd25c3..f6030da 100644
--- a/settingswindow.ui
+++ b/settingswindow.ui
@@ -34,7 +34,7 @@
10
10
- 144
+ 201
96
@@ -86,6 +86,49 @@
+
+
+
+ 10
+ 110
+ 201
+ 66
+
+
+
+ Printer
+
+
+ -
+
+
+ X
+
+
+
+ -
+
+
+ 9999
+
+
+
+ -
+
+
+ Bed size
+
+
+
+ -
+
+
+ 9999
+
+
+
+
+