Fixes on serial connection

This commit is contained in:
NeoTheFox 2015-03-02 18:42:12 +03:00
parent f920b8cf34
commit 49e011ac85
3 changed files with 34 additions and 11 deletions

View File

@ -192,6 +192,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);
commandDone = true;
if(checkingTemperature) injectCommand("M105");
} }
} }
@ -352,10 +354,7 @@ void MainWindow::readSerial()
{ {
QByteArray data = printer.readLine(); QByteArray data = printer.readLine();
if(data.startsWith("ok") || data.startsWith("wait")) commandDone = true; //Can send next command if(data.startsWith("ok") || data.startsWith("wait")) commandDone = true; //Can send next command
else if(checkingTemperature && data.startsWith("T:")) //Parse temperature readings if any else if(checkingTemperature && data.startsWith("T:")) parseStatus(data); //Parse temperature readings if any
{
parseStatus(data);
}
else if(data.startsWith("Resend")) //Handle resend if requested else if(data.startsWith("Resend")) //Handle resend if requested
{ {
if(currentLine > 0) currentLine -= data.split(':')[1].toInt(); if(currentLine > 0) currentLine -= data.split(':')[1].toInt();
@ -571,3 +570,8 @@ void MainWindow::parseStatus(QByteArray data)
sinceLastTemp.restart(); sinceLastTemp.restart();
} }
void MainWindow::on_actionPrint_from_SD_triggered()
{
//TODO
}

View File

@ -98,6 +98,7 @@ private slots:
void on_releasebtn_clicked(); void on_releasebtn_clicked();
void on_actionAbout_triggered(); void on_actionAbout_triggered();
void serialError(QSerialPort::SerialPortError error); void serialError(QSerialPort::SerialPortError error);
void on_actionPrint_from_SD_triggered();
}; };
#endif // MAINWINDOW_H #endif // MAINWINDOW_H

View File

@ -129,13 +129,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="7" colspan="2">
<widget class="QPushButton" name="etmpoff">
<property name="text">
<string>OFF</string>
</property>
</widget>
</item>
<item row="6" column="5" colspan="2"> <item row="6" column="5" colspan="2">
<widget class="QPushButton" name="etmpset"> <widget class="QPushButton" name="etmpset">
<property name="text"> <property name="text">
@ -348,6 +341,13 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="6" column="7" colspan="2">
<widget class="QPushButton" name="etmpoff">
<property name="text">
<string>OFF</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
@ -539,7 +539,17 @@
</property> </property>
<addaction name="actionAbout"/> <addaction name="actionAbout"/>
</widget> </widget>
<widget class="QMenu" name="menuTools">
<property name="enabled">
<bool>false</bool>
</property>
<property name="title">
<string>Tools</string>
</property>
<addaction name="actionPrint_from_SD"/>
</widget>
<addaction name="menuFile"/> <addaction name="menuFile"/>
<addaction name="menuTools"/>
<addaction name="menuAbout"/> <addaction name="menuAbout"/>
</widget> </widget>
<widget class="QStatusBar" name="statusBar"/> <widget class="QStatusBar" name="statusBar"/>
@ -580,6 +590,14 @@
<string>About</string> <string>About</string>
</property> </property>
</action> </action>
<action name="actionPrint_from_SD">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Print from SD...</string>
</property>
</action>
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>
<resources> <resources>