diff --git a/mainwindow.cpp b/mainwindow.cpp index 4cbd915..21f60f5 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -29,10 +29,12 @@ MainWindow::MainWindow(QWidget *parent) : ui->extruderlcd->setPalette(Qt::red); ui->bedlcd->setPalette(Qt::red); + checkingTemperature = settings.value("core/checktemperature").toBool(); + ui->checktemp->setChecked(checkingTemperature); + sending = false; paused = false; commandDone = false; - checkingTemperature = true; injectingCommand = false; userCommand = ""; currentLine = 0; @@ -63,6 +65,7 @@ MainWindow::~MainWindow() if(printer.isOpen()) printer.close(); settings.setValue("printer/baudrateIndex", ui->baudbox->currentIndex()); + settings.setValue("core/checktemperature", ui->checktemp->isChecked()); settings.beginWriteArray("user/recentfiles"); for(int i = 0; i < recentFiles.size(); i++) @@ -349,23 +352,9 @@ void MainWindow::readSerial() { QByteArray data = printer.readLine(); if(data.startsWith("ok") || data.startsWith("wait")) commandDone = true; //Can send next command - else if(data.startsWith("T:")) //Parse temperature readings if any + else if(checkingTemperature && data.startsWith("T:")) //Parse temperature readings if any { - QString extmp = ""; - QString btmp = ""; - - for(int i = 2; data.at(i) != '/'; i++) - { - extmp+=data.at(i); - } - for(int i = data.indexOf("B:")+2; data.at(i) != '/'; i++) - { - btmp+=data.at(i); - } - - ui->extruderlcd->display(extmp.toDouble()); - ui->bedlcd->display(btmp.toDouble()); - sinceLastTemp.restart(); + parseStatus(data); } else if(data.startsWith("Resend")) //Handle resend if requested { @@ -562,3 +551,23 @@ void MainWindow::serialError(QSerialPort::SerialPortError error) ErrorWindow errorwindow(this, errorMsg); errorwindow.exec(); } + +void MainWindow::parseStatus(QByteArray data) +{ + QString extmp = ""; + QString btmp = ""; + + for(int i = 2; data.at(i) != '/'; i++) + { + extmp+=data.at(i); + } + for(int i = data.indexOf("B:")+2; data.at(i) != '/'; i++) + { + btmp+=data.at(i); + } + + ui->extruderlcd->display(extmp.toDouble()); + ui->bedlcd->display(btmp.toDouble()); + sinceLastTemp.restart(); +} + diff --git a/mainwindow.h b/mainwindow.h index f3fb625..6715b4c 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -66,6 +66,7 @@ private slots: void checkStatus(); void updateRecent(); void injectCommand(QString command); + void parseStatus(QByteArray data); void xplus(); void yplus(); diff --git a/mainwindow.ui b/mainwindow.ui index 5218039..cbdf684 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -122,7 +122,7 @@ - 1.000000000000000 + 0.100000000000000 150.000000000000000 diff --git a/settingswindow.cpp b/settingswindow.cpp index 306f593..8a5c333 100644 --- a/settingswindow.cpp +++ b/settingswindow.cpp @@ -7,8 +7,7 @@ SettingsWindow::SettingsWindow(QWidget *parent) : { ui->setupUi(this); - if(settings.value("core/senderinterval").toFloat()) ui->senderbox->setValue(settings.value("core/senderinterval").toFloat()); - else ui->senderbox->setValue(1); + ui->senderbox->setValue(settings.value("core/senderinterval").toFloat()); if(settings.value("core/statusinterval").toInt()) ui->statusbox->setValue(settings.value("core/statusinterval").toInt()); else ui->senderbox->setValue(3000); diff --git a/settingswindow.ui b/settingswindow.ui index 52ad279..c9624b7 100644 --- a/settingswindow.ui +++ b/settingswindow.ui @@ -89,7 +89,7 @@ - A good default is 2, lower = fater, higher = less CPU load + A good default is 2, lower = fater, higher = less CPU load. 0 would execute as soon as possible. -1 @@ -98,7 +98,7 @@ - 0.100000000000000 + 0.000000000000000 999.990000000000009