Echo on/off
Protocol perfomance tweaks
This commit is contained in:
parent
caf9a47fb9
commit
983aed1916
@ -34,15 +34,18 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
checkingTemperature = settings.value("core/checktemperature").toBool();
|
||||
ui->checktemp->setChecked(checkingTemperature);
|
||||
|
||||
if(!firstrun) echo = settings.value("core/echo").toBool();
|
||||
else echo = false;
|
||||
|
||||
sending = false;
|
||||
paused = false;
|
||||
commandDone = false;
|
||||
injectingCommand = false;
|
||||
readingFiles = false;
|
||||
sdprinting = false;
|
||||
sdBytes = 0;
|
||||
userCommand = "";
|
||||
currentLine = 0;
|
||||
readyRecieve = 0;
|
||||
|
||||
serialupdate();
|
||||
|
||||
@ -143,13 +146,10 @@ bool MainWindow::sendLine(QString line)
|
||||
{
|
||||
if(printer.write(line.toUtf8()+'\n'))
|
||||
{
|
||||
printMsg(line + '\n');
|
||||
if(echo) printMsg(line + '\n');
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
else return false;
|
||||
|
||||
@ -208,7 +208,6 @@ void MainWindow::serialconnect()
|
||||
ui->progressBar->setValue(0);
|
||||
ui->controlBox->setDisabled(false);
|
||||
ui->consoleGroup->setDisabled(false);
|
||||
commandDone = true;
|
||||
if(checkingTemperature) injectCommand("M105");
|
||||
}
|
||||
}
|
||||
@ -380,7 +379,8 @@ void MainWindow::readSerial()
|
||||
}
|
||||
}
|
||||
|
||||
if(data.startsWith("ok") || data.startsWith("wait")) commandDone = true; //Can send next command
|
||||
if(data.startsWith("ok")) readyRecieve++;
|
||||
else if(data.startsWith("wait")) readyRecieve = 1;
|
||||
else if(checkingTemperature && data.startsWith("T:"))
|
||||
{
|
||||
QFuture<TemperatureReadings> parseThread = QtConcurrent::run(this, &MainWindow::parseStatus, data);
|
||||
@ -393,7 +393,7 @@ void MainWindow::readSerial()
|
||||
if(currentLine < 0) currentLine = 0;
|
||||
}
|
||||
else if(data.startsWith("Done")) sdprinting = false;
|
||||
else if(data.startsWith("SD printing byte"))
|
||||
else if(data.startsWith("SD printing byte") && sdWatcher.isFinished())
|
||||
{
|
||||
QFuture<double> parseSDThread = QtConcurrent::run(this, &MainWindow::parseSDStatus, data);
|
||||
sdWatcher.setFuture(parseSDThread);
|
||||
@ -465,14 +465,14 @@ void MainWindow::on_sendBtn_clicked()
|
||||
|
||||
void MainWindow::sendNext()
|
||||
{
|
||||
if(injectingCommand && printer.isWritable() && commandDone)
|
||||
if(injectingCommand && printer.isWritable() && readyRecieve > 0)
|
||||
{
|
||||
sendLine(userCommand);
|
||||
commandDone=false;
|
||||
readyRecieve--;
|
||||
injectingCommand=false;
|
||||
return;
|
||||
}
|
||||
else if(sending && !paused && commandDone && !sdprinting && printer.isWritable())
|
||||
else if(sending && !paused && readyRecieve > 0 && !sdprinting && printer.isWritable())
|
||||
{
|
||||
if(currentLine >= gcode.size()) //check if we are at the end of array
|
||||
{
|
||||
@ -485,7 +485,7 @@ void MainWindow::sendNext()
|
||||
}
|
||||
sendLine(gcode.at(currentLine));
|
||||
currentLine++;
|
||||
commandDone = false;
|
||||
readyRecieve--;
|
||||
|
||||
ui->filelines->setText(QString::number(gcode.size()) + QString("/") + QString::number(currentLine) + QString(" Lines"));
|
||||
ui->progressBar->setValue(((float)currentLine/gcode.size()) * 100);
|
||||
|
||||
@ -58,12 +58,13 @@ private:
|
||||
bool firstrun;
|
||||
bool sending;
|
||||
bool paused;
|
||||
bool commandDone;
|
||||
bool checkingTemperature;
|
||||
bool injectingCommand;
|
||||
bool readingFiles;
|
||||
bool sdprinting;
|
||||
bool echo;
|
||||
int currentLine;
|
||||
int readyRecieve;
|
||||
double sdBytes;
|
||||
QString userCommand;
|
||||
|
||||
|
||||
@ -10,6 +10,9 @@ SettingsWindow::SettingsWindow(QWidget *parent) :
|
||||
if(!settings.value("core/firstrun").toBool()) ui->senderbox->setValue(4);
|
||||
else ui->senderbox->setValue(settings.value("core/senderinterval").toFloat());
|
||||
|
||||
if(!settings.value("core/firstrun").toBool()) ui->echobox->setChecked(false);
|
||||
else ui->echobox->setChecked(settings.value("core/echo").toBool());
|
||||
|
||||
if(settings.value("core/statusinterval").toInt()) ui->statusbox->setValue(settings.value("core/statusinterval").toInt());
|
||||
else ui->statusbox->setValue(1500);
|
||||
|
||||
@ -32,4 +35,5 @@ void SettingsWindow::on_buttonBox_accepted()
|
||||
settings.setValue("core/statusinterval", ui->statusbox->value());
|
||||
settings.setValue("printer/bedy", ui->bedybox->value());
|
||||
settings.setValue("printer/bedx", ui->bedxbox->value());
|
||||
settings.setValue("core/echo", ui->echobox->isChecked());
|
||||
}
|
||||
|
||||
@ -29,17 +29,17 @@
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="intervalsGroup">
|
||||
<widget class="QGroupBox" name="internalGroup">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>201</width>
|
||||
<height>96</height>
|
||||
<width>171</width>
|
||||
<height>123</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Intervals</string>
|
||||
<string>Internal</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
@ -49,6 +49,28 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QDoubleSpinBox" name="senderbox">
|
||||
<property name="toolTip">
|
||||
<string>A good default is 2, lower = fater, higher = less CPU load. 0 would execute as soon as possible.</string>
|
||||
</property>
|
||||
<property name="toolTipDuration">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
<property name="locale">
|
||||
<locale language="English" country="UnitedStates"/>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>999.990000000000009</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
@ -86,25 +108,10 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QDoubleSpinBox" name="senderbox">
|
||||
<property name="toolTip">
|
||||
<string>A good default is 2, lower = fater, higher = less CPU load. 0 would execute as soon as possible.</string>
|
||||
</property>
|
||||
<property name="toolTipDuration">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
<property name="locale">
|
||||
<locale language="English" country="UnitedStates"/>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>999.990000000000009</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
<item row="2" column="0" colspan="3">
|
||||
<widget class="QCheckBox" name="echobox">
|
||||
<property name="text">
|
||||
<string>Echo commands</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -114,7 +121,7 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>110</y>
|
||||
<y>130</y>
|
||||
<width>201</width>
|
||||
<height>66</height>
|
||||
</rect>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user