Rev 305 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 305 | Rev 306 | ||
---|---|---|---|
Line 45... | Line 45... | ||
45 | 45 | ||
Line 46... | Line 46... | ||
46 | Settings = new cSettings; |
46 | Settings = new cSettings; |
47 | 47 | ||
- | 48 | init_Arrays(); |
|
Line 48... | Line 49... | ||
48 | init_Arrays(); |
49 | init_GUI(); |
49 | init_GUI(); |
50 | init_Cockpit(); |
Line 50... | Line 51... | ||
50 | 51 | ||
Line 93... | Line 94... | ||
93 | lb_Status->hide(); |
94 | lb_Status->hide(); |
94 | #endif |
95 | #endif |
Line 95... | Line 96... | ||
95 | 96 | ||
Line 96... | Line -... | ||
96 | lb_Status->setText(tr("Hallo bei QMK-Groundstation...!!!")); |
- | |
97 | - | ||
98 | // Cockpit-Elemente |
- | |
99 | QPalette newPalette; |
- | |
100 | - | ||
101 | newPalette.setColor(QPalette::Base, Qt::darkBlue); |
- | |
102 | newPalette.setColor(QPalette::Foreground, QColor(Qt::darkBlue).dark(120)); |
- | |
103 | newPalette.setColor(QPalette::Text, Qt::white); |
- | |
104 | - | ||
105 | Compass->setScaleOptions(QwtDial::ScaleTicks | QwtDial::ScaleLabel); |
- | |
106 | Compass->setScaleTicks(0, 0, 3); |
- | |
107 | Compass->setScale(36, 5, 0); |
- | |
108 | - | ||
109 | Compass->setNeedle(new QwtDialSimpleNeedle(QwtDialSimpleNeedle::Arrow, true, Qt::red, QColor(Qt::gray).light(130))); |
- | |
110 | Compass->setPalette(newPalette); |
- | |
111 | Compass->setMaximumSize(QSize(MeterSize, MeterSize)); |
- | |
112 | Compass->setMinimumSize(QSize(MeterSize, MeterSize)); |
- | |
113 | - | ||
114 | QPalette newPalette1; |
- | |
115 | - | ||
116 | newPalette1.setColor(QPalette::Base, Qt::darkBlue); |
- | |
117 | newPalette1.setColor(QPalette::Foreground, QColor(255,128,0).dark(120)); |
- | |
118 | newPalette1.setColor(QPalette::Text, Qt::white); |
- | |
119 | - | ||
120 | Attitude = new AttitudeIndicator(this); |
- | |
121 | Attitude->setMaximumSize(QSize(MeterSize, MeterSize)); |
- | |
122 | Attitude->setMinimumSize(QSize(MeterSize, MeterSize)); |
- | |
123 | Attitude->setPalette(newPalette1); |
- | |
124 | - | ||
125 | verticalLayout->addWidget(Attitude); |
- | |
126 | - | ||
127 | qwt_Rate->setRange(-10.0, 10.0, 0.1, 0); |
- | |
128 | - | ||
129 | newPalette1.setColor(QPalette::Foreground, QColor(Qt::darkBlue).dark(120)); |
- | |
130 | - | ||
131 | SpeedMeter = new cSpeedMeter(this); |
- | |
132 | SpeedMeter->setMaximumSize(QSize(MeterSize, MeterSize)); |
- | |
133 | SpeedMeter->setMinimumSize(QSize(MeterSize, MeterSize)); |
- | |
134 | SpeedMeter->setPalette(newPalette1); |
- | |
135 | SpeedMeter->setRange(0.0, 5.0); |
- | |
136 | SpeedMeter->setScale(1, 2, 0.5); |
- | |
137 | SpeedMeter->setProperty("END", 5); |
- | |
138 | - | ||
139 | LayOut_Speed->addWidget(SpeedMeter); |
97 | lb_Status->setText(tr("Hallo bei QMK-Groundstation...!!!")); |
140 | 98 | ||
Line 141... | Line 99... | ||
141 | resize(Settings->GUI.Size); |
99 | resize(Settings->GUI.Size); |
142 | move(Settings->GUI.Point); |
100 | move(Settings->GUI.Point); |
Line 188... | Line 146... | ||
188 | cb_ShowMSG->setChecked(Settings->GUI.Term_Info); |
146 | cb_ShowMSG->setChecked(Settings->GUI.Term_Info); |
189 | cb_ShowData->setChecked(Settings->GUI.Term_Data); |
147 | cb_ShowData->setChecked(Settings->GUI.Term_Data); |
190 | cb_ShowAlways->setChecked(Settings->GUI.Term_Always); |
148 | cb_ShowAlways->setChecked(Settings->GUI.Term_Always); |
191 | } |
149 | } |
Line -... | Line 150... | ||
- | 150 | ||
- | 151 | void MKTool::init_Cockpit() |
|
- | 152 | { |
|
- | 153 | // Cockpit-Elemente |
|
- | 154 | QPalette newPalette; |
|
- | 155 | ||
- | 156 | newPalette.setColor(QPalette::Base, Qt::darkBlue); |
|
- | 157 | newPalette.setColor(QPalette::Foreground, QColor(Qt::darkBlue).dark(120)); |
|
- | 158 | newPalette.setColor(QPalette::Text, Qt::white); |
|
- | 159 | ||
- | 160 | Compass->setScaleOptions(QwtDial::ScaleTicks | QwtDial::ScaleLabel); |
|
- | 161 | Compass->setScaleTicks(0, 0, 3); |
|
- | 162 | Compass->setScale(36, 5, 0); |
|
- | 163 | ||
- | 164 | Compass->setNeedle(new QwtDialSimpleNeedle(QwtDialSimpleNeedle::Arrow, true, Qt::red, QColor(Qt::gray).light(130))); |
|
- | 165 | Compass->setPalette(newPalette); |
|
- | 166 | Compass->setMaximumSize(QSize(MeterSize, MeterSize)); |
|
- | 167 | Compass->setMinimumSize(QSize(MeterSize, MeterSize)); |
|
- | 168 | ||
- | 169 | QPalette newPalette1; |
|
- | 170 | ||
- | 171 | newPalette1.setColor(QPalette::Base, Qt::darkBlue); |
|
- | 172 | newPalette1.setColor(QPalette::Foreground, QColor(255,128,0).dark(120)); |
|
- | 173 | newPalette1.setColor(QPalette::Text, Qt::white); |
|
- | 174 | ||
- | 175 | Attitude = new AttitudeIndicator(this); |
|
- | 176 | Attitude->setMaximumSize(QSize(MeterSize, MeterSize)); |
|
- | 177 | Attitude->setMinimumSize(QSize(MeterSize, MeterSize)); |
|
- | 178 | Attitude->setPalette(newPalette1); |
|
- | 179 | ||
- | 180 | verticalLayout->addWidget(Attitude); |
|
- | 181 | ||
- | 182 | qwt_Rate->setRange(-10.0, 10.0, 0.1, 0); |
|
- | 183 | ||
- | 184 | newPalette1.setColor(QPalette::Foreground, QColor(Qt::darkBlue).dark(120)); |
|
- | 185 | ||
- | 186 | SpeedMeter = new cSpeedMeter(this); |
|
- | 187 | SpeedMeter->setMaximumSize(QSize(MeterSize, MeterSize)); |
|
- | 188 | SpeedMeter->setMinimumSize(QSize(MeterSize, MeterSize)); |
|
- | 189 | SpeedMeter->setPalette(newPalette1); |
|
- | 190 | SpeedMeter->setRange(0.0, 5.0); |
|
- | 191 | SpeedMeter->setScale(1, 2, 0.5); |
|
- | 192 | SpeedMeter->setProperty("END", 5); |
|
- | 193 | ||
- | 194 | LayOut_Speed->addWidget(SpeedMeter); |
|
- | 195 | } |
|
192 | 196 | ||
193 | void MKTool::init_Objects() |
197 | void MKTool::init_Objects() |
194 | { |
198 | { |
195 | // QTimer-Instanzen |
199 | // QTimer-Instanzen |
Line -... | Line 200... | ||
- | 200 | Ticker = new QTimer(this); |
|
196 | Ticker = new QTimer(this); |
201 | |
Line 197... | Line 202... | ||
197 | 202 | // Verbindungsobject |
|
198 | Conn = new cConnection(); |
203 | o_Connection = new cConnection(); |
Line 199... | Line 204... | ||
199 | 204 | ||
200 | // neuer Logger |
205 | // neuer Logger |
Line 201... | Line 206... | ||
201 | logger = new Logger(Settings, &Mode); |
206 | logger = new Logger(Settings, &Mode); |
202 | 207 | ||
- | 208 | // LCD-Dialog |
|
Line 203... | Line 209... | ||
203 | // LCD-Dialog |
209 | f_LCD = new dlg_LCD(this); |
Line 204... | Line 210... | ||
204 | f_LCD = new dlg_LCD(this); |
210 | |
205 | 211 | // LCD-Dialog |
|
Line 206... | Line 212... | ||
206 | // LCD-Dialog |
212 | f_Map = new dlg_Map(this); |
207 | f_Map = new dlg_Map(this); |
213 | f_Map->create_Map(Settings); |
208 | 214 | ||
209 | GE_Server = new cServer(); |
215 | KML_Server = new cKML_Server(); |
210 | 216 | ||
211 | QMK_Server = new cQMK_Server(); |
217 | QMK_Server = new cQMK_Server(); |
Line 212... | Line 218... | ||
212 | QMK_Server->setProperty("Connect", false); |
218 | QMK_Server->setProperty("Connect", false); |
213 | 219 | ||
214 | if (Settings->Server.StartServer) |
220 | if (Settings->Server.StartServer) |
Line -... | Line 221... | ||
- | 221 | { |
|
- | 222 | ac_StartServer->setChecked(true); |
|
- | 223 | KML_Server->start_Server(Settings->Server.Port.toInt(), Settings); |
|
215 | { |
224 | } |
216 | ac_StartServer->setChecked(true); |
225 | } |
217 | GE_Server->start_Server(Settings->Server.Port.toInt(), Settings); |
226 | |
Line 218... | Line 227... | ||
218 | } |
227 | void MKTool::init_Connections() |
219 | } |
228 | { |
Line 220... | Line 229... | ||
220 | 229 | connect(Dec, SIGNAL(clicked()), this, SLOT(slot_Test())); |
|
Line 283... | Line 292... | ||
283 | // Timer-Events |
292 | // Timer-Events |
284 | connect(Ticker, SIGNAL(timeout()), SLOT(slot_Ticker())); |
293 | connect(Ticker, SIGNAL(timeout()), SLOT(slot_Ticker())); |
Line 285... | Line 294... | ||
285 | 294 | ||
286 | // Seitenwechsel |
295 | // Seitenwechsel |
287 | connect(tab_Main, SIGNAL(currentChanged(int)), this, SLOT(slot_TabChanged(int))); |
296 | connect(tab_Main, SIGNAL(currentChanged(int)), this, SLOT(slot_TabChanged(int))); |
- | 297 | // connect(f_Settings->tab_Par, SIGNAL(currentChanged(int)), this, SLOT(slot_TabChanged(int))); |
|
Line 288... | Line 298... | ||
288 | connect(f_Settings->tab_Par, SIGNAL(currentChanged(int)), this, SLOT(slot_TabChanged(int))); |
298 | connect(f_Settings->listWidget, SIGNAL(currentRowChanged(int)), this, SLOT(slot_TabChanged(int))); |
289 | 299 | ||
290 | // About QMK & About-QT Dialog einfügen |
300 | // About QMK & About-QT Dialog einfügen |
291 | connect(ac_About, SIGNAL(triggered()), this, SLOT(slot_ac_About())); |
301 | connect(ac_About, SIGNAL(triggered()), this, SLOT(slot_ac_About())); |
Line 353... | Line 363... | ||
353 | Plot[a]->attach(qwtPlot); |
363 | Plot[a]->attach(qwtPlot); |
354 | } |
364 | } |
355 | qwtPlot->replot(); |
365 | qwtPlot->replot(); |
356 | } |
366 | } |
Line -... | Line 367... | ||
- | 367 | ||
- | 368 | void MKTool::slot_set_Settings(cSettings *t_Settings) |
|
- | 369 | { |
|
- | 370 | Settings = t_Settings; |
|
- | 371 | } |
|
357 | 372 | ||
358 | void MKTool::slot_Test() |
373 | void MKTool::slot_Test() |
359 | { |
374 | { |
360 | // qDebug("Decode Data"); |
375 | // qDebug("Decode Data"); |
Line 438... | Line 453... | ||
438 | int max_radius = 10000; |
453 | int max_radius = 10000; |
439 | if (ok_lat && ok_lon && |
454 | if (ok_lat && ok_lon && |
440 | abs(Navi.Current.Longitude - desired_pos.Position.Longitude) < max_radius && |
455 | abs(Navi.Current.Longitude - desired_pos.Position.Longitude) < max_radius && |
441 | abs(Navi.Current.Latitude - desired_pos.Position.Latitude) < max_radius) |
456 | abs(Navi.Current.Latitude - desired_pos.Position.Latitude) < max_radius) |
442 | { |
457 | { |
443 | Conn->send_Cmd('s', ADDRESS_NC, (char *)&desired_pos, sizeof(desired_pos), false); |
458 | o_Connection->send_Cmd('s', ADDRESS_NC, (char *)&desired_pos, sizeof(desired_pos), false); |
444 | } |
459 | } |
445 | else |
460 | else |
446 | { |
461 | { |
447 | QMessageBox msgB; |
462 | QMessageBox msgB; |
448 | QString msg; |
463 | QString msg; |
Line 480... | Line 495... | ||
480 | TX_Data[1] = 0x1B; |
495 | TX_Data[1] = 0x1B; |
481 | TX_Data[2] = 0x55; |
496 | TX_Data[2] = 0x55; |
482 | TX_Data[3] = 0xAA; |
497 | TX_Data[3] = 0xAA; |
483 | TX_Data[4] = 0x00; |
498 | TX_Data[4] = 0x00; |
484 | TX_Data[5] = '\r'; |
499 | TX_Data[5] = '\r'; |
485 | Conn->send_Cmd('#', ADDRESS_NC, TX_Data, 6, false); |
500 | o_Connection->send_Cmd('#', ADDRESS_NC, TX_Data, 6, false); |
486 | ToolBox::Wait(SLEEP); |
501 | ToolBox::Wait(SLEEP); |
487 | } |
502 | } |
Line 488... | Line 503... | ||
488 | 503 | ||
489 | if (rb_SelFC->isChecked()) |
504 | if (rb_SelFC->isChecked()) |
490 | { |
505 | { |
491 | lb_Status->setText(tr("Schalte um auf FlightCtrl.")); |
506 | lb_Status->setText(tr("Schalte um auf FlightCtrl.")); |
492 | TX_Data[0] = 0; |
507 | TX_Data[0] = 0; |
493 | Conn->send_Cmd('u', ADDRESS_NC, TX_Data, 1, false); |
508 | o_Connection->send_Cmd('u', ADDRESS_NC, TX_Data, 1, false); |
494 | } |
509 | } |
495 | else |
510 | else |
496 | if (rb_SelMag->isChecked()) |
511 | if (rb_SelMag->isChecked()) |
497 | { |
512 | { |
498 | lb_Status->setText(tr("Schalte um auf MK3MAG.")); |
513 | lb_Status->setText(tr("Schalte um auf MK3MAG.")); |
499 | TX_Data[0] = 1; |
514 | TX_Data[0] = 1; |
500 | Conn->send_Cmd('u', ADDRESS_NC, TX_Data, 1, false); |
515 | o_Connection->send_Cmd('u', ADDRESS_NC, TX_Data, 1, false); |
501 | } |
516 | } |
502 | else |
517 | else |
503 | if (rb_SelNC->isChecked()) |
518 | if (rb_SelNC->isChecked()) |
504 | { |
519 | { |
Line 507... | Line 522... | ||
507 | TX_Data[1] = 0x1B; |
522 | TX_Data[1] = 0x1B; |
508 | TX_Data[2] = 0x55; |
523 | TX_Data[2] = 0x55; |
509 | TX_Data[3] = 0xAA; |
524 | TX_Data[3] = 0xAA; |
510 | TX_Data[4] = 0x00; |
525 | TX_Data[4] = 0x00; |
511 | TX_Data[5] = '\r'; |
526 | TX_Data[5] = '\r'; |
512 | Conn->send_Cmd('#', ADDRESS_NC, TX_Data, 6, false); |
527 | o_Connection->send_Cmd('#', ADDRESS_NC, TX_Data, 6, false); |
513 | } |
528 | } |
514 | ToolBox::Wait(SLEEP); |
529 | ToolBox::Wait(SLEEP); |
Line 515... | Line 530... | ||
515 | 530 | ||
516 | // qDebug("Select RB Hardware"); |
531 | // qDebug("Select RB Hardware"); |
517 | Conn->send_Cmd('v', ADDRESS_ALL, TX_Data, 0, true); |
532 | o_Connection->send_Cmd('v', ADDRESS_ALL, TX_Data, 0, true); |
Line 518... | Line 533... | ||
518 | } |
533 | } |
519 | 534 | ||
520 | // Ticker-Event |
535 | // Ticker-Event |
Line 550... | Line 565... | ||
550 | // serialPort->sendData(Temp); |
565 | // serialPort->sendData(Temp); |
551 | } |
566 | } |
552 | break; |
567 | break; |
553 | case 1 : |
568 | case 1 : |
554 | TX_Data[0] = 0; |
569 | TX_Data[0] = 0; |
555 | Conn->send_Cmd('p', ADDRESS_FC, TX_Data, 0, false); |
570 | o_Connection->send_Cmd('p', ADDRESS_FC, TX_Data, 0, false); |
556 | break; |
571 | break; |
557 | case 2 : |
572 | case 2 : |
558 | if (f_LCD->cb_LCD->isChecked()) |
573 | if (f_LCD->cb_LCD->isChecked()) |
559 | { |
574 | { |
560 | if (!f_LCD->isVisible()) |
575 | if (!f_LCD->isVisible()) |
Line 562... | Line 577... | ||
562 | Ticker->setInterval(2000); |
577 | Ticker->setInterval(2000); |
563 | TickerEvent[2] = false; |
578 | TickerEvent[2] = false; |
564 | } |
579 | } |
565 | TX_Data[0] = LCD_Page; |
580 | TX_Data[0] = LCD_Page; |
566 | TX_Data[1] = 0; |
581 | TX_Data[1] = 0; |
567 | Conn->send_Cmd('l', ADDRESS_ALL, TX_Data, 1, true); |
582 | o_Connection->send_Cmd('l', ADDRESS_ALL, TX_Data, 1, true); |
568 | } |
583 | } |
569 | break; |
584 | break; |
570 | case 3 : |
585 | case 3 : |
571 | if (ac_FastDebug->isChecked()) |
586 | if (ac_FastDebug->isChecked()) |
572 | { |
587 | { |
573 | TX_Data[0] = Settings->Data.Debug_Fast / 10; |
588 | TX_Data[0] = Settings->Data.Debug_Fast / 10; |
574 | Conn->send_Cmd('d', ADDRESS_ALL, TX_Data, 1, false); |
589 | o_Connection->send_Cmd('d', ADDRESS_ALL, TX_Data, 1, false); |
575 | } |
590 | } |
576 | else |
591 | else |
577 | { |
592 | { |
578 | TX_Data[0] = Settings->Data.Debug_Slow / 10; |
593 | TX_Data[0] = Settings->Data.Debug_Slow / 10; |
579 | Conn->send_Cmd('d', ADDRESS_ALL, TX_Data, 1, false); |
594 | o_Connection->send_Cmd('d', ADDRESS_ALL, TX_Data, 1, false); |
580 | } |
595 | } |
581 | break; |
596 | break; |
582 | } |
597 | } |
583 | } |
598 | } |
584 | } |
599 | } |
Line 670... | Line 685... | ||
670 | 685 | ||
671 | void MKTool::slot_ac_LCD() |
686 | void MKTool::slot_ac_LCD() |
672 | { |
687 | { |
673 | if (!f_LCD->isVisible()) |
688 | if (!f_LCD->isVisible()) |
- | 689 | { |
|
674 | { |
690 | delete f_LCD; |
Line 675... | Line 691... | ||
675 | f_LCD = new dlg_LCD(this); |
691 | f_LCD = new dlg_LCD(this); |
676 | 692 | ||
677 | // LCD auf / ab |
693 | // LCD auf / ab |
Line 678... | Line 694... | ||
678 | connect(f_LCD->pb_LCDup, SIGNAL(clicked()), this, SLOT(slot_LCD_UP())); |
694 | connect(f_LCD->pb_LCDup, SIGNAL(clicked()), this, SLOT(slot_LCD_UP())); |
679 | connect(f_LCD->pb_LCDdown, SIGNAL(clicked()), this, SLOT(slot_LCD_DOWN())); |
695 | connect(f_LCD->pb_LCDdown, SIGNAL(clicked()), this, SLOT(slot_LCD_DOWN())); |
680 | 696 | ||
681 | f_LCD->show(); |
697 | f_LCD->show(); |
Line 682... | Line 698... | ||
682 | TX_Data[0] = 0; |
698 | TX_Data[0] = 0; |
683 | TX_Data[1] = 0; |
699 | TX_Data[1] = 0; |
684 | Conn->send_Cmd('l', ADDRESS_ALL, TX_Data, 1, true); |
700 | o_Connection->send_Cmd('l', ADDRESS_ALL, TX_Data, 1, true); |
685 | 701 | ||
Line 686... | Line 702... | ||
686 | Ticker->setInterval(500); |
702 | Ticker->setInterval(500); |
687 | TickerEvent[2] = true; |
703 | TickerEvent[2] = true; |
688 | } |
704 | } |
689 | } |
705 | } |
- | 706 | ||
690 | 707 | void MKTool::slot_ac_Map() |
|
- | 708 | { |
|
Line 691... | Line 709... | ||
691 | void MKTool::slot_ac_Map() |
709 | if (!f_Map->isVisible()) |
692 | { |
710 | { |
693 | if (!f_Map->isVisible()) |
711 | // delete f_Map; |
Line -... | Line 712... | ||
- | 712 | // f_Map = new dlg_Map(this); |
|
- | 713 | // f_Map->create_Map(Settings); |
|
- | 714 | ||
- | 715 | f_Map->show(); |
|
- | 716 | } |
|
- | 717 | } |
|
- | 718 | ||
- | 719 | void MKTool::slot_MAP_SetTarget(sWayPoint Target) |
|
Line 694... | Line 720... | ||
694 | { |
720 | { |
695 | f_Map = new dlg_Map(this); |
721 | le_TarLong->setText(QString("%1").arg(Target.Longitude)); |
696 | 722 | le_TarLat->setText(QString("%1").arg(Target.Latitude)); |
|
697 | f_Map->show(); |
723 | sb_TarTime->setValue(Target.Time); |
698 | } |
724 | |
699 | } |
725 | slot_pb_SendWaypoint(); |
700 | 726 | } |
|
701 | 727 | ||
Line 702... | Line 728... | ||
702 | void MKTool::slot_Motortest(int Motor1, int Motor2, int Motor3, int Motor4) |
728 | void MKTool::slot_Motortest(int Motor1, int Motor2, int Motor3, int Motor4) |
703 | { |
729 | { |
704 | TX_Data[0] = Motor1; |
730 | TX_Data[0] = Motor1; |
Line 848... | Line 874... | ||
848 | else |
874 | else |
849 | { |
875 | { |
850 | lb_Status->setText(tr("Fordere langsame NaviDaten an.")); |
876 | lb_Status->setText(tr("Fordere langsame NaviDaten an.")); |
851 | TX_Data[0] = Settings->Data.Navi_Slow / 10; |
877 | TX_Data[0] = Settings->Data.Navi_Slow / 10; |
852 | } |
878 | } |
853 | Conn->send_Cmd('o', ADDRESS_NC, TX_Data, 1, false); |
879 | o_Connection->send_Cmd('o', ADDRESS_NC, TX_Data, 1, false); |
854 | } |
880 | } |
855 | } |
881 | } |
Line 856... | Line 882... | ||
856 | 882 | ||
857 | void MKTool::slot_ac_NoNavi() // DONE NC 0.12i |
883 | void MKTool::slot_ac_NoNavi() // DONE NC 0.12i |
Line 872... | Line 898... | ||
872 | { |
898 | { |
873 | lb_Status->setText(tr("Fordere langsame NaviDaten an.")); |
899 | lb_Status->setText(tr("Fordere langsame NaviDaten an.")); |
874 | TX_Data[0] = Settings->Data.Navi_Slow / 10; |
900 | TX_Data[0] = Settings->Data.Navi_Slow / 10; |
875 | } |
901 | } |
876 | } |
902 | } |
877 | Conn->send_Cmd('o', ADDRESS_NC, TX_Data, 1, false); |
903 | o_Connection->send_Cmd('o', ADDRESS_NC, TX_Data, 1, false); |
878 | } |
904 | } |
Line 879... | Line 905... | ||
879 | 905 | ||
880 | void MKTool::slot_ac_FastDebug() // DONE 0.71g |
906 | void MKTool::slot_ac_FastDebug() // DONE 0.71g |
881 | { |
907 | { |
Line 889... | Line 915... | ||
889 | else |
915 | else |
890 | { |
916 | { |
891 | lb_Status->setText(tr("Fordere langsame DebugDaten an.")); |
917 | lb_Status->setText(tr("Fordere langsame DebugDaten an.")); |
892 | TX_Data[0] = Settings->Data.Debug_Slow / 10; |
918 | TX_Data[0] = Settings->Data.Debug_Slow / 10; |
893 | } |
919 | } |
894 | Conn->send_Cmd('d', ADDRESS_ALL, TX_Data, 1, false); |
920 | o_Connection->send_Cmd('d', ADDRESS_ALL, TX_Data, 1, false); |
895 | } |
921 | } |
896 | } |
922 | } |
Line 897... | Line 923... | ||
897 | 923 | ||
898 | void MKTool::slot_ac_NoDebug() // DONE 0.71g |
924 | void MKTool::slot_ac_NoDebug() // DONE 0.71g |
Line 918... | Line 944... | ||
918 | { |
944 | { |
919 | lb_Status->setText(tr("Fordere langsame DebugDaten an.")); |
945 | lb_Status->setText(tr("Fordere langsame DebugDaten an.")); |
920 | TX_Data[0] = Settings->Data.Debug_Slow / 10; |
946 | TX_Data[0] = Settings->Data.Debug_Slow / 10; |
921 | } |
947 | } |
922 | } |
948 | } |
923 | Conn->send_Cmd('d', ADDRESS_ALL, TX_Data, 1, false); |
949 | o_Connection->send_Cmd('d', ADDRESS_ALL, TX_Data, 1, false); |
924 | } |
950 | } |
Line 925... | Line 951... | ||
925 | 951 | ||
926 | void MKTool::slot_ac_About() |
952 | void MKTool::slot_ac_About() |
927 | { |
953 | { |
Line 930... | Line 956... | ||
930 | 956 | ||
931 | void MKTool::slot_ac_GetLabels() // DONE 0.71g |
957 | void MKTool::slot_ac_GetLabels() // DONE 0.71g |
932 | { |
958 | { |
933 | lb_Status->setText(tr("Analoglabels auslesen.")); |
959 | lb_Status->setText(tr("Analoglabels auslesen.")); |
934 | TX_Data[0] = 0; |
960 | TX_Data[0] = 0; |
935 | Conn->send_Cmd('a', ADDRESS_ALL, TX_Data, 1, true); |
961 | o_Connection->send_Cmd('a', ADDRESS_ALL, TX_Data, 1, true); |
Line 936... | Line 962... | ||
936 | } |
962 | } |
937 | 963 | ||
938 | void MKTool::slot_ac_StartServer() |
964 | void MKTool::slot_ac_StartServer() |
939 | { |
965 | { |
940 | if (ac_StartServer->isChecked()) |
966 | if (ac_StartServer->isChecked()) |
941 | { |
967 | { |
942 | lb_Status->setText(tr("GoogleEarth-Server gestartet.")); |
968 | lb_Status->setText(tr("KML-Server gestartet.")); |
943 | GE_Server->start_Server(Settings->Server.Port.toInt(), Settings); |
969 | KML_Server->start_Server(Settings->Server.Port.toInt(), Settings); |
944 | } |
970 | } |
945 | else |
971 | else |
946 | { |
972 | { |
947 | lb_Status->setText(tr("GoogleEarth-Server gestopt.")); |
973 | lb_Status->setText(tr("KML-Server gestopt.")); |
948 | GE_Server->stop_Server(); |
974 | KML_Server->stop_Server(); |
Line 949... | Line 975... | ||
949 | } |
975 | } |
Line 1030... | Line 1056... | ||
1030 | { |
1056 | { |
1031 | QMessageBox::warning(this, QA_NAME, trUtf8("Bitte Firmeware-Datei wählen."), QMessageBox::Ok); |
1057 | QMessageBox::warning(this, QA_NAME, trUtf8("Bitte Firmeware-Datei wählen."), QMessageBox::Ok); |
1032 | } |
1058 | } |
1033 | else if (QMessageBox::warning(this, QA_NAME, Message, QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) |
1059 | else if (QMessageBox::warning(this, QA_NAME, Message, QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) |
1034 | { |
1060 | { |
1035 | QString Programm = "avrdude" ; |
1061 | QString Programm = Settings->DIR.AVRDUDE; |
Line 1036... | Line 1062... | ||
1036 | 1062 | ||
Line 1037... | Line 1063... | ||
1037 | QStringList Argumente; |
1063 | QStringList Argumente; |
Line 1038... | Line 1064... | ||
1038 | 1064 | ||
1039 | Update = new QProcess(); |
1065 | Update = new QProcess(); |
1040 | 1066 | ||
1041 | if (Conn->isOpen()) |
1067 | if (o_Connection->isOpen()) |
Line 1042... | Line 1068... | ||
1042 | { |
1068 | { |
Line 1093... | Line 1119... | ||
1093 | void MKTool::slot_TabChanged(int Tab) // DONE 0.71g |
1119 | void MKTool::slot_TabChanged(int Tab) // DONE 0.71g |
1094 | { |
1120 | { |
1095 | Tab = Tab; |
1121 | Tab = Tab; |
1096 | if (tab_Main->count() != 0) |
1122 | if (tab_Main->count() != 0) |
1097 | { |
1123 | { |
1098 | if ((tab_Main->currentWidget()->objectName() == QString("Tab_2")) && (f_Settings->tab_Par->currentIndex() == 1)) |
1124 | if ((tab_Main->currentWidget()->objectName() == QString("Tab_2")) && (f_Settings->listWidget->currentRow() == 1)) |
1099 | { |
1125 | { |
1100 | TX_Data[0] = 0; |
1126 | TX_Data[0] = 0; |
1101 | Conn->send_Cmd('p', ADDRESS_FC, TX_Data, 0, true); |
1127 | o_Connection->send_Cmd('p', ADDRESS_FC, TX_Data, 0, true); |
Line 1102... | Line 1128... | ||
1102 | 1128 | ||
1103 | Ticker->setInterval(500); |
1129 | Ticker->setInterval(500); |
1104 | TickerEvent[1] = true; |
1130 | TickerEvent[1] = true; |
1105 | } |
1131 | } |
1106 | else |
1132 | else |
1107 | { |
1133 | { |
1108 | Ticker->setInterval(2000); |
1134 | Ticker->setInterval(2000); |
1109 | TickerEvent[1] = false; |
1135 | TickerEvent[1] = false; |
1110 | } |
- | |
1111 | /* |
- | |
1112 | if ((tab_Main->currentWidget()->objectName() == QString("Tab_4"))) |
- | |
1113 | { |
- | |
1114 | TX_Data[0] = 0; |
- | |
1115 | TX_Data[1] = 0; |
- | |
1116 | send_Data('l', ADDRESS_ALL, TX_Data, 1, true); |
- | |
1117 | - | ||
1118 | Ticker->setInterval(500); |
- | |
1119 | TickerEvent[2] = true; |
- | |
1120 | } |
- | |
1121 | else |
- | |
1122 | { |
- | |
1123 | Ticker->setInterval(2000); |
- | |
1124 | TickerEvent[2] = false; |
- | |
1125 | } |
- | |
1126 | */ |
1136 | } |
1127 | } |
1137 | } |
Line 1128... | Line 1138... | ||
1128 | } |
1138 | } |
1129 | 1139 | ||
Line 1134... | Line 1144... | ||
1134 | TX_Data[0] = 0; |
1144 | TX_Data[0] = 0; |
1135 | else |
1145 | else |
1136 | TX_Data[0] = LCD_Page + 1; |
1146 | TX_Data[0] = LCD_Page + 1; |
Line 1137... | Line 1147... | ||
1137 | 1147 | ||
1138 | TX_Data[1] = 0; |
1148 | TX_Data[1] = 0; |
1139 | Conn->send_Cmd('l', ADDRESS_ALL, TX_Data, 1, true); |
1149 | o_Connection->send_Cmd('l', ADDRESS_ALL, TX_Data, 1, true); |
Line 1140... | Line 1150... | ||
1140 | } |
1150 | } |
1141 | 1151 | ||
1142 | void MKTool::slot_LCD_DOWN() // DONE 0.71g |
1152 | void MKTool::slot_LCD_DOWN() // DONE 0.71g |
1143 | { |
1153 | { |
1144 | if (LCD_Page == 0) |
1154 | if (LCD_Page == 0) |
1145 | TX_Data[0] = LCD_MAX_Page; |
1155 | TX_Data[0] = LCD_MAX_Page; |
Line 1146... | Line 1156... | ||
1146 | else |
1156 | else |
1147 | TX_Data[0] = LCD_Page - 1; |
1157 | TX_Data[0] = LCD_Page - 1; |
1148 | 1158 | ||
Line 1149... | Line 1159... | ||
1149 | TX_Data[1] = 0; |
1159 | TX_Data[1] = 0; |
1150 | Conn->send_Cmd('l', ADDRESS_ALL, TX_Data, 1, true); |
1160 | o_Connection->send_Cmd('l', ADDRESS_ALL, TX_Data, 1, true); |
1151 | } |
1161 | } |
1152 | 1162 | ||
1153 | // Settings aus MK lesen / in MK schreiben |
1163 | // Settings aus MK lesen / in MK schreiben |
1154 | void MKTool::slot_GetFCSettings() // DONE 0.71g |
1164 | void MKTool::slot_GetFCSettings() // DONE 0.71g |
1155 | { |
1165 | { |
1156 | lb_Status->setText(tr("Lese FlightCtrl-Settings aus.")); |
1166 | lb_Status->setText(tr("Lese FlightCtrl-Settings aus.")); |
Line 1157... | Line 1167... | ||
1157 | TX_Data[0] = f_Settings->sb_Set->value(); |
1167 | TX_Data[0] = f_Settings->sb_Set->value(); |
1158 | TX_Data[1] = 0; |
1168 | TX_Data[1] = 0; |
1159 | Conn->send_Cmd('q', ADDRESS_FC, TX_Data, 1); |
1169 | o_Connection->send_Cmd('q', ADDRESS_FC, TX_Data, 1); |
Line 1160... | Line 1170... | ||
1160 | } |
1170 | } |
Line 1161... | Line 1171... | ||
1161 | 1171 | ||
1162 | void MKTool::slot_SetFCSettings() // DONE 0.71g |
1172 | void MKTool::slot_SetFCSettings() // DONE 0.71g |
Line 1163... | Line 1173... | ||
1163 | { |
1173 | { |
1164 | char *TX_Data2 = f_Settings->GetFCSettings(); |
1174 | char *TX_Data2 = f_Settings->GetFCSettings(); |
Line 1271... | Line 1281... | ||
1271 | } |
1281 | } |
1272 | } |
1282 | } |
Line 1273... | Line 1283... | ||
1273 | 1283 | ||
1274 | void MKTool::new_NaviData(sRxData RX) |
1284 | void MKTool::new_NaviData(sRxData RX) |
- | 1285 | { |
|
- | 1286 | // qDebug("Navi-Data"); |
|
- | 1287 | ||
- | 1288 | switch(RX.Decode[N_NC_FLAGS]) |
|
- | 1289 | { |
|
- | 1290 | case 1 : lb_Mode->setText("Free"); break; |
|
- | 1291 | case 2 : lb_Mode->setText("Position Hold"); break; |
|
- | 1292 | case 4 : lb_Mode->setText("Coming Home"); break; |
|
- | 1293 | case 8 : lb_Mode->setText("Range Limit"); break; |
|
- | 1294 | } |
|
1275 | { |
1295 | |
1276 | Navi.Current.Longitude = ToolBox::Data2Long(RX.Decode, N_CUR_LONGITUDE, true); |
1296 | Navi.Current.Longitude = ToolBox::Data2Long(RX.Decode, N_CUR_LONGITUDE, true); |
1277 | Navi.Current.Latitude = ToolBox::Data2Long(RX.Decode, N_CUR_LATITUDE, true); |
1297 | Navi.Current.Latitude = ToolBox::Data2Long(RX.Decode, N_CUR_LATITUDE, true); |
1278 | Navi.Current.Altitude = ToolBox::Data2Long(RX.Decode, N_CUR_ALTITUDE, true); |
1298 | Navi.Current.Altitude = ToolBox::Data2Long(RX.Decode, N_CUR_ALTITUDE, true); |
1279 | Navi.Target.Longitude = ToolBox::Data2Long(RX.Decode, N_TAR_LONGITUDE, true); |
1299 | Navi.Target.Longitude = ToolBox::Data2Long(RX.Decode, N_TAR_LONGITUDE, true); |
Line 1329... | Line 1349... | ||
1329 | 1349 | ||
1330 | NaviString.Longitude = ToolBox::get_Float(Navi.Current.Longitude,10000000); |
1350 | NaviString.Longitude = ToolBox::get_Float(Navi.Current.Longitude,10000000); |
1331 | NaviString.Latitude = ToolBox::get_Float(Navi.Current.Latitude,10000000); |
1351 | NaviString.Latitude = ToolBox::get_Float(Navi.Current.Latitude,10000000); |
Line -... | Line 1352... | ||
- | 1352 | NaviString.Altitude = ToolBox::get_Float(Navi.Current.Altitude,1000); |
|
- | 1353 | ||
- | 1354 | le_CurLong->setText(NaviString.Longitude); |
|
1332 | NaviString.Altitude = ToolBox::get_Float(Navi.Current.Altitude,1000); |
1355 | le_CurLat->setText(NaviString.Latitude); |
Line 1333... | Line 1356... | ||
1333 | 1356 | ||
Line 1334... | Line 1357... | ||
1334 | GE_Server->store_NaviString(NaviString); |
1357 | KML_Server->store_NaviString(NaviString); |
1335 | 1358 | ||
Line 1449... | Line 1472... | ||
1449 | { |
1472 | { |
1450 | Settings->Analog1.Label[Position] = "A-" + QString("%1").arg(Position); |
1473 | Settings->Analog1.Label[Position] = "A-" + QString("%1").arg(Position); |
1451 | } |
1474 | } |
1452 | Position ++; |
1475 | Position ++; |
1453 | TX_Data[0] = Position; |
1476 | TX_Data[0] = Position; |
1454 | Conn->send_Cmd('a', ADDRESS_ALL, TX_Data, 1, true); |
1477 | o_Connection->send_Cmd('a', ADDRESS_ALL, TX_Data, 1, true); |
1455 | } |
1478 | } |
1456 | if (Position == 31) |
1479 | if (Position == 31) |
1457 | { |
1480 | { |
1458 | for (int a = 0; a < MaxAnalog; a++) |
1481 | for (int a = 0; a < MaxAnalog; a++) |
1459 | { |
1482 | { |
Line 1513... | Line 1536... | ||
1513 | else |
1536 | else |
1514 | { |
1537 | { |
1515 | TX_Data[0] = Settings->Data.Debug_Slow / 10; |
1538 | TX_Data[0] = Settings->Data.Debug_Slow / 10; |
1516 | } |
1539 | } |
Line 1517... | Line 1540... | ||
1517 | 1540 | ||
Line 1518... | Line 1541... | ||
1518 | Conn->send_Cmd('d', ADDRESS_ALL, TX_Data, 1, false); |
1541 | o_Connection->send_Cmd('d', ADDRESS_ALL, TX_Data, 1, false); |
1519 | 1542 | ||
1520 | // Wenn MK3MAG dann andauernd Daten neu anfragen. |
1543 | // Wenn MK3MAG dann andauernd Daten neu anfragen. |
1521 | if (Mode.ID == ADDRESS_MK3MAG) |
1544 | if (Mode.ID == ADDRESS_MK3MAG) |
Line 1541... | Line 1564... | ||
1541 | else |
1564 | else |
1542 | { |
1565 | { |
1543 | TX_Data[0] = Settings->Data.Navi_Slow / 10; |
1566 | TX_Data[0] = Settings->Data.Navi_Slow / 10; |
1544 | } |
1567 | } |
Line 1545... | Line 1568... | ||
1545 | 1568 | ||
1546 | Conn->send_Cmd('o', ADDRESS_NC, TX_Data, 1, false); |
1569 | o_Connection->send_Cmd('o', ADDRESS_NC, TX_Data, 1, false); |
Line 1547... | Line 1570... | ||
1547 | } |
1570 | } |
1548 | 1571 | ||
Line 1555... | Line 1578... | ||
1555 | TX_Data[0] = 0xff; |
1578 | TX_Data[0] = 0xff; |
1556 | TX_Data[1] = 0; |
1579 | TX_Data[1] = 0; |
Line 1557... | Line 1580... | ||
1557 | 1580 | ||
1558 | // DEP: Raus wenn Resend implementiert. |
1581 | // DEP: Raus wenn Resend implementiert. |
1559 | ToolBox::Wait(SLEEP); |
1582 | ToolBox::Wait(SLEEP); |
1560 | Conn->send_Cmd('q', ADDRESS_FC, TX_Data, 1, true); |
1583 | o_Connection->send_Cmd('q', ADDRESS_FC, TX_Data, 1, true); |
1561 | qDebug("FC - Get Settings"); |
1584 | qDebug("FC - Get Settings"); |
1562 | } |
1585 | } |
1563 | } |
1586 | } |
1564 | // Wenn nicht Lesen und Schreiben der Settings deaktivieren. |
1587 | // Wenn nicht Lesen und Schreiben der Settings deaktivieren. |
Line 1631... | Line 1654... | ||
1631 | } |
1654 | } |
Line 1632... | Line 1655... | ||
1632 | 1655 | ||
1633 | // Verbindung zum Kopter herstellen / Trennen |
1656 | // Verbindung zum Kopter herstellen / Trennen |
1634 | void MKTool::slot_OpenPort() |
1657 | void MKTool::slot_OpenPort() |
1635 | { |
1658 | { |
1636 | if (Conn->isOpen()) |
1659 | if (o_Connection->isOpen()) |
1637 | { |
1660 | { |
1638 | TX_Data[0] = Settings->Data.Debug_Off / 10; |
1661 | TX_Data[0] = Settings->Data.Debug_Off / 10; |
1639 | Conn->send_Cmd('d', ADDRESS_ALL, TX_Data, 1, false); |
1662 | o_Connection->send_Cmd('d', ADDRESS_ALL, TX_Data, 1, false); |
Line 1640... | Line 1663... | ||
1640 | ToolBox::Wait(SLEEP); |
1663 | ToolBox::Wait(SLEEP); |
1641 | 1664 | ||
1642 | if (Mode.ID == ADDRESS_NC) |
1665 | if (Mode.ID == ADDRESS_NC) |
1643 | { |
1666 | { |
1644 | TX_Data[0] = Settings->Data.Navi_Off / 10; |
1667 | TX_Data[0] = Settings->Data.Navi_Off / 10; |
1645 | Conn->send_Cmd('o', ADDRESS_NC, TX_Data, 1, false); |
1668 | o_Connection->send_Cmd('o', ADDRESS_NC, TX_Data, 1, false); |
Line 1646... | Line 1669... | ||
1646 | ToolBox::Wait(SLEEP); |
1669 | ToolBox::Wait(SLEEP); |
1647 | } |
1670 | } |
1648 | 1671 | ||
1649 | if (Mode.ID == ADDRESS_FC) |
1672 | if (Mode.ID == ADDRESS_FC) |
1650 | { |
1673 | { |
1651 | TX_Data[0] = 0; |
1674 | TX_Data[0] = 0; |
1652 | TX_Data[1] = 0; |
1675 | TX_Data[1] = 0; |
1653 | TX_Data[2] = 0; |
1676 | TX_Data[2] = 0; |
1654 | TX_Data[3] = 0; |
1677 | TX_Data[3] = 0; |
Line 1655... | Line 1678... | ||
1655 | Conn->send_Cmd('t', ADDRESS_FC, TX_Data, 4, false); |
1678 | o_Connection->send_Cmd('t', ADDRESS_FC, TX_Data, 4, false); |
Line 1656... | Line 1679... | ||
1656 | ToolBox::Wait(SLEEP); |
1679 | ToolBox::Wait(SLEEP); |
1657 | } |
1680 | } |
Line 1658... | Line 1681... | ||
1658 | 1681 | ||
Line 1673... | Line 1696... | ||
1673 | else |
1696 | else |
1674 | { |
1697 | { |
1675 | i_Type = C_TTY; |
1698 | i_Type = C_TTY; |
1676 | } |
1699 | } |
Line 1677... | Line 1700... | ||
1677 | 1700 | ||
1678 | if (Conn->Open(i_Type, le_Port->text())) |
1701 | if (o_Connection->Open(i_Type, le_Port->text())) |
1679 | { |
1702 | { |
1680 | ac_ConnectTTY->setText("Kopter Trennen"); |
1703 | ac_ConnectTTY->setText("Kopter Trennen"); |
Line 1681... | Line 1704... | ||
1681 | le_Port->setEnabled(false); |
1704 | le_Port->setEnabled(false); |
Line 1682... | Line 1705... | ||
1682 | 1705 | ||
1683 | Conn->send_Cmd('v', ADDRESS_ALL, TX_Data, 0, true); |
1706 | o_Connection->send_Cmd('v', ADDRESS_ALL, TX_Data, 0, true); |
1684 | 1707 | ||
1685 | Ticker->start(2000); |
1708 | Ticker->start(2000); |
Line 1690... | Line 1713... | ||
1690 | // Programm beenden |
1713 | // Programm beenden |
1691 | /////////////////// |
1714 | /////////////////// |
Line 1692... | Line 1715... | ||
1692 | 1715 | ||
1693 | MKTool::~MKTool() |
1716 | MKTool::~MKTool() |
1694 | { |
1717 | { |
1695 | if (Conn->isOpen()) |
1718 | if (o_Connection->isOpen()) |
1696 | { |
1719 | { |
1697 | Conn->Close(); |
1720 | o_Connection->Close(); |
Line 1698... | Line 1721... | ||
1698 | } |
1721 | } |
1699 | 1722 |