Ui tweaks
Minor optimization of temperature parsing
This commit is contained in:
parent
1e774b0321
commit
f27e5f92f0
@ -14,6 +14,8 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
ui->controlBox->setDisabled(true);
|
ui->controlBox->setDisabled(true);
|
||||||
ui->consoleGroup->setDisabled(true);
|
ui->consoleGroup->setDisabled(true);
|
||||||
ui->pauseBtn->setDisabled("true");
|
ui->pauseBtn->setDisabled("true");
|
||||||
|
ui->actionPrint_from_SD->setDisabled("true");
|
||||||
|
ui->actionSet_SD_printing_mode->setDisabled("true");
|
||||||
|
|
||||||
ui->baudbox->addItem(QString::number(4800));
|
ui->baudbox->addItem(QString::number(4800));
|
||||||
ui->baudbox->addItem(QString::number(9600));
|
ui->baudbox->addItem(QString::number(9600));
|
||||||
@ -210,6 +212,8 @@ void MainWindow::serialconnect()
|
|||||||
ui->progressBar->setValue(0);
|
ui->progressBar->setValue(0);
|
||||||
ui->controlBox->setDisabled(false);
|
ui->controlBox->setDisabled(false);
|
||||||
ui->consoleGroup->setDisabled(false);
|
ui->consoleGroup->setDisabled(false);
|
||||||
|
ui->actionPrint_from_SD->setEnabled("true");
|
||||||
|
ui->actionSet_SD_printing_mode->setEnabled("true");
|
||||||
if(checkingTemperature) injectCommand("M105");
|
if(checkingTemperature) injectCommand("M105");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -439,6 +443,7 @@ void MainWindow::readSerial()
|
|||||||
QFuture<double> parseSDThread = QtConcurrent::run(this, &MainWindow::parseSDStatus, data);
|
QFuture<double> parseSDThread = QtConcurrent::run(this, &MainWindow::parseSDStatus, data);
|
||||||
sdWatcher.setFuture(parseSDThread);
|
sdWatcher.setFuture(parseSDThread);
|
||||||
}
|
}
|
||||||
|
else if(sdprinting && data.startsWith("Not SD ")) sdprinting = false;
|
||||||
else if(data.contains("Begin file list"))
|
else if(data.contains("Begin file list"))
|
||||||
{
|
{
|
||||||
sdFiles.clear();
|
sdFiles.clear();
|
||||||
@ -616,6 +621,8 @@ void MainWindow::serialError(QSerialPort::SerialPortError error)
|
|||||||
ui->pauseBtn->setDisabled(true);
|
ui->pauseBtn->setDisabled(true);
|
||||||
ui->controlBox->setDisabled(true);
|
ui->controlBox->setDisabled(true);
|
||||||
ui->consoleGroup->setDisabled(true);
|
ui->consoleGroup->setDisabled(true);
|
||||||
|
ui->actionPrint_from_SD->setDisabled("true");
|
||||||
|
ui->actionSet_SD_printing_mode->setDisabled("true");
|
||||||
|
|
||||||
qDebug() << error;
|
qDebug() << error;
|
||||||
|
|
||||||
@ -658,21 +665,24 @@ void MainWindow::serialError(QSerialPort::SerialPortError error)
|
|||||||
|
|
||||||
TemperatureReadings MainWindow::parseStatus(QByteArray data)
|
TemperatureReadings MainWindow::parseStatus(QByteArray data)
|
||||||
{
|
{
|
||||||
QString extmp = "";
|
QString tmp;
|
||||||
QString btmp = "";
|
TemperatureReadings t;
|
||||||
|
|
||||||
for(int i = 2; data.at(i) != '/'; i++)
|
for(int i = 2; data.at(i) != '/'; i++)
|
||||||
{
|
{
|
||||||
extmp+=data.at(i);
|
tmp+=data.at(i);
|
||||||
}
|
|
||||||
for(int i = data.indexOf("B:")+2; data.at(i) != '/'; i++)
|
|
||||||
{
|
|
||||||
btmp+=data.at(i);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TemperatureReadings t;
|
t.e = tmp.toDouble();
|
||||||
t.e = extmp.toDouble();
|
|
||||||
t.b = btmp.toDouble();
|
tmp.clear();
|
||||||
|
|
||||||
|
for(int i = data.indexOf("B:")+2; data.at(i) != '/'; i++)
|
||||||
|
{
|
||||||
|
tmp+=data.at(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
t.b = tmp.toDouble();
|
||||||
|
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
@ -758,3 +768,9 @@ void MainWindow::on_estepspin_valueChanged(const QString &arg1)
|
|||||||
else if(arg1.toFloat() >=10) ui->estepspin->setSingleStep(10);
|
else if(arg1.toFloat() >=10) ui->estepspin->setSingleStep(10);
|
||||||
else if(arg1.toFloat() >= 1) ui->estepspin->setSingleStep(1);
|
else if(arg1.toFloat() >= 1) ui->estepspin->setSingleStep(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_actionSet_SD_printing_mode_triggered()
|
||||||
|
{
|
||||||
|
sdprinting = true;
|
||||||
|
ui->fileBox->setDisabled(false);
|
||||||
|
}
|
||||||
|
|||||||
@ -131,6 +131,8 @@ private slots:
|
|||||||
void serialError(QSerialPort::SerialPortError error);
|
void serialError(QSerialPort::SerialPortError error);
|
||||||
void on_actionPrint_from_SD_triggered();
|
void on_actionPrint_from_SD_triggered();
|
||||||
|
|
||||||
|
void on_actionSet_SD_printing_mode_triggered();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void sdReady();
|
void sdReady();
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1063,6 +1063,7 @@ STOP</string>
|
|||||||
<string>Tools</string>
|
<string>Tools</string>
|
||||||
</property>
|
</property>
|
||||||
<addaction name="actionPrint_from_SD"/>
|
<addaction name="actionPrint_from_SD"/>
|
||||||
|
<addaction name="actionSet_SD_printing_mode"/>
|
||||||
</widget>
|
</widget>
|
||||||
<addaction name="menuFile"/>
|
<addaction name="menuFile"/>
|
||||||
<addaction name="menuTools"/>
|
<addaction name="menuTools"/>
|
||||||
@ -1182,6 +1183,11 @@ STOP</string>
|
|||||||
<string>About Qt</string>
|
<string>About Qt</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionSet_SD_printing_mode">
|
||||||
|
<property name="text">
|
||||||
|
<string>Set SD printing mode</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11"/>
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
<resources>
|
<resources>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user