59,8 → 59,18 |
{ |
setWindowTitle(QA_NAME + " v" + QA_VERSION); |
|
toolBar->addWidget(lb_Port); |
toolBar->addWidget(le_Port); |
toolBar->addSeparator(); |
toolBar->addWidget(cb_Hardware); |
|
lb_Status->setText("Hallo bei QMK-Groundstation...!!!"); |
|
tab_Main->removeTab(6); |
|
#ifdef _EEEPC_ |
toolBar->hide(); |
lb_Status->hide(); |
#endif |
|
resize(Settings->GUI.Size); |
147,6 → 157,7 |
connect(ac_StartPlotter, SIGNAL(triggered()), this, SLOT(slot_ac_StartPlotter())); |
connect(ac_MehrDaten, SIGNAL(triggered()), this, SLOT(slot_ac_MehrDaten())); |
connect(ac_About, SIGNAL(triggered()), this, SLOT(slot_ac_About())); |
connect(ac_KeineDaten, SIGNAL(triggered()), this, SLOT(slot_ac_KeineDaten())); |
connect(ac_GetLabels, SIGNAL(triggered()), this, SLOT(slot_ac_GetLabels())); |
|
// Tabs ein & ausblenden |
157,7 → 168,8 |
connect(ac_View4, SIGNAL(triggered()), this, SLOT(slot_ac_View())); |
connect(ac_View5, SIGNAL(triggered()), this, SLOT(slot_ac_View())); |
|
// connect(pb_Update, SIGNAL(clicked()), this, SLOT(slot_pb_Update())); |
connect(pb_Update, SIGNAL(clicked()), this, SLOT(slot_pb_Update())); |
connect(pb_HexFile, SIGNAL(clicked()), this, SLOT(slot_pb_HexFile())); |
|
connect(ac_ConnectTTY, SIGNAL(triggered()), this, SLOT(slot_OpenPort())); |
connect(ac_RecordCSV, SIGNAL(triggered()), this, SLOT(slot_RecordCSV())); |
253,7 → 265,7 |
|
Grid->attach(qwtPlot); |
|
qwtPlot->setAxisScale(QwtPlot::xBottom,0,PlotWide,0); |
qwtPlot->setAxisScale(QwtPlot::xBottom,0,Settings->Data.Plotter_Count,0); |
|
for (int a = 0; a < MaxAnalog; a++) |
{ |
388,6 → 400,7 |
{ |
dlg_Preferences *f_Preferences = new dlg_Preferences(this); |
|
Settings->TTY.Port = le_Port->text(); |
f_Preferences->set_Settings(Settings); |
|
if (f_Preferences->exec()==QDialog::Accepted) |
394,6 → 407,8 |
{ |
Settings = f_Preferences->get_Settings(); |
Settings->write_Settings(); |
le_Port->setText(Settings->TTY.Port); |
config_Plot(); |
} |
} |
|
453,14 → 468,41 |
|
void MKTool::slot_ac_MehrDaten() // DONE 0.71g |
{ |
if (ac_MehrDaten->isChecked()) |
if (!ac_KeineDaten->isChecked()) |
{ |
TX_Data[0] = 10; |
send_Data('d', ADDRESS_ALL, TX_Data, 1, false); } |
if (ac_MehrDaten->isChecked()) |
{ |
TX_Data[0] = Settings->Data.Debug_Fast / 10; |
send_Data('d', ADDRESS_ALL, TX_Data, 1, false); |
} |
else |
{ |
TX_Data[0] = Settings->Data.Debug_Slow / 10; |
send_Data('d', ADDRESS_ALL, TX_Data, 1, false); |
} |
} |
} |
|
void MKTool::slot_ac_KeineDaten() // DONE 0.71g |
{ |
if (ac_KeineDaten->isChecked()) |
{ |
TX_Data[0] = 0; |
send_Data('d', ADDRESS_ALL, TX_Data, 1, false); |
} |
else |
{ |
TX_Data[0] = 50; |
send_Data('d', ADDRESS_ALL, TX_Data, 1, false); } |
if (ac_MehrDaten->isChecked()) |
{ |
TX_Data[0] = Settings->Data.Debug_Fast / 10; |
send_Data('d', ADDRESS_ALL, TX_Data, 1, false); |
} |
else |
{ |
TX_Data[0] = Settings->Data.Debug_Slow / 10; |
send_Data('d', ADDRESS_ALL, TX_Data, 1, false); |
} |
} |
} |
|
void MKTool::slot_ac_About() |
484,15 → 526,15 |
Plot[a]->setData(aID,aData[a],NextPlot - 1); |
} |
|
if ((NextPlot > PlotWide)) |
if ((NextPlot > Settings->Data.Plotter_Count)) |
{ |
scroll_plot->setMaximum(NextPlot - PlotWide); |
scroll_plot->setMaximum(NextPlot - Settings->Data.Plotter_Count); |
} |
|
if ((scroll_plot->value() == NextPlot - (PlotWide + 1))) |
if ((scroll_plot->value() == NextPlot - (Settings->Data.Plotter_Count + 1))) |
{ |
qwtPlot->setAxisScale(QwtPlot::xBottom,NextPlot - PlotWide,NextPlot,0); |
scroll_plot->setValue(NextPlot - PlotWide); |
qwtPlot->setAxisScale(QwtPlot::xBottom,NextPlot - Settings->Data.Plotter_Count,NextPlot,0); |
scroll_plot->setValue(NextPlot - Settings->Data.Plotter_Count); |
} |
|
qwtPlot->replot(); |
500,6 → 542,9 |
|
void MKTool::config_Plot() |
{ |
// qDebug("Plotter rekonfiguriert..!!"); |
qwtPlot->setAxisScale(QwtPlot::xBottom,0,Settings->Data.Plotter_Count,0); |
|
for (int a = 0; a < MaxAnalog; a++) |
{ |
Plot[a]->detach(); |
511,11 → 556,12 |
Plot[a]->attach(qwtPlot); |
} |
} |
qwtPlot->replot(); |
} |
|
void MKTool::slot_ScrollPlot(int Pos) |
{ |
qwtPlot->setAxisScale(QwtPlot::xBottom,Pos,Pos + PlotWide,0); |
qwtPlot->setAxisScale(QwtPlot::xBottom,Pos,Pos + Settings->Data.Plotter_Count,0); |
qwtPlot->replot(); |
} |
|
524,38 → 570,74 |
/////////////////// |
void MKTool::slot_pb_Update() |
{ |
qDebug("Update"); |
|
if (serialPort->isOpen()) |
|
QString Message = "Firmeware-Datei \n\n"; |
Message = Message + le_HexFile->text() + "\n\n"; |
Message = Message + trUtf8("an FlightCtrl mit AVRDUDE - Seriel & Bootloader über ") + le_Port->text() + trUtf8(" übertragen?\n"); |
|
if (le_HexFile->text() == "") |
{ |
slot_OpenPort(); |
QMessageBox::warning(this, QA_NAME, trUtf8("Bitte Firmeware-Datei wählen."), QMessageBox::Ok); |
} |
else if (QMessageBox::warning(this, QA_NAME, Message, QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) |
{ |
QString Programm = "avrdude" ; |
QString Device = "m644"; |
|
Update = new QProcess(); |
QStringList Argumente; |
|
const QString Programm = "avrdude -p m644 -P /dev/ttyS0 -c butterfly -b 57600 -U flash:w:Flight-Ctrl_MEGA644_V0_71f.hex"; |
const QStringList Argumente = (QStringList() << "-?"); |
Update = new QProcess(); |
|
te_Shell->setText(""); // Ausgabefenster säubern |
Update->start(Programm); // Programmaufruf |
// Update.waitForFinished(); // auf Rückmeldung warten |
// Update.close(); // Kanal schließen |
connect(Update, SIGNAL(readyReadStandardOutput()), this, SLOT(slot_UpdateShell()) ); |
if (serialPort->isOpen()) |
{ |
slot_OpenPort(); |
} |
|
Argumente << "-P"; |
Argumente << le_Port->text(); |
Argumente << "-p"; |
Argumente << Device; |
Argumente << "-c"; |
Argumente << "butterfly"; |
Argumente << "-b"; |
Argumente << "57600"; |
Argumente << "-U"; |
Argumente << "flash:w:" + le_HexFile->text(); |
|
// QString Programm = "/home/Manuel/bin/avrdude -p m644 -P /dev/ttyS0 -c butterfly -b 57600 -U flash:w:/home/Manuel/Documents/Mikrokopter/Firmeware/FlightCtrl/Flight-Ctrl_MEGA644_V0_71h.hex"; |
|
te_Shell->setText(""); // Ausgabefenster säubern |
|
connect(Update, SIGNAL(readyReadStandardOutput()), this, SLOT(slot_UpdateShell()) ); |
connect(Update, SIGNAL(readyReadStandardError()), this, SLOT(slot_UpdateShell()) ); |
|
Update->start(Programm, Argumente); // Programmaufruf |
} |
} |
|
void MKTool::slot_UpdateShell() |
{ |
QByteArray Output; |
// te_Shell->setText(""); // Ausgabefenster säubern |
Output = Update->readAllStandardOutput(); // Shellausgabe an Variable |
|
Output = Update->readAllStandardError(); // Shellausgabe an Variable |
te_Shell->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor); |
te_Shell->insertPlainText(QString::fromUtf8(Output)); |
|
te_Shell->setText(QString::fromUtf8(Output)); // ...und endlich: Ausgabe im QLabel |
qDebug("Shell"); |
Output = Update->readAll(); |
te_Shell->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor); |
te_Shell->insertPlainText(QString::fromUtf8(Output)); |
} |
|
void MKTool::slot_pb_HexFile() |
{ |
QString FileName = QFileDialog::getOpenFileName(this,trUtf8(("Firmeware-Datei wählen")),"", |
tr("Intel Hex(*.hex);;Alle Dateien (*)")); |
if (!FileName.isEmpty()) |
{ |
le_HexFile->setText(FileName); |
} |
} |
|
// Settings-Bereich |
/////////////////// |
812,7 → 894,7 |
return Combo->currentText().toInt(); |
} |
|
void MKTool::store_ParameterSet(int Set) // DONE 0.71g |
void MKTool::store_ParameterSet(int Set) // DONE 0.71h |
{ |
char *Name = le_SetName->text().toLatin1().data(); |
|
948,9 → 1030,10 |
ParameterSet[Set][P_NAV_GPS_ACC] = get_Value(cb_12_8); |
|
//Seite 13 |
ParameterSet[Set][P_NAV_WIND_CORR] = get_Value(cb_13_1); |
ParameterSet[Set][P_NAV_SPEED_COMP] = get_Value(cb_13_2); |
ParameterSet[Set][P_NAV_RADIUS] = get_Value(cb_13_3); |
ParameterSet[Set][P_NAV_WIND_CORR] = get_Value(cb_13_1); |
ParameterSet[Set][P_NAV_SPEED_COMP] = get_Value(cb_13_2); |
ParameterSet[Set][P_NAV_RADIUS] = get_Value(cb_13_3); |
ParameterSet[Set][P_NAV_ANGLE_LIMIT] = get_Value(cb_13_4); |
} |
|
void MKTool::slot_SaveParameter() // DONE 0.71g |
1208,7 → 1291,7 |
} |
} |
|
void MKTool::show_ParameterSet(int Set) // DONE 0.71g |
void MKTool::show_ParameterSet(int Set) // DONE 0.71h |
{ |
char Name[12]; |
for (int a = 0; a < 12; a++) |
1376,6 → 1459,7 |
cb_13_1 = setCombo(cb_13_1, Set, P_NAV_WIND_CORR); |
cb_13_2 = setCombo(cb_13_2, Set, P_NAV_SPEED_COMP); |
cb_13_3 = setCombo(cb_13_3, Set, P_NAV_RADIUS); |
cb_13_4 = setCombo(cb_13_4, Set, P_NAV_ANGLE_LIMIT); |
} |
|
|
1479,6 → 1563,7 |
Settings->GUI.Term_Info = cb_ShowMSG->isChecked(); |
Settings->GUI.Term_Data = cb_ShowData->isChecked(); |
Settings->GUI.Term_Always = cb_ShowAlways->isChecked(); |
Settings->GUI.Term_Send = cb_ShowSend->isChecked(); |
|
Settings->TTY.Port = le_Port->text(); |
|
1666,7 → 1751,7 |
TX_Data[0] = Position; |
send_Data('a', ADDRESS_ALL, TX_Data, 1, false); |
} |
if (Position == 32) |
if (Position == 31) |
{ |
for (int a = 0; a < MaxAnalog; a++) |
{ |
1741,7 → 1826,7 |
"Serielles Protokoll Inkompatibel. \nBitte neue Programmversion installieren,", QMessageBox::Ok); |
} |
|
TX_Data[0] = 50; |
TX_Data[0] = Settings->Data.Debug_Slow / 10; |
send_Data('d', ADDRESS_ALL, TX_Data, 1, false); |
|
if (Mode.ID == ADDRESS_FC) |
1766,6 → 1851,7 |
|
if (Settings->Analog1.Version != Mode.Version) |
{ |
lb_Status->setText("Analoglabel-Version unterschiedlich. Lese Analoglabels neu aus."); |
slot_ac_GetLabels(); |
} |
else |
1803,7 → 1889,8 |
if ((cb_ShowData->isChecked()) && ((tab_Main->currentWidget()->objectName() == QString("Tab_3")) || (cb_ShowAlways->isChecked()))) |
{ |
te_RX->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor); |
te_RX->insertPlainText(RxData.String + '\r'); |
// te_RX->insertPlainText(" > " + RxData.String + '\r'); |
te_RX->insertHtml("<span style=\"color:#00008b;\">" + RxData.String + "<br /></span>"); |
} |
} |
else |
1811,7 → 1898,8 |
if ((cb_ShowMSG->isChecked()) && ((tab_Main->currentWidget()->objectName() == QString("Tab_3")) || (cb_ShowAlways->isChecked()))) |
{ |
te_RX->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor); |
te_RX->insertPlainText(RxData.String + '\r'); |
// te_RX->insertPlainText(" > " + RxData.String + '\r'); |
te_RX->insertHtml("<span style=\"color:#008b00;\">" + RxData.String + "<br /></span>"); |
} |
} |
RxData.String = QString(""); |
1895,6 → 1983,12 |
|
QByteArray Temp(TX_Data.toUtf8()); |
serialPort->sendData(Temp); |
|
if (cb_ShowSend->isChecked()) |
{ |
te_RX->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor); |
te_RX->insertHtml("<span style='color:#8b0000;'>" + TX_Data + "<br /></span>"); |
} |
} |
} |
|
1904,7 → 1998,7 |
|
MKTool::~MKTool() |
{ |
qDebug(" Programm Ende ..!! "); |
// qDebug(" Programm Ende ..!! "); |
if (serialPort->isOpen()) |
{ |
serialPort->close(); |