Implemented flow control, speed control and emergency stop

This commit is contained in:
NeoTheFox 2015-03-04 15:21:02 +03:00
parent c68fc4dca5
commit 946bfb3d2c
3 changed files with 1086 additions and 520 deletions

View File

@ -111,14 +111,8 @@ void MainWindow::open()
gfile.setFileName(filename); gfile.setFileName(filename);
if(!recentFiles.contains(filename)) if(!recentFiles.contains(filename))
{ {
if(recentFiles.size() < 5) if(recentFiles.size() < 5) recentFiles.append(filename);
{ else recentFiles.push_front(filename);
recentFiles.append(filename);
}
else
{
recentFiles.push_front(filename);
}
} }
parseFile(gfile); parseFile(gfile);
@ -369,6 +363,45 @@ void MainWindow::bedcenter()
injectCommand(command); injectCommand(command);
} }
void MainWindow::on_speedslider_valueChanged(int value)
{
ui->speededit->setText(QString::number(value));
}
void MainWindow::on_speededit_textChanged(const QString &arg1)
{
if(arg1.toInt()) ui->speedslider->setValue(arg1.toInt());
else ui->speededit->setText(QString::number(ui->speedslider->value()));
}
void MainWindow::on_speedsetbtn_clicked()
{
QString command = "M220 S" + QString::number(ui->speedslider->value());
injectCommand(command);
}
void MainWindow::on_flowedit_textChanged(const QString &arg1)
{
if(arg1.toInt()) ui->flowslider->setValue(arg1.toInt());
else ui->flowedit->setText(QString::number(ui->flowslider->value()));
}
void MainWindow::on_flowslider_valueChanged(int value)
{
ui->flowedit->setText(QString::number(value));
}
void MainWindow::on_flowbutton_clicked()
{
QString command = "M221 S" + QString::number(ui->flowslider->value());
injectCommand(command);
}
void MainWindow::on_haltbtn_clicked()
{
if(sending && !paused)ui->pauseBtn->click();
injectCommand("M112");
}
//Buttons end //Buttons end
void MainWindow::readSerial() void MainWindow::readSerial()
@ -662,9 +695,14 @@ void MainWindow::on_actionPrint_from_SD_triggered()
injectCommand("M20"); injectCommand("M20");
} }
void MainWindow::on_actionAbout_Qt_triggered()
{
qApp->aboutQt();
}
void MainWindow::initSDprinting() void MainWindow::initSDprinting()
{ {
SDWindow sdwindow(sdFiles, this); SDWindow sdwindow(sdFiles, this); //Made it to 666 lines!
connect(&sdwindow, SIGNAL(fileSelected(QString)), this, SLOT(selectSDfile(QString))); connect(&sdwindow, SIGNAL(fileSelected(QString)), this, SLOT(selectSDfile(QString)));
@ -724,8 +762,3 @@ 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_actionAbout_Qt_triggered()
{
qApp->aboutQt();
}

View File

@ -114,6 +114,14 @@ private slots:
void on_btmpoff_clicked(); void on_btmpoff_clicked();
void on_sendBtn_clicked(); void on_sendBtn_clicked();
void on_pauseBtn_clicked(); void on_pauseBtn_clicked();
void on_haltbtn_clicked();
void on_actionAbout_Qt_triggered();
void on_speedslider_valueChanged(int value);
void on_speededit_textChanged(const QString &arg1);
void on_speedsetbtn_clicked();
void on_flowedit_textChanged(const QString &arg1);
void on_flowslider_valueChanged(int value);
void on_flowbutton_clicked();
void on_checktemp_stateChanged(int arg1); void on_checktemp_stateChanged(int arg1);
void on_actionSettings_triggered(); void on_actionSettings_triggered();
void on_stepspin_valueChanged(const QString &arg1); void on_stepspin_valueChanged(const QString &arg1);
@ -123,8 +131,6 @@ 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_actionAbout_Qt_triggered();
signals: signals:
void sdReady(); void sdReady();
}; };

File diff suppressed because it is too large Load Diff