25,6 → 25,7 |
#include <QIcon> |
#include <QToolButton> |
#include <QSpinBox> |
#include <QAction> |
|
#include "mktool.h" |
#include "dlg_Config.h" |
42,7 → 43,6 |
Settings = new cSettings; |
|
init_Arrays(); |
init_Icons(); |
init_GUI(); |
|
init_Objects(); |
57,16 → 57,13 |
|
// Tab mit Debug-Elementen verbergen |
tab_Main->removeTab(5); |
// tab_Main->removeTab(2); |
|
// Settings-Tab hinzufügen. |
f_Settings = new wdg_Settings( this ); |
|
tab_Main->insertTab ( 2, f_Settings, "Parameter"); |
tab_Main->insertTab ( 2, f_Settings, "FC-Settings"); |
tab_Main->widget(2)->setObjectName("Tab_2"); |
|
// Develop - Nicht gebrauchte sachen abschalten. |
ac_StartServer->setVisible(false); |
box_Flugdaten->hide(); |
box_System->hide(); |
pb_SettingsReset->hide(); |
77,10 → 74,14 |
toolBar->addWidget(lb_Port); |
toolBar->addWidget(le_Port); |
toolBar->addSeparator(); |
// toolBar->addWidget(cb_Hardware); |
|
lb_Status->setText("Hallo bei QMK-Groundstation...!!!"); |
toolBar->addWidget(rb_SelFC); |
toolBar->addWidget(rb_SelNC); |
toolBar->addWidget(rb_SelMag); |
|
lb_Status->setText(tr("Hallo bei QMK-Groundstation...!!!")); |
|
|
#ifdef _EEEPC_ |
toolBar->hide(); |
lb_Status->hide(); |
94,16 → 95,19 |
showMaximized(); |
} |
|
// Analoglabels anzeigen |
for (int a = 0; a < MaxAnalog; a++) |
{ |
lb_Analog[a]->setText(Settings->Analog1.Label[a]); |
} |
|
// Kopie der Tabs anlegen |
for (int b = 0; b < 6; b++) |
{ |
TabWidgets[b] = tab_Main->widget(b); |
} |
|
// Ausgeblendete Tabs ausblenden |
for (int c = 0; c < 6; c++) |
{ |
if (Settings->GUI.TabViews[c] == false) |
137,7 → 141,7 |
void MKTool::init_Objects() |
{ |
// QTimer-Instanzen |
Ticker = new QTimer(this); |
Ticker = new QTimer(this); |
|
// Seriell-Port |
serialPort = new ManageSerialPort; |
145,17 → 149,31 |
// QFile-Instanz (Log-Datei) |
CSVFile = new QFile(""); |
|
// Senden erlauben (Warum auch immer) |
AllowSend = true; |
|
Server = new cServer(); |
|
if (Settings->Server.StartServer) |
{ |
ac_StartServer->setChecked(true); |
Server->start_Server(Settings->Server.Port.toInt(), Settings); |
} |
} |
|
void MKTool::init_Connections() |
{ |
connect(Dec, SIGNAL(clicked()), this, SLOT(slot_Test())); |
|
// Seriel-Port Empfang |
connect(serialPort, SIGNAL(newDataReceived(const QByteArray &)), this, SLOT(slot_newDataReceived(const QByteArray &))); |
|
// Serielle Verbundung öffnen / schließen |
connect(ac_ConnectTTY, SIGNAL(triggered()), this, SLOT(slot_OpenPort())); |
|
// Buttons Settings lesen / schreiben |
connect(f_Settings->pb_Read, SIGNAL(clicked()), this, SLOT(slot_GetParameter())); |
connect(f_Settings->pb_Write, SIGNAL(clicked()), this, SLOT(slot_SetParameter())); |
connect(f_Settings->pb_Read, SIGNAL(clicked()), this, SLOT(slot_GetFCSettings())); |
connect(f_Settings->pb_Write, SIGNAL(clicked()), this, SLOT(slot_SetFCSettings())); |
|
// LCD auf / ab |
connect(pb_LCDup, SIGNAL(clicked()), this, SLOT(slot_LCD_UP())); |
165,13 → 183,16 |
connect(ac_Config, SIGNAL(triggered()), this, SLOT(slot_ac_Config())); |
connect(ac_Preferences, SIGNAL(triggered()), this, SLOT(slot_ac_Preferences())); |
connect(ac_Motortest, SIGNAL(triggered()), this, SLOT(slot_ac_Motortest())); |
connect(ac_MehrDaten, SIGNAL(triggered()), this, SLOT(slot_ac_MehrDaten())); |
connect(ac_KeineDaten, SIGNAL(triggered()), this, SLOT(slot_ac_KeineDaten())); |
connect(ac_FastDebug, SIGNAL(triggered()), this, SLOT(slot_ac_FastDebug())); |
connect(ac_NoDebug, SIGNAL(triggered()), this, SLOT(slot_ac_NoDebug())); |
connect(ac_FastNavi, SIGNAL(triggered()), this, SLOT(slot_ac_FastNavi())); |
connect(ac_NoNavi, SIGNAL(triggered()), this, SLOT(slot_ac_NoNavi())); |
connect(ac_GetLabels, SIGNAL(triggered()), this, SLOT(slot_ac_GetLabels())); |
|
// Plotter starten / scrollen |
connect(scroll_plot, SIGNAL(valueChanged(int)), this, SLOT(slot_ScrollPlot(int))); |
connect(ac_StartPlotter, SIGNAL(triggered()), this, SLOT(slot_ac_StartPlotter())); |
connect(ac_StartServer, SIGNAL(triggered()), this, SLOT(slot_ac_StartServer())); |
|
// Tabs ein & ausblenden |
connect(ac_View0, SIGNAL(triggered()), this, SLOT(slot_ac_View())); |
181,13 → 202,18 |
connect(ac_View4, SIGNAL(triggered()), this, SLOT(slot_ac_View())); |
connect(ac_View5, SIGNAL(triggered()), this, SLOT(slot_ac_View())); |
|
connect(ac_SelNC, SIGNAL(triggered()), this, SLOT(slot_ac_Hardware())); |
connect(ac_SelFC, SIGNAL(triggered()), this, SLOT(slot_ac_Hardware())); |
connect(ac_SelMag, SIGNAL(triggered()), this, SLOT(slot_ac_Hardware())); |
|
connect(rb_SelNC, SIGNAL(clicked()), this, SLOT(slot_rb_Hardware())); |
connect(rb_SelFC, SIGNAL(clicked()), this, SLOT(slot_rb_Hardware())); |
connect(rb_SelMag, SIGNAL(clicked()), this, SLOT(slot_rb_Hardware())); |
|
// firmeware Updateen / flashen |
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())); |
|
// Serielle Verbundung öffnen / schließen |
connect(ac_ConnectTTY, SIGNAL(triggered()), this, SLOT(slot_OpenPort())); |
|
// CVS-Record starten / stoppen |
connect(ac_RecordCSV, SIGNAL(triggered()), this, SLOT(slot_RecordCSV())); |
|
195,7 → 221,7 |
connect(Ticker, SIGNAL(timeout()), SLOT(slot_Ticker())); |
|
// Seitenwechsel |
connect(tab_Main, SIGNAL(currentChanged(int)), this, SLOT(slot_TabChanged(int))); |
connect(tab_Main, SIGNAL(currentChanged(int)), this, SLOT(slot_TabChanged(int))); |
connect(f_Settings->tab_Par, SIGNAL(currentChanged(int)), this, SLOT(slot_TabChanged(int))); |
|
// About QMK & About-QT Dialog einfügen |
266,31 → 292,76 |
qwtPlot->replot(); |
} |
|
void MKTool::init_Icons() |
|
void MKTool::slot_Test() |
{ |
Icons[0].addPixmap(QPixmap(QString::fromUtf8(":/LED/Images/16X16/ledred.png")), QIcon::Normal, QIcon::Off); |
Icons[1].addPixmap(QPixmap(QString::fromUtf8(":/LED/Images/16X16/ledyellow.png")), QIcon::Normal, QIcon::Off); |
Icons[3].addPixmap(QPixmap(QString::fromUtf8(":/LED/Images/16X16/ledyellow.png")), QIcon::Normal, QIcon::Off); |
Icons[4].addPixmap(QPixmap(QString::fromUtf8(":/LED/Images/16X16/ledoff.png")), QIcon::Normal, QIcon::Off); |
sRxData RX; |
|
Icons[5].addPixmap(QPixmap(QString::fromUtf8(":/Actions/Images/22X22/application-exit.png")), QIcon::Normal, QIcon::Off); |
Icons[6].addPixmap(QPixmap(QString::fromUtf8(":/Actions/Images/22X22/media-playback-stop.png")), QIcon::Normal, QIcon::Off); |
Icons[7].addPixmap(QPixmap(QString::fromUtf8(":/Actions/Images/22X22/media-record.png")), QIcon::Normal, QIcon::Off); |
Icons[8].addPixmap(QPixmap(QString::fromUtf8(":/Actions/Images/22X22/network-connect.png")), QIcon::Normal, QIcon::Off); |
Icons[9].addPixmap(QPixmap(QString::fromUtf8(":/Actions/Images/22X22/network-disconnect.png")), QIcon::Normal, QIcon::Off); |
Icons[10].addPixmap(QPixmap(QString::fromUtf8(":/Actions/Images/22X22/utilities-system-monitor.png")), QIcon::Normal, QIcon::Off); |
RX.String = IN->text(); |
RX.Input = IN->text().toLatin1().data(); |
|
Icons[20].addPixmap(QPixmap(QString::fromUtf8(":/Arrows/Images/32X32/arrow-up-double.png")), QIcon::Normal, QIcon::Off); |
Icons[21].addPixmap(QPixmap(QString::fromUtf8(":/Arrows/Images/32X32/arrow-up.png")), QIcon::Normal, QIcon::Off); |
Icons[22].addPixmap(QPixmap(QString::fromUtf8(":/Arrows/Images/32X32/arrow-down-double.png")), QIcon::Normal, QIcon::Off); |
Icons[23].addPixmap(QPixmap(QString::fromUtf8(":/Arrows/Images/32X32/arrow-down.png")), QIcon::Normal, QIcon::Off); |
Icons[24].addPixmap(QPixmap(QString::fromUtf8(":/Arrows/Images/32X32/arrow-left-double.png")), QIcon::Normal, QIcon::Off); |
Icons[25].addPixmap(QPixmap(QString::fromUtf8(":/Arrows/Images/32X32/arrow-left.png")), QIcon::Normal, QIcon::Off); |
Icons[26].addPixmap(QPixmap(QString::fromUtf8(":/Arrows/Images/32X32/arrow-right-double.png")), QIcon::Normal, QIcon::Off); |
Icons[27].addPixmap(QPixmap(QString::fromUtf8(":/Arrows/Images/32X32/arrow-right.png")), QIcon::Normal, QIcon::Off); |
new_RXData(RX); |
} |
|
void MKTool::slot_ac_Hardware() |
{ |
QAction *Action = (QAction*)sender(); |
|
if (Action->isChecked() == false) |
{ |
Action->setChecked(true); |
} |
|
slot_rb_Hardware(); |
// qDebug("Select AC Hardware"); |
} |
|
void MKTool::slot_rb_Hardware() |
{ |
if ((rb_SelNC->isChecked() == false) && (Mode.ID != ADDRESS_NC)) |
{ |
lb_Status->setText(tr("Schalte um auf NaviCtrl.")); |
TX_Data[0] = 0x1B; |
TX_Data[1] = 0x1B; |
TX_Data[2] = 0x55; |
TX_Data[3] = 0xAA; |
TX_Data[4] = 0x00; |
TX_Data[5] = '\r'; |
send_Data('#', ADDRESS_NC, TX_Data, 6, false); |
usleep(Sleep); |
} |
|
if (rb_SelFC->isChecked()) |
{ |
lb_Status->setText(tr("Schalte um auf FlightCtrl.")); |
TX_Data[0] = 0; |
send_Data('u', ADDRESS_NC, TX_Data, 1, false); |
} |
else |
if (rb_SelMag->isChecked()) |
{ |
lb_Status->setText(tr("Schalte um auf MK3MAG.")); |
TX_Data[0] = 1; |
send_Data('u', ADDRESS_NC, TX_Data, 1, false); |
} |
else |
if (rb_SelNC->isChecked()) |
{ |
lb_Status->setText(tr("Schalte um auf NaviCtrl.")); |
TX_Data[0] = 0x1B; |
TX_Data[1] = 0x1B; |
TX_Data[2] = 0x55; |
TX_Data[3] = 0xAA; |
TX_Data[4] = 0x00; |
TX_Data[5] = '\r'; |
send_Data('#', ADDRESS_NC, TX_Data, 6, false); |
} |
usleep(Sleep); |
|
// qDebug("Select RB Hardware"); |
send_Data('v', ADDRESS_ALL, TX_Data, 0, true); |
} |
|
// Ticker-Event |
/////////////// |
void MKTool::slot_Ticker() |
326,7 → 397,7 |
} |
break; |
case 3 : |
if (ac_MehrDaten->isChecked()) |
if (ac_FastDebug->isChecked()) |
{ |
TX_Data[0] = Settings->Data.Debug_Fast / 10; |
send_Data('d', ADDRESS_ALL, TX_Data, 1, false); |
418,11 → 489,13 |
{ |
if (ac_StartPlotter->isChecked()) |
{ |
lb_Status->setText(tr("Datenplotter gestartet.")); |
ac_StartPlotter->setText("Stop Plotter"); |
pb_StartPlotter->setText("Stop Plotter"); |
} |
else |
{ |
lb_Status->setText(tr("Datenplotter gestopt.")); |
ac_StartPlotter->setText("Start Plotter"); |
pb_StartPlotter->setText("Start Plotter"); |
} |
468,30 → 541,72 |
} |
} |
|
void MKTool::slot_ac_MehrDaten() // DONE 0.71g |
void MKTool::slot_ac_FastNavi() // DONE NC 0.12i |
{ |
if (!ac_KeineDaten->isChecked()) |
if (!ac_NoNavi->isChecked()) |
{ |
if (ac_MehrDaten->isChecked()) |
if (ac_FastNavi->isChecked()) |
{ |
lb_Status->setText(tr("Fordere schnelle NaviDaten an.")); |
TX_Data[0] = Settings->Data.Navi_Fast / 10; |
} |
else |
{ |
lb_Status->setText(tr("Fordere langsame NaviDaten an.")); |
TX_Data[0] = Settings->Data.Navi_Slow / 10; |
} |
send_Data('o', ADDRESS_NC, TX_Data, 1, false); |
} |
} |
|
void MKTool::slot_ac_NoNavi() // DONE NC 0.12i |
{ |
if (ac_NoNavi->isChecked()) |
{ |
lb_Status->setText(tr("NaviDaten abstellen.")); |
TX_Data[0] = 0; |
} |
else |
{ |
if (ac_FastNavi->isChecked()) |
{ |
lb_Status->setText(tr("Fordere schnelle NaviDaten an.")); |
TX_Data[0] = Settings->Data.Navi_Fast / 10; |
} |
else |
{ |
lb_Status->setText(tr("Fordere langsame NaviDaten an.")); |
TX_Data[0] = Settings->Data.Navi_Slow / 10; |
} |
} |
send_Data('o', ADDRESS_NC, TX_Data, 1, false); |
} |
|
void MKTool::slot_ac_FastDebug() // DONE 0.71g |
{ |
if (!ac_NoDebug->isChecked()) |
{ |
if (ac_FastDebug->isChecked()) |
{ |
lb_Status->setText(tr("Fordere schnelle DebugDaten an.")); |
TX_Data[0] = Settings->Data.Debug_Fast / 10; |
send_Data('d', ADDRESS_ALL, TX_Data, 1, false); |
} |
else |
{ |
lb_Status->setText(tr("Fordere langsame DebugDaten an.")); |
TX_Data[0] = Settings->Data.Debug_Slow / 10; |
send_Data('d', ADDRESS_ALL, TX_Data, 1, false); |
} |
send_Data('d', ADDRESS_ALL, TX_Data, 1, false); |
} |
} |
|
void MKTool::slot_ac_KeineDaten() // DONE 0.71g |
void MKTool::slot_ac_NoDebug() // DONE 0.71g |
{ |
if (ac_KeineDaten->isChecked()) |
if (ac_NoDebug->isChecked()) |
{ |
lb_Status->setText(tr("DebugDaten abstellen.")); |
TickerEvent[3] = false; |
TX_Data[0] = 0; |
send_Data('d', ADDRESS_ALL, TX_Data, 1, false); |
} |
else |
{ |
499,17 → 614,18 |
if (Mode.ID == ADDRESS_MK3MAG) |
TickerEvent[3] = true; |
|
if (ac_MehrDaten->isChecked()) |
if (ac_FastDebug->isChecked()) |
{ |
lb_Status->setText(tr("Fordere schnelle DebugDaten an.")); |
TX_Data[0] = Settings->Data.Debug_Fast / 10; |
send_Data('d', ADDRESS_ALL, TX_Data, 1, false); |
} |
else |
{ |
lb_Status->setText(tr("Fordere langsame DebugDaten an.")); |
TX_Data[0] = Settings->Data.Debug_Slow / 10; |
send_Data('d', ADDRESS_ALL, TX_Data, 1, false); |
} |
} |
send_Data('d', ADDRESS_ALL, TX_Data, 1, false); |
} |
|
void MKTool::slot_ac_About() |
519,10 → 635,24 |
|
void MKTool::slot_ac_GetLabels() // DONE 0.71g |
{ |
lb_Status->setText(tr("Analoglabels auslesen.")); |
TX_Data[0] = 0; |
send_Data('a', ADDRESS_ALL, TX_Data, 1, true); |
} |
|
void MKTool::slot_ac_StartServer() |
{ |
if (ac_StartServer->isChecked()) |
{ |
lb_Status->setText(tr("GoogleEarth-Server gestartet.")); |
Server->start_Server(Settings->Server.Port.toInt(), Settings); |
} |
else |
{ |
lb_Status->setText(tr("GoogleEarth-Server gestopt.")); |
Server->stop_Server(); |
} |
} |
|
// Daten-Plotter |
///////////////// |
724,32 → 854,20 |
} |
|
// Settings aus MK lesen / in MK schreiben |
void MKTool::slot_GetParameter() // DONE 0.71g |
void MKTool::slot_GetFCSettings() // DONE 0.71g |
{ |
lb_Status->setText(tr("Lese FlightCtrl-Settings aus.")); |
TX_Data[0] = f_Settings->sb_Set->value(); |
TX_Data[1] = 0; |
send_Data('q', ADDRESS_FC, TX_Data, 1); |
} |
|
void MKTool::slot_SetParameter() // DONE 0.71g |
void MKTool::slot_SetFCSettings() // DONE 0.71g |
{ |
// store_ParameterSet(sb_Set->value()); |
/* |
char *TX_Data2 = f_Settings->GetFCSettings(); |
|
lb_Status->setText(tr("Schreibe FlightCtrl-Settings.")); |
|
TX_Data[0] = sb_Set->value(); |
TX_Data[1] = VERSION_SETTINGS; |
|
for (int a = 0; a < MaxParameter; a++) |
{ |
TX_Data[a + 2] = ParameterSet[sb_Set->value()][a]; |
} |
|
// store_ParameterSet(sb_Set->value()); |
*/ |
|
char *TX_Data2 = f_Settings->SetParameter(); |
|
send_Data('s', ADDRESS_FC, TX_Data2, MaxParameter + 2, false); |
} |
|
797,7 → 915,7 |
void MKTool::slot_RecordCSV() // DONE 0.71g |
{ |
if (!CSVFile->isOpen()) |
{ |
{ |
QString Filename = Settings->DIR.Logging + Mode.Hardware + " - " + QDate::currentDate().toString(("yyyy-MM-dd")) + " -- " + QTime::currentTime().toString("hh-mm") + ".csv"; |
|
CSVFile = new QFile(Filename); |
824,18 → 942,20 |
CSVFile->open(QIODevice::Append | QIODevice::Text); |
} |
|
pb_Record->setIcon(Icons[6]); |
pb_Record->setIcon(ToolBox::Icon(6)); |
pb_Record->setText("CSV Stop"); |
ac_RecordCSV->setIcon(Icons[6]); |
ac_RecordCSV->setIcon(ToolBox::Icon(6)); |
ac_RecordCSV->setText("CSV Stop"); |
lb_Status->setText(tr("CVS-Record gestartet.")); |
} |
else |
{ |
CSVFile->close(); |
pb_Record->setIcon(Icons[7]); |
pb_Record->setIcon(ToolBox::Icon(7)); |
pb_Record->setText("CSV Aufzeichnen"); |
ac_RecordCSV->setIcon(Icons[7]); |
ac_RecordCSV->setIcon(ToolBox::Icon(7)); |
ac_RecordCSV->setText("CSV Aufzeichnen"); |
lb_Status->setText(tr("CVS-Record gestopt.")); |
} |
} |
|
895,6 → 1015,30 |
} |
|
|
void MKTool::new_NaviData(sRxData RX) |
{ |
Navi.Current.Longitude = ToolBox::Data2Long(RX.Decode, 0, true); |
Navi.Current.Latitude = ToolBox::Data2Long(RX.Decode, 4, true); |
Navi.Current.Altitude = ToolBox::Data2Long(RX.Decode, 8, true); |
Navi.Target.Longitude = ToolBox::Data2Long(RX.Decode, 10, true); |
Navi.Target.Latitude = ToolBox::Data2Long(RX.Decode, 14, true); |
Navi.Target.Altitude = ToolBox::Data2Long(RX.Decode, 18, true); |
|
sNaviString NaviString; |
|
NaviString.Longitude = ToolBox::get_Float(Navi.Current.Longitude,10000000); |
NaviString.Latitude = ToolBox::get_Float(Navi.Current.Latitude,10000000); |
NaviString.Altitude = ToolBox::get_Float(Navi.Current.Altitude,1000); |
|
Server->store_NaviString(NaviString); |
|
/* |
qDebug(NaviString.Longitude.toLatin1().data()); |
qDebug(NaviString.Latitude.toLatin1().data()); |
qDebug(NaviString.Altitude.toLatin1().data()); |
*/ |
} |
|
// Seriel-Port Bereich, Befehle senden und Daten empfangen |
////////////////////////////////////////////////////////// |
|
938,10 → 1082,12 |
int Settings_ID = RX.Decode[0]; |
for (int a = 0; a < MaxParameter; a++) |
{ |
ParameterSet[Settings_ID][a] = RX.Decode[a + 2]; |
FCSettings[a] = RX.Decode[a + 2]; |
} |
//show_ParameterSet(Settings_ID); |
f_Settings->show_ParameterSet(Settings_ID, ParameterSet); |
f_Settings->show_FCSettings(Settings_ID, FCSettings); |
f_Settings->pb_Read->setEnabled(true); |
f_Settings->pb_Write->setEnabled(true); |
} |
else |
{ |
966,6 → 1112,7 |
case 'O' : // NOT DONE 0.12h |
if (ToolBox::Decode64(RX)) |
{ |
new_NaviData(RX); |
} |
break; |
} |
1056,18 → 1203,56 |
"Serielles Protokoll Inkompatibel. \nBitte neue Programmversion installieren,", QMessageBox::Ok); |
} |
|
if (ac_NoDebug->isChecked()) |
{ |
TX_Data[0] = 0; |
} |
else |
if (ac_FastDebug->isChecked()) |
{ |
TX_Data[0] = Settings->Data.Debug_Fast / 10; |
} |
else |
{ |
TX_Data[0] = Settings->Data.Debug_Slow / 10; |
} |
|
send_Data('d', ADDRESS_ALL, TX_Data, 1, false); |
|
// Wenn MK3MAG dann andauernd Daten neu anfragen. |
if (Mode.ID == ADDRESS_MK3MAG) |
{ |
TickerEvent[3] = true; |
rb_SelMag->setChecked(true); |
} |
|
TX_Data[0] = Settings->Data.Debug_Slow / 10; |
send_Data('d', ADDRESS_ALL, TX_Data, 1, false); |
// Wenn NaviCtrl dann hier. |
if (Mode.ID == ADDRESS_NC) |
{ |
rb_SelNC->setChecked(true); |
|
if (ac_NoNavi->isChecked()) |
{ |
TX_Data[0] = 0; |
} |
else |
if (ac_FastNavi->isChecked()) |
{ |
TX_Data[0] = Settings->Data.Navi_Fast / 10; |
} |
else |
{ |
TX_Data[0] = Settings->Data.Navi_Slow / 10; |
} |
|
send_Data('o', ADDRESS_NC, TX_Data, 1, false); |
} |
|
|
// Wenn FlightCtrl dann Settings abfragen. |
if (Mode.ID == ADDRESS_FC) |
{ |
rb_SelFC->setChecked(true); |
{ |
TX_Data[0] = 0xff; |
TX_Data[1] = 0; |
1155,18 → 1340,34 |
{ |
if (serialPort->isOpen()) |
{ |
TX_Data[0] = 0; |
TX_Data[1] = 0; |
TX_Data[2] = 0; |
TX_Data[3] = 0; |
send_Data('t', ADDRESS_FC, TX_Data, 4, false); |
TX_Data[0] = Settings->Data.Debug_Off / 10; |
send_Data('d', ADDRESS_ALL, TX_Data, 1, false); |
usleep(Sleep); |
|
if (Mode.ID == ADDRESS_NC) |
{ |
TX_Data[0] = Settings->Data.Navi_Off / 10; |
send_Data('o', ADDRESS_NC, TX_Data, 1, false); |
usleep(Sleep); |
} |
|
if (Mode.ID == ADDRESS_NC) |
{ |
TX_Data[0] = 0; |
TX_Data[1] = 0; |
TX_Data[2] = 0; |
TX_Data[3] = 0; |
send_Data('t', ADDRESS_FC, TX_Data, 4, false); |
usleep(Sleep); |
} |
serialPort->close(); |
pb_Open->setText("Verbinden"); |
ac_ConnectTTY->setText("Verbinden"); |
pb_Open->setIcon(Icons[9]); |
ac_ConnectTTY->setIcon(Icons[9]); |
pb_Open->setIcon(ToolBox::Icon(9)); |
ac_ConnectTTY->setIcon(ToolBox::Icon(9)); |
|
le_Port->setEnabled(true); |
|
Ticker->stop(); |
} |
else |
1186,6 → 1387,7 |
serialPort->open(); |
if (serialPort->isOpen()) |
{ |
le_Port->setEnabled(false); |
serialPort->receiveData(); |
|
send_Data('v', ADDRESS_ALL, TX_Data, 0, true); |
1192,8 → 1394,8 |
|
pb_Open->setText("Trennen"); |
ac_ConnectTTY->setText("Trennen"); |
pb_Open->setIcon(Icons[8]); |
ac_ConnectTTY->setIcon(Icons[8]); |
pb_Open->setIcon(ToolBox::Icon(8)); |
ac_ConnectTTY->setIcon(ToolBox::Icon(8)); |
|
Ticker->start(2000); |
} |
1205,26 → 1407,42 |
{ |
if (serialPort->isOpen() && AllowSend) |
{ |
QString TX_Data = ToolBox::Encode64(Data, Length); |
QByteArray Temp; |
QString TX_Data; |
|
TX_Data = QString("#") + (QString('a' + Address)) + QString(CMD) + TX_Data; |
if (CMD != '#') |
{ |
// qDebug("Send data.."); |
TX_Data = ToolBox::Encode64(Data, Length); |
|
TX_Data = QString("#") + (QString('a' + Address)) + QString(CMD) + TX_Data; |
|
// qDebug(TX_Data.toLatin1().data()); |
|
TX_Data = ToolBox::add_CRC(TX_Data) + '\r'; |
TX_Data = ToolBox::add_CRC(TX_Data) + '\r'; |
|
// qDebug(TX_Data.toLatin1().data()); |
|
if (Resend) |
if (Resend) |
{ |
LastSend = TX_Data; |
TickerEvent[0] = true; |
} |
Temp = QByteArray(TX_Data.toUtf8()); |
} |
else |
{ |
LastSend = TX_Data; |
TickerEvent[0] = true; |
// qDebug("Send Raw.."); |
for (unsigned int a = 0; a < Length; a++) |
{ |
Temp[a] = Data[a]; |
// qDebug(QString("%1").arg(Temp[a]).toLatin1().data()); |
} |
} |
|
QByteArray Temp(TX_Data.toUtf8()); |
serialPort->sendData(Temp); |
|
if (cb_ShowSend->isChecked()) |
if (cb_ShowSend->isChecked() && (CMD != '#')) |
{ |
te_RX->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor); |
te_RX->insertHtml("<span style='color:#8b0000;'>" + TX_Data + "<br /></span>"); |