Rev 166 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 166 | Rev 167 | ||
---|---|---|---|
Line 38... | Line 38... | ||
38 | MKTool::MKTool() |
38 | MKTool::MKTool() |
39 | { |
39 | { |
40 | setupUi(this); |
40 | setupUi(this); |
Line 41... | Line 41... | ||
41 | 41 | ||
42 | Settings = new cSettings; |
- | |
43 | // Settings->read_Settings(); |
- | |
Line 44... | Line 42... | ||
44 | // Settings->read_Settings_FC(); |
42 | Settings = new cSettings; |
45 | 43 | ||
46 | init_Arrays(); |
44 | init_Arrays(); |
Line 47... | Line 45... | ||
47 | init_Icons(); |
45 | init_Icons(); |
48 | init_GUI(); |
46 | init_GUI(); |
Line 49... | Line 47... | ||
49 | 47 | ||
50 | init_Objects(); |
- | |
51 | init_Connections(); |
- | |
52 | 48 | init_Objects(); |
|
Line 53... | Line 49... | ||
53 | init_Plot(); |
49 | init_Connections(); |
54 | 50 | ||
55 | Ticker->start(2000); |
51 | init_Plot(); |
Line -... | Line 52... | ||
- | 52 | } |
|
- | 53 | ||
- | 54 | void MKTool::init_GUI() |
|
- | 55 | { |
|
- | 56 | setWindowTitle(QA_NAME + " v" + QA_VERSION); |
|
- | 57 | ||
- | 58 | // Tab mit Debug-Elementen verbergen |
|
- | 59 | tab_Main->removeTab(5); |
|
- | 60 | // tab_Main->removeTab(2); |
|
- | 61 | ||
- | 62 | // Settings-Tab hinzufügen. |
|
- | 63 | f_Settings = new wdg_Settings( this ); |
|
- | 64 | ||
- | 65 | tab_Main->insertTab ( 2, f_Settings, "Parameter"); |
|
- | 66 | tab_Main->widget(2)->setObjectName("Tab_2"); |
|
- | 67 | ||
- | 68 | // Develop - Nicht gebrauchte sachen abschalten. |
|
- | 69 | ac_StartServer->setVisible(false); |
|
- | 70 | box_Flugdaten->hide(); |
|
56 | } |
71 | box_System->hide(); |
57 | 72 | pb_SettingsReset->hide(); |
|
58 | void MKTool::init_GUI() |
73 | pb_Flash->hide(); |
59 | { |
74 | rb_NC->hide(); |
60 | setWindowTitle(QA_NAME + " v" + QA_VERSION); |
- | |
61 | - | ||
Line 62... | Line 75... | ||
62 | toolBar->addWidget(lb_Port); |
75 | |
Line 63... | Line 76... | ||
63 | toolBar->addWidget(le_Port); |
76 | // Zusätzliche Widgets in die Toolbar. |
64 | toolBar->addSeparator(); |
77 | toolBar->addWidget(lb_Port); |
65 | toolBar->addWidget(cb_Hardware); |
78 | toolBar->addWidget(le_Port); |
66 | 79 | toolBar->addSeparator(); |
|
Line 138... | Line 151... | ||
138 | void MKTool::init_Connections() |
151 | void MKTool::init_Connections() |
139 | { |
152 | { |
140 | // Seriel-Port Empfang |
153 | // Seriel-Port Empfang |
141 | connect(serialPort, SIGNAL(newDataReceived(const QByteArray &)), this, SLOT(slot_newDataReceived(const QByteArray &))); |
154 | connect(serialPort, SIGNAL(newDataReceived(const QByteArray &)), this, SLOT(slot_newDataReceived(const QByteArray &))); |
Line 142... | Line 155... | ||
142 | 155 | ||
143 | // Buttons und Menüpunkte / Toolbar |
- | |
144 | connect(pb_Load, SIGNAL(clicked()), this, SLOT(slot_LoadParameter())); |
- | |
145 | connect(pb_Save, SIGNAL(clicked()), this, SLOT(slot_SaveParameter())); |
156 | // Buttons Settings lesen / schreiben |
146 | connect(pb_Read, SIGNAL(clicked()), this, SLOT(slot_GetParameter())); |
157 | connect(f_Settings->pb_Read, SIGNAL(clicked()), this, SLOT(slot_GetParameter())); |
Line -... | Line 158... | ||
- | 158 | connect(f_Settings->pb_Write, SIGNAL(clicked()), this, SLOT(slot_SetParameter())); |
|
147 | connect(pb_Write, SIGNAL(clicked()), this, SLOT(slot_SetParameter())); |
159 | |
148 | 160 | // LCD auf / ab |
|
Line 149... | Line 161... | ||
149 | connect(pb_LCDup, SIGNAL(clicked()), this, SLOT(slot_LCD_UP())); |
161 | connect(pb_LCDup, SIGNAL(clicked()), this, SLOT(slot_LCD_UP())); |
150 | connect(pb_LCDdown, SIGNAL(clicked()), this, SLOT(slot_LCD_DOWN())); |
162 | connect(pb_LCDdown, SIGNAL(clicked()), this, SLOT(slot_LCD_DOWN())); |
151 | 163 | ||
152 | // Actions |
- | |
153 | connect(ac_Config, SIGNAL(triggered()), this, SLOT(slot_ac_Config())); |
164 | // Actions |
154 | connect(ac_Preferences, SIGNAL(triggered()), this, SLOT(slot_ac_Preferences())); |
- | |
155 | 165 | connect(ac_Config, SIGNAL(triggered()), this, SLOT(slot_ac_Config())); |
|
156 | connect(ac_Motortest, SIGNAL(triggered()), this, SLOT(slot_ac_Motortest())); |
- | |
157 | connect(ac_StartPlotter, SIGNAL(triggered()), this, SLOT(slot_ac_StartPlotter())); |
166 | connect(ac_Preferences, SIGNAL(triggered()), this, SLOT(slot_ac_Preferences())); |
158 | connect(ac_MehrDaten, SIGNAL(triggered()), this, SLOT(slot_ac_MehrDaten())); |
167 | connect(ac_Motortest, SIGNAL(triggered()), this, SLOT(slot_ac_Motortest())); |
Line -... | Line 168... | ||
- | 168 | connect(ac_MehrDaten, SIGNAL(triggered()), this, SLOT(slot_ac_MehrDaten())); |
|
- | 169 | connect(ac_KeineDaten, SIGNAL(triggered()), this, SLOT(slot_ac_KeineDaten())); |
|
- | 170 | connect(ac_GetLabels, SIGNAL(triggered()), this, SLOT(slot_ac_GetLabels())); |
|
- | 171 | ||
159 | connect(ac_About, SIGNAL(triggered()), this, SLOT(slot_ac_About())); |
172 | // Plotter starten / scrollen |
160 | connect(ac_KeineDaten, SIGNAL(triggered()), this, SLOT(slot_ac_KeineDaten())); |
173 | connect(scroll_plot, SIGNAL(valueChanged(int)), this, SLOT(slot_ScrollPlot(int))); |
161 | connect(ac_GetLabels, SIGNAL(triggered()), this, SLOT(slot_ac_GetLabels())); |
174 | connect(ac_StartPlotter, SIGNAL(triggered()), this, SLOT(slot_ac_StartPlotter())); |
162 | 175 | ||
163 | // Tabs ein & ausblenden |
176 | // Tabs ein & ausblenden |
164 | connect(ac_View0, SIGNAL(triggered()), this, SLOT(slot_ac_View())); |
177 | connect(ac_View0, SIGNAL(triggered()), this, SLOT(slot_ac_View())); |
165 | connect(ac_View1, SIGNAL(triggered()), this, SLOT(slot_ac_View())); |
178 | connect(ac_View1, SIGNAL(triggered()), this, SLOT(slot_ac_View())); |
Line -... | Line 179... | ||
- | 179 | connect(ac_View2, SIGNAL(triggered()), this, SLOT(slot_ac_View())); |
|
166 | connect(ac_View2, SIGNAL(triggered()), this, SLOT(slot_ac_View())); |
180 | connect(ac_View3, SIGNAL(triggered()), this, SLOT(slot_ac_View())); |
167 | connect(ac_View3, SIGNAL(triggered()), this, SLOT(slot_ac_View())); |
181 | connect(ac_View4, SIGNAL(triggered()), this, SLOT(slot_ac_View())); |
Line -... | Line 182... | ||
- | 182 | connect(ac_View5, SIGNAL(triggered()), this, SLOT(slot_ac_View())); |
|
168 | connect(ac_View4, SIGNAL(triggered()), this, SLOT(slot_ac_View())); |
183 | |
- | 184 | // firmeware Updateen / flashen |
|
- | 185 | connect(pb_Update, SIGNAL(clicked()), this, SLOT(slot_pb_Update())); |
|
169 | connect(ac_View5, SIGNAL(triggered()), this, SLOT(slot_ac_View())); |
186 | connect(pb_HexFile, SIGNAL(clicked()), this, SLOT(slot_pb_HexFile())); |
Line 170... | Line 187... | ||
170 | 187 | ||
171 | connect(pb_Update, SIGNAL(clicked()), this, SLOT(slot_pb_Update())); |
188 | // Serielle Verbundung öffnen / schließen |
Line 172... | Line 189... | ||
172 | connect(pb_HexFile, SIGNAL(clicked()), this, SLOT(slot_pb_HexFile())); |
189 | connect(ac_ConnectTTY, SIGNAL(triggered()), this, SLOT(slot_OpenPort())); |
173 | 190 | ||
174 | connect(ac_ConnectTTY, SIGNAL(triggered()), this, SLOT(slot_OpenPort())); |
191 | // CVS-Record starten / stoppen |
175 | connect(ac_RecordCSV, SIGNAL(triggered()), this, SLOT(slot_RecordCSV())); |
- | |
176 | - | ||
177 | // Timer-Events |
- | |
178 | connect(Ticker, SIGNAL(timeout()), SLOT(slot_Ticker())); |
- | |
179 | - | ||
180 | // Seitenwechsel :) |
- | |
181 | connect(tab_Main, SIGNAL(currentChanged(int)), this, SLOT(slot_TabChanged(int))); |
- | |
182 | connect(tab_Par, SIGNAL(currentChanged(int)), this, SLOT(slot_TabChanged(int))); |
- | |
183 | - | ||
184 | // Parameterevents |
- | |
185 | connect(tb_9_6, SIGNAL(clicked()), this, SLOT(slot_tbUp())); |
- | |
186 | connect(tb_9_7, SIGNAL(clicked()), this, SLOT(slot_tbDown())); |
- | |
187 | connect(tb_9_8, SIGNAL(clicked()), this, SLOT(slot_tbLeft())); |
- | |
188 | connect(tb_9_9, SIGNAL(clicked()), this, SLOT(slot_tbRight())); |
- | |
189 | - | ||
190 | connect(J16_0, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
- | |
191 | connect(J16_1, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
- | |
192 | connect(J16_2, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
- | |
193 | connect(J16_3, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
- | |
194 | connect(J16_4, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
- | |
195 | connect(J16_5, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
- | |
196 | connect(J16_6, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
- | |
197 | connect(J16_7, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
- | |
198 | - | ||
Line 199... | Line -... | ||
199 | connect(J17_0, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
- | |
200 | connect(J17_1, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
192 | connect(ac_RecordCSV, SIGNAL(triggered()), this, SLOT(slot_RecordCSV())); |
201 | connect(J17_2, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
- | |
202 | connect(J17_3, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
- | |
203 | connect(J17_4, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
193 | |
204 | connect(J17_5, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
- | |
205 | connect(J17_6, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
- | |
206 | connect(J17_7, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
194 | // Timer-Events |
207 | 195 | connect(Ticker, SIGNAL(timeout()), SLOT(slot_Ticker())); |
|
Line 208... | Line 196... | ||
208 | connect(sb_11_1, SIGNAL(valueChanged(int)), this, SLOT(slot_ValuetoLED16(int))); |
196 | |
209 | connect(sb_11_3, SIGNAL(valueChanged(int)), this, SLOT(slot_ValuetoLED17(int))); |
197 | // Seitenwechsel |
Line 260... | Line 248... | ||
260 | qwtPlot->insertLegend(new QwtLegend(), QwtPlot::RightLegend); |
248 | qwtPlot->insertLegend(new QwtLegend(), QwtPlot::RightLegend); |
Line 261... | Line 249... | ||
261 | 249 | ||
262 | QwtPlotGrid *Grid = new QwtPlotGrid(); |
250 | QwtPlotGrid *Grid = new QwtPlotGrid(); |
Line 263... | Line -... | ||
263 | Grid->setMajPen(QPen(Qt::gray, 0, Qt::DotLine)); |
- | |
264 | 251 | Grid->setMajPen(QPen(Qt::gray, 0, Qt::DotLine)); |
|
Line 265... | Line 252... | ||
265 | 252 | ||
Line 266... | Line 253... | ||
266 | Grid->attach(qwtPlot); |
253 | Grid->attach(qwtPlot); |
267 | 254 | ||
268 | qwtPlot->setAxisScale(QwtPlot::xBottom,0,Settings->Data.Plotter_Count,0); |
255 | qwtPlot->setAxisScale(QwtPlot::xBottom,0,Settings->Data.Plotter_Count,0); |
269 | 256 | ||
270 | for (int a = 0; a < MaxAnalog; a++) |
257 | for (int a = 0; a < MaxAnalog; a++) |
Line 271... | Line 258... | ||
271 | { |
258 | { |
272 | Plot[a] = new QwtPlotCurve(Settings->Analog1.Label[a]); |
259 | Plot[a] = new QwtPlotCurve(Settings->Analog1.Label[a]); |
273 | Plot[a]->setPen(QPen(QColor(Def_Colors[a]))); |
260 | Plot[a]->setPen(QPen(QColor(Def_Colors[a]))); |
274 | // Plot[a]->setRenderHint(QwtPlotItem::RenderAntialiased); |
261 | Plot[a]->setRenderHint(QwtPlotItem::RenderAntialiased); |
Line 329... | Line 316... | ||
329 | case 1 : |
316 | case 1 : |
330 | TX_Data[0] = 0; |
317 | TX_Data[0] = 0; |
331 | send_Data('p', ADDRESS_FC, TX_Data, 0, false); |
318 | send_Data('p', ADDRESS_FC, TX_Data, 0, false); |
332 | break; |
319 | break; |
333 | case 2 : |
320 | case 2 : |
- | 321 | if (cb_LCD->isChecked()) |
|
- | 322 | { |
|
334 | TX_Data[0] = LCD_Page; |
323 | TX_Data[0] = LCD_Page; |
335 | TX_Data[1] = 0; |
324 | TX_Data[1] = 0; |
336 | send_Data('l', ADDRESS_ALL, TX_Data, 1, true); |
325 | send_Data('l', ADDRESS_ALL, TX_Data, 1, true); |
- | 326 | } |
|
- | 327 | break; |
|
- | 328 | case 3 : |
|
- | 329 | if (ac_MehrDaten->isChecked()) |
|
- | 330 | { |
|
- | 331 | TX_Data[0] = Settings->Data.Debug_Fast / 10; |
|
- | 332 | send_Data('d', ADDRESS_ALL, TX_Data, 1, false); |
|
- | 333 | } |
|
- | 334 | else |
|
- | 335 | { |
|
- | 336 | TX_Data[0] = Settings->Data.Debug_Slow / 10; |
|
- | 337 | send_Data('d', ADDRESS_ALL, TX_Data, 1, false); |
|
- | 338 | } |
|
337 | break; |
339 | break; |
338 | } |
340 | } |
339 | } |
341 | } |
340 | } |
342 | } |
341 | } |
343 | } |
Line 485... | Line 487... | ||
485 | 487 | ||
486 | void MKTool::slot_ac_KeineDaten() // DONE 0.71g |
488 | void MKTool::slot_ac_KeineDaten() // DONE 0.71g |
487 | { |
489 | { |
488 | if (ac_KeineDaten->isChecked()) |
490 | if (ac_KeineDaten->isChecked()) |
- | 491 | { |
|
489 | { |
492 | TickerEvent[3] = false; |
490 | TX_Data[0] = 0; |
493 | TX_Data[0] = 0; |
491 | send_Data('d', ADDRESS_ALL, TX_Data, 1, false); |
494 | send_Data('d', ADDRESS_ALL, TX_Data, 1, false); |
492 | } |
495 | } |
493 | else |
496 | else |
- | 497 | { |
|
- | 498 | // Wenn MK3MAG dann andauernd Daten neu anfragen. |
|
- | 499 | if (Mode.ID == ADDRESS_MK3MAG) |
|
- | 500 | TickerEvent[3] = true; |
|
494 | { |
501 | |
495 | if (ac_MehrDaten->isChecked()) |
502 | if (ac_MehrDaten->isChecked()) |
496 | { |
503 | { |
497 | TX_Data[0] = Settings->Data.Debug_Fast / 10; |
504 | TX_Data[0] = Settings->Data.Debug_Fast / 10; |
498 | send_Data('d', ADDRESS_ALL, TX_Data, 1, false); |
505 | send_Data('d', ADDRESS_ALL, TX_Data, 1, false); |
Line 511... | Line 518... | ||
511 | } |
518 | } |
Line 512... | Line 519... | ||
512 | 519 | ||
513 | void MKTool::slot_ac_GetLabels() // DONE 0.71g |
520 | void MKTool::slot_ac_GetLabels() // DONE 0.71g |
514 | { |
521 | { |
515 | TX_Data[0] = 0; |
522 | TX_Data[0] = 0; |
516 | send_Data('a', ADDRESS_ALL, TX_Data, 1, false); |
523 | send_Data('a', ADDRESS_ALL, TX_Data, 1, true); |
Line 517... | Line 524... | ||
517 | } |
524 | } |
518 | 525 | ||
Line 568... | Line 575... | ||
568 | 575 | ||
569 | // Firmeware-Update |
576 | // Firmeware-Update |
570 | /////////////////// |
577 | /////////////////// |
571 | void MKTool::slot_pb_Update() |
578 | void MKTool::slot_pb_Update() |
- | 579 | { |
|
- | 580 | QString Device; |
|
Line -... | Line 581... | ||
- | 581 | QString Hardware; |
|
- | 582 | ||
- | 583 | if (rb_FC->isChecked()) |
|
- | 584 | { |
|
- | 585 | Device = "m644"; |
|
- | 586 | Hardware = "FlightCtrl"; |
|
- | 587 | } |
|
- | 588 | else if (rb_MK3MAG->isChecked()) |
|
- | 589 | { |
|
- | 590 | Device = "m168"; |
|
- | 591 | Hardware = "MK3MAG"; |
|
- | 592 | } |
|
- | 593 | else if (rb_BL->isChecked()) |
|
- | 594 | { |
|
- | 595 | Device = "m8"; |
|
Line 572... | Line 596... | ||
572 | { |
596 | Hardware = "BL-Ctrl"; |
573 | 597 | } |
|
574 | 598 | ||
Line 575... | Line 599... | ||
575 | QString Message = "Firmeware-Datei \n\n"; |
599 | QString Message = "Firmeware-Datei \n\n"; |
576 | Message = Message + le_HexFile->text() + "\n\n"; |
600 | Message = Message + le_HexFile->text() + "\n\n"; |
577 | Message = Message + trUtf8("an FlightCtrl mit AVRDUDE - Seriel & Bootloader über ") + le_Port->text() + trUtf8(" übertragen?\n"); |
601 | Message = Message + "an " + Hardware + trUtf8(" mit AVRDUDE - Seriel & Bootloader über ") + le_Port->text() + trUtf8(" übertragen?\n"); |
578 | 602 | ||
579 | if (le_HexFile->text() == "") |
603 | if (le_HexFile->text() == "") |
580 | { |
604 | { |
581 | QMessageBox::warning(this, QA_NAME, trUtf8("Bitte Firmeware-Datei wählen."), QMessageBox::Ok); |
605 | QMessageBox::warning(this, QA_NAME, trUtf8("Bitte Firmeware-Datei wählen."), QMessageBox::Ok); |
582 | } |
- | |
Line 583... | Line 606... | ||
583 | else if (QMessageBox::warning(this, QA_NAME, Message, QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) |
606 | } |
Line 584... | Line 607... | ||
584 | { |
607 | else if (QMessageBox::warning(this, QA_NAME, Message, QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) |
Line 637... | Line 660... | ||
637 | { |
660 | { |
638 | le_HexFile->setText(FileName); |
661 | le_HexFile->setText(FileName); |
639 | } |
662 | } |
640 | } |
663 | } |
Line 641... | Line -... | ||
641 | - | ||
642 | // Settings-Bereich |
- | |
643 | /////////////////// |
- | |
644 | - | ||
645 | void MKTool::slot_LEDtoValue() |
- | |
646 | { |
- | |
647 | QToolButton *ToolButton = (QToolButton*)sender(); |
- | |
648 | if (ToolButton->text() == QString("0")) |
- | |
649 | { |
- | |
650 | set_LED(ToolButton, true); |
- | |
651 | sb_11_1->setValue(sb_11_1->value() + ToolButton->toolTip().toInt()); |
- | |
652 | } |
- | |
653 | else if (ToolButton->text() == QString("1")) |
- | |
654 | { |
- | |
655 | set_LED(ToolButton); |
- | |
656 | sb_11_1->setValue(sb_11_1->value() - ToolButton->toolTip().toInt()); |
- | |
657 | } |
- | |
658 | else if (ToolButton->text() == QString("00")) |
- | |
659 | { |
- | |
660 | set_LED(ToolButton, true); |
- | |
661 | sb_11_3->setValue(sb_11_3->value() + ToolButton->toolTip().toInt()); |
- | |
662 | } |
- | |
663 | else if (ToolButton->text() == QString("11")) |
- | |
664 | { |
- | |
665 | set_LED(ToolButton); |
- | |
666 | sb_11_3->setValue(sb_11_3->value() - ToolButton->toolTip().toInt()); |
- | |
667 | } |
- | |
668 | } |
- | |
669 | - | ||
670 | void MKTool::slot_ValuetoLED16(int Wert) |
- | |
671 | { |
- | |
672 | // QSpinBox *SpinBox = (QSpinBox*)sender(); |
- | |
673 | - | ||
674 | // int Wert = SpinBox->value(); |
- | |
675 | - | ||
676 | set_LED(J16_0); |
- | |
677 | set_LED(J16_1); |
- | |
678 | set_LED(J16_2); |
- | |
679 | set_LED(J16_3); |
- | |
680 | set_LED(J16_4); |
- | |
681 | set_LED(J16_5); |
- | |
682 | set_LED(J16_6); |
- | |
683 | set_LED(J16_7); |
- | |
684 | - | ||
685 | for (int a = 0; a < 8; a++) |
- | |
686 | { |
- | |
687 | if (Wert > 127) |
- | |
688 | { |
- | |
689 | set_LED(J16_0, true); |
- | |
690 | Wert = Wert - 128; |
- | |
691 | } |
- | |
692 | if (Wert > 63) |
- | |
693 | { |
- | |
694 | set_LED(J16_1, true); |
- | |
695 | Wert = Wert - 64; |
- | |
696 | } |
- | |
697 | if (Wert > 31) |
- | |
698 | { |
- | |
699 | set_LED(J16_2, true); |
- | |
700 | Wert = Wert - 32; |
- | |
701 | } |
- | |
702 | if (Wert > 15) |
- | |
703 | { |
- | |
704 | set_LED(J16_3, true); |
- | |
705 | Wert = Wert - 16; |
- | |
706 | } |
- | |
707 | if (Wert > 7) |
- | |
708 | { |
- | |
709 | set_LED(J16_4, true); |
- | |
710 | Wert = Wert - 8; |
- | |
711 | } |
- | |
712 | if (Wert > 3) |
- | |
713 | { |
- | |
714 | set_LED(J16_5, true); |
- | |
715 | Wert = Wert - 4; |
- | |
716 | } |
- | |
717 | if (Wert > 1) |
- | |
718 | { |
- | |
719 | set_LED(J16_6, true); |
- | |
720 | Wert = Wert - 2; |
- | |
721 | } |
- | |
722 | if (Wert > 0) |
- | |
723 | { |
- | |
724 | set_LED(J16_7, true); |
- | |
725 | Wert = Wert - 1; |
- | |
726 | } |
- | |
727 | } |
- | |
728 | } |
- | |
729 | - | ||
730 | void MKTool::slot_ValuetoLED17(int Wert) |
- | |
731 | { |
- | |
732 | // QSpinBox *SpinBox = (QSpinBox*)sender(); |
- | |
733 | - | ||
734 | // int Wert = SpinBox->value(); |
- | |
735 | - | ||
736 | set_LED(J17_0); |
- | |
737 | set_LED(J17_1); |
- | |
738 | set_LED(J17_2); |
- | |
739 | set_LED(J17_3); |
- | |
740 | set_LED(J17_4); |
- | |
741 | set_LED(J17_5); |
- | |
742 | set_LED(J17_6); |
- | |
743 | set_LED(J17_7); |
- | |
744 | - | ||
745 | for (int a = 0; a < 8; a++) |
- | |
746 | { |
- | |
747 | if (Wert > 127) |
- | |
748 | { |
- | |
749 | set_LED(J17_0, true); |
- | |
750 | Wert = Wert - 128; |
- | |
751 | } |
- | |
752 | if (Wert > 63) |
- | |
753 | { |
- | |
754 | set_LED(J17_1, true); |
- | |
755 | Wert = Wert - 64; |
- | |
756 | } |
- | |
757 | if (Wert > 31) |
- | |
758 | { |
- | |
759 | set_LED(J17_2, true); |
- | |
760 | Wert = Wert - 32; |
- | |
761 | } |
- | |
762 | if (Wert > 15) |
- | |
763 | { |
- | |
764 | set_LED(J17_3, true); |
- | |
765 | Wert = Wert - 16; |
- | |
766 | } |
- | |
767 | if (Wert > 7) |
- | |
768 | { |
- | |
769 | set_LED(J17_4, true); |
- | |
770 | Wert = Wert - 8; |
- | |
771 | } |
- | |
772 | if (Wert > 3) |
- | |
773 | { |
- | |
774 | set_LED(J17_5, true); |
- | |
775 | Wert = Wert - 4; |
- | |
776 | } |
- | |
777 | if (Wert > 1) |
- | |
778 | { |
- | |
779 | set_LED(J17_6, true); |
- | |
780 | Wert = Wert - 2; |
- | |
781 | } |
- | |
782 | if (Wert > 0) |
- | |
783 | { |
- | |
784 | set_LED(J17_7, true); |
- | |
785 | Wert = Wert - 1; |
- | |
786 | } |
- | |
787 | } |
- | |
788 | } |
- | |
789 | - | ||
790 | void MKTool::set_LED(QToolButton *ToolButton, bool On) |
- | |
791 | { |
- | |
792 | if (ToolButton->text() == QString("0") && On) |
- | |
793 | { |
- | |
794 | ToolButton->setIcon(Icons[0]); |
- | |
795 | ToolButton->setText("1"); |
- | |
796 | } |
- | |
797 | else if (ToolButton->text() == QString("1") && !On) |
- | |
798 | { |
- | |
799 | ToolButton->setIcon(Icons[4]); |
- | |
800 | ToolButton->setText("0"); |
- | |
801 | } |
- | |
802 | else if (ToolButton->text() == QString("00") && On) |
- | |
803 | { |
- | |
804 | ToolButton->setIcon(Icons[0]); |
- | |
805 | ToolButton->setText("11"); |
- | |
806 | } |
- | |
807 | else if (ToolButton->text() == QString("11") && !On) |
- | |
808 | { |
- | |
809 | ToolButton->setIcon(Icons[4]); |
- | |
810 | ToolButton->setText("00"); |
- | |
811 | } |
- | |
812 | } |
- | |
813 | - | ||
814 | void MKTool::slot_tbUp() |
- | |
815 | { |
- | |
816 | if (tb_9_6->text() == QString("0")) |
- | |
817 | { |
- | |
818 | tb_9_6->setIcon(Icons[20]); |
- | |
819 | tb_9_6->setText("1"); |
- | |
820 | } |
- | |
821 | else |
- | |
822 | { |
- | |
823 | tb_9_6->setIcon(Icons[21]); |
- | |
824 | tb_9_6->setText("0"); |
- | |
825 | } |
- | |
826 | } |
- | |
827 | - | ||
828 | void MKTool::slot_tbDown() |
- | |
829 | { |
- | |
830 | if (tb_9_7->text() == QString("0")) |
- | |
831 | { |
- | |
832 | tb_9_7->setIcon(Icons[22]); |
- | |
833 | tb_9_7->setText("1"); |
- | |
834 | } |
- | |
835 | else |
- | |
836 | { |
- | |
837 | tb_9_7->setIcon(Icons[23]); |
- | |
838 | tb_9_7->setText("0"); |
- | |
839 | } |
- | |
840 | } |
- | |
841 | - | ||
842 | void MKTool::slot_tbLeft() |
- | |
843 | { |
- | |
844 | if (tb_9_8->text() == QString("0")) |
- | |
845 | { |
- | |
846 | tb_9_8->setIcon(Icons[24]); |
- | |
847 | tb_9_8->setText("1"); |
- | |
848 | } |
- | |
849 | else |
- | |
850 | { |
- | |
851 | tb_9_8->setIcon(Icons[25]); |
- | |
852 | tb_9_8->setText("0"); |
- | |
853 | } |
- | |
854 | } |
- | |
855 | - | ||
856 | void MKTool::slot_tbRight() |
- | |
857 | { |
- | |
858 | if (tb_9_9->text() == QString("0")) |
- | |
859 | { |
- | |
860 | tb_9_9->setIcon(Icons[26]); |
- | |
861 | tb_9_9->setText("1"); |
- | |
862 | } |
- | |
863 | else |
- | |
864 | { |
- | |
865 | tb_9_9->setIcon(Icons[27]); |
- | |
866 | tb_9_9->setText("0"); |
- | |
867 | } |
- | |
868 | } |
- | |
869 | - | ||
870 | QComboBox *MKTool::setCombo(QComboBox *Combo, int Set, int Wert) |
- | |
871 | { |
- | |
872 | if (ParameterSet[Set][Wert] <= 250) |
- | |
873 | { |
- | |
874 | Combo->setItemText(4, QString("%1").arg(ParameterSet[Set][Wert])); |
- | |
875 | Combo->setCurrentIndex(4); |
- | |
876 | } |
- | |
877 | else |
- | |
878 | { |
- | |
879 | Combo->setCurrentIndex(ParameterSet[Set][Wert] - 251); |
- | |
880 | } |
- | |
881 | return Combo; |
- | |
882 | } |
- | |
883 | - | ||
884 | int MKTool::get_Value(QComboBox *Combo) |
- | |
885 | { |
- | |
886 | if (Combo->currentText() == QString("Poti 1")) |
- | |
887 | return 251; |
- | |
888 | if (Combo->currentText() == QString("Poti 2")) |
- | |
889 | return 252; |
- | |
890 | if (Combo->currentText() == QString("Poti 3")) |
- | |
891 | return 253; |
- | |
892 | if (Combo->currentText() == QString("Poti 4")) |
- | |
893 | return 254; |
- | |
894 | return Combo->currentText().toInt(); |
- | |
895 | } |
- | |
896 | - | ||
897 | void MKTool::store_ParameterSet(int Set) // DONE 0.71h |
- | |
898 | { |
- | |
899 | char *Name = le_SetName->text().toLatin1().data(); |
- | |
900 | - | ||
901 | int a; |
- | |
902 | - | ||
903 | for (a = 0; a < le_SetName->text().length(); a++) |
- | |
904 | { |
- | |
905 | ParameterSet[Set][P_NAME+a] = Name[a]; |
- | |
906 | } |
- | |
907 | - | ||
908 | while(a < 12) |
- | |
909 | { |
- | |
910 | ParameterSet[Set][P_NAME+a] = 0; |
- | |
911 | a++; |
- | |
912 | } |
- | |
913 | - | ||
914 | // Seite 1 |
- | |
915 | ParameterSet[Set][P_GLOBAL_CONF] = 0; |
- | |
916 | - | ||
917 | if (cb_1_1->isChecked()) |
- | |
918 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x01; |
- | |
919 | if (cb_1_2->isChecked()) |
- | |
920 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x02; |
- | |
921 | if (cb_1_3->isChecked()) |
- | |
922 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x04; |
- | |
923 | if (cb_1_4->isChecked()) |
- | |
924 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x08; |
- | |
925 | if (cb_1_5->isChecked()) |
- | |
926 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x10; |
- | |
927 | if (cb_1_6->isChecked()) |
- | |
928 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x20; |
- | |
929 | if (cb_1_7->isChecked()) |
- | |
930 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x40; |
- | |
931 | if (cb_1_8->isChecked()) |
- | |
932 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x80; |
- | |
933 | - | ||
934 | // Seite 2 |
- | |
935 | ParameterSet[Set][P_KANAL_NICK] = sb_2_1->value(); |
- | |
936 | ParameterSet[Set][P_KANAL_ROLL] = sb_2_2->value(); |
- | |
937 | ParameterSet[Set][P_KANAL_GAS] = sb_2_3->value(); |
- | |
938 | ParameterSet[Set][P_KANAL_GIER] = sb_2_4->value(); |
- | |
939 | ParameterSet[Set][P_KANAL_POTI1] = sb_2_5->value(); |
- | |
940 | ParameterSet[Set][P_KANAL_POTI2] = sb_2_6->value(); |
- | |
941 | ParameterSet[Set][P_KANAL_POTI3] = sb_2_7->value(); |
- | |
942 | ParameterSet[Set][P_KANAL_POTI4] = sb_2_8->value(); |
- | |
943 | - | ||
944 | // Seite 3 |
- | |
945 | ParameterSet[Set][P_STICK_P] = sb_3_1->value(); |
- | |
946 | ParameterSet[Set][P_STICK_D] = sb_3_2->value(); |
- | |
947 | ParameterSet[Set][P_GIER_P] = get_Value(cb_3_3); |
- | |
948 | ParameterSet[Set][P_EXTERNAL] = get_Value(cb_3_4); |
- | |
949 | - | ||
950 | // Seite 4 |
- | |
951 | ParameterSet[Set][P_MAXHOEHE] = get_Value(cb_4_1); |
- | |
952 | ParameterSet[Set][P_MIN_GAS] = sb_4_2->value(); |
- | |
953 | ParameterSet[Set][P_HOEHE_P] = get_Value(cb_4_3); |
- | |
954 | ParameterSet[Set][P_DRUCK_D] = get_Value(cb_4_4); |
- | |
955 | ParameterSet[Set][P_HOEHE_ACC] = get_Value(cb_4_5); |
- | |
956 | ParameterSet[Set][P_HOEHE_GAIN] = sb_4_6->value(); |
- | |
957 | - | ||
958 | // Seite 5 |
- | |
959 | ParameterSet[Set][P_GYRO_P] = get_Value(cb_5_1); |
- | |
960 | ParameterSet[Set][P_GYRO_I] = get_Value(cb_5_2); |
- | |
961 | ParameterSet[Set][P_DYNAMIC_STAB] = get_Value(cb_5_3); |
- | |
962 | ParameterSet[Set][P_GYRO_ACC_FAKTOR] = sb_5_4->value(); |
- | |
963 | ParameterSet[Set][P_GYRO_ACC_ABGL] = sb_5_5->value(); |
- | |
964 | ParameterSet[Set][P_FAKTOR_I] = get_Value(cb_5_6); |
- | |
965 | ParameterSet[Set][P_DRIFT_KOMP] = sb_5_7->value(); |
- | |
966 | - | ||
967 | // Seite 6 |
- | |
968 | ParameterSet[Set][P_SERVO_NICK_CONT] = get_Value(cb_6_1); |
- | |
969 | ParameterSet[Set][P_SERVO_NICK_COMP] = sb_6_2->value(); |
- | |
970 | ParameterSet[Set][P_SERVO_NICK_MIN] = sb_6_3->value(); |
- | |
971 | ParameterSet[Set][P_SERVO_NICK_MAX] = sb_6_4->value(); |
- | |
972 | ParameterSet[Set][P_SERVO_NICK_REFR] = sb_6_5->value(); |
- | |
973 | ParameterSet[Set][P_SERVO_NICK_COMPI] = cb_6_6->isChecked(); |
- | |
974 | - | ||
975 | // Seite 7 |
- | |
976 | ParameterSet[Set][P_GAS_MIN] = sb_7_1->value(); |
- | |
977 | ParameterSet[Set][P_GAS_MAX] = sb_7_2->value(); |
- | |
978 | ParameterSet[Set][P_KOMPASS_WIRKUNG] = get_Value(cb_7_3); |
- | |
979 | ParameterSet[Set][P_UNTERSPANNUNG] = sb_7_4->value(); |
- | |
980 | ParameterSet[Set][P_NOTGASZEIT] = sb_7_5->value(); |
- | |
981 | ParameterSet[Set][P_NOTGAS] = sb_7_6->value(); |
- | |
982 | - | ||
983 | // Seite 8 |
- | |
984 | ParameterSet[Set][P_ACHS_KOPPLUNG] = get_Value(cb_8_1); |
- | |
985 | ParameterSet[Set][P_ACHS_GKOPPLUNG] = get_Value(cb_8_2); |
- | |
986 | - | ||
987 | // Seite 9 |
- | |
988 | ParameterSet[Set][P_LOOP_CONFIG] = 0; |
- | |
989 | if (tb_9_6->text() == QString("1")) |
- | |
990 | ParameterSet[Set][P_LOOP_CONFIG] = ParameterSet[Set][P_LOOP_CONFIG] | 0x01; |
- | |
991 | if (tb_9_7->text() == QString("1")) |
- | |
992 | ParameterSet[Set][P_LOOP_CONFIG] = ParameterSet[Set][P_LOOP_CONFIG] | 0x02; |
- | |
993 | if (tb_9_8->text() == QString("1")) |
- | |
994 | ParameterSet[Set][P_LOOP_CONFIG] = ParameterSet[Set][P_LOOP_CONFIG] | 0x04; |
- | |
995 | if (tb_9_9->text() == QString("1")) |
- | |
996 | ParameterSet[Set][P_LOOP_CONFIG] = ParameterSet[Set][P_LOOP_CONFIG] | 0x08; |
- | |
997 | if (cb_4_7->isChecked()) |
- | |
998 | ParameterSet[Set][P_LOOP_CONFIG] = ParameterSet[Set][P_LOOP_CONFIG] | 0x10; |
- | |
999 | - | ||
1000 | ParameterSet[Set][P_LOOP_GAS_LIMIT] = get_Value(cb_9_1); |
- | |
1001 | ParameterSet[Set][P_LOOP_THRESHOLD] = sb_9_2->value(); |
- | |
1002 | ParameterSet[Set][P_WINKEL_NICK] = sb_9_3->value(); |
- | |
1003 | ParameterSet[Set][P_LOOP_HYSTERESE] = sb_9_4->value(); |
- | |
1004 | ParameterSet[Set][P_WINKEL_ROLL] = sb_9_5->value(); |
- | |
1005 | - | ||
1006 | // Seite 10 |
- | |
1007 | ParameterSet[Set][P_USER_1] = get_Value(cb_10_1); |
- | |
1008 | ParameterSet[Set][P_USER_2] = get_Value(cb_10_2); |
- | |
1009 | ParameterSet[Set][P_USER_3] = get_Value(cb_10_3); |
- | |
1010 | ParameterSet[Set][P_USER_4] = get_Value(cb_10_4); |
- | |
1011 | ParameterSet[Set][P_USER_5] = get_Value(cb_10_5); |
- | |
1012 | ParameterSet[Set][P_USER_6] = get_Value(cb_10_6); |
- | |
1013 | ParameterSet[Set][P_USER_7] = get_Value(cb_10_7); |
- | |
1014 | ParameterSet[Set][P_USER_8] = get_Value(cb_10_8); |
- | |
1015 | - | ||
1016 | // Seite 11 |
- | |
1017 | ParameterSet[Set][P_J16_BITMASK] = sb_11_1->value(); |
- | |
1018 | ParameterSet[Set][P_J16_TIMING] = get_Value(cb_11_2); |
- | |
1019 | ParameterSet[Set][P_J17_BITMASK] = sb_11_3->value(); |
- | |
1020 | ParameterSet[Set][P_J17_TIMING] = get_Value(cb_11_4); |
- | |
1021 | - | ||
1022 | // Seite 12 |
- | |
1023 | ParameterSet[Set][P_NAV_GPS_MODE] = get_Value(cb_12_1); |
- | |
1024 | ParameterSet[Set][P_NAV_GPS_GAIN] = get_Value(cb_12_2); |
- | |
1025 | ParameterSet[Set][P_NAV_STICK_THRE] = sb_12_3->value(); |
- | |
1026 | ParameterSet[Set][P_NAV_GPS_MIN] = sb_12_4->value(); |
- | |
1027 | ParameterSet[Set][P_NAV_GPS_P] = get_Value(cb_12_5); |
- | |
1028 | ParameterSet[Set][P_NAV_GPS_I] = get_Value(cb_12_6); |
- | |
1029 | ParameterSet[Set][P_NAV_GPS_D] = get_Value(cb_12_7); |
- | |
1030 | ParameterSet[Set][P_NAV_GPS_ACC] = get_Value(cb_12_8); |
- | |
1031 | - | ||
1032 | //Seite 13 |
- | |
1033 | ParameterSet[Set][P_NAV_WIND_CORR] = get_Value(cb_13_1); |
- | |
1034 | ParameterSet[Set][P_NAV_SPEED_COMP] = get_Value(cb_13_2); |
- | |
1035 | ParameterSet[Set][P_NAV_RADIUS] = get_Value(cb_13_3); |
- | |
1036 | ParameterSet[Set][P_NAV_ANGLE_LIMIT] = get_Value(cb_13_4); |
- | |
1037 | } |
- | |
1038 | - | ||
1039 | void MKTool::slot_SaveParameter() // DONE 0.71g |
- | |
1040 | { |
- | |
1041 | int Set = sb_Set->value() + 5; |
- | |
1042 | - | ||
1043 | QString Filename = QFileDialog::getSaveFileName(this, "Mikrokopter Parameter speichern", Settings->DIR.Parameter + le_SetName->text(), "Mikrokopter Parameter(*.mkp);;Alle Dateien (*)"); |
- | |
1044 | - | ||
1045 | if (!Filename.isEmpty()) |
- | |
1046 | { |
- | |
1047 | if (!(Filename.endsWith(".mkp", Qt::CaseInsensitive))) |
- | |
1048 | { |
- | |
1049 | Filename = Filename + QString(".mkp"); |
- | |
1050 | } |
- | |
1051 | store_ParameterSet(Set); |
- | |
1052 | QSettings Setting(Filename, QSettings::IniFormat); |
- | |
1053 | - | ||
1054 | Setting.beginGroup("Setup"); |
- | |
1055 | Setting.setValue("Name", le_SetName->text()); |
- | |
1056 | Setting.setValue("GlobalConfig", ParameterSet[Set][P_GLOBAL_CONF]); |
- | |
1057 | Setting.endGroup(); |
- | |
1058 | - | ||
1059 | Setting.beginGroup("Channels"); |
- | |
1060 | Setting.setValue("Nick", ParameterSet[Set][P_KANAL_NICK]); |
- | |
1061 | Setting.setValue("Roll", ParameterSet[Set][P_KANAL_ROLL]); |
- | |
1062 | Setting.setValue("Gas", ParameterSet[Set][P_KANAL_GAS]); |
- | |
1063 | Setting.setValue("Gier", ParameterSet[Set][P_KANAL_GIER]); |
- | |
1064 | Setting.setValue("Poti_1", ParameterSet[Set][P_KANAL_POTI1]); |
- | |
1065 | Setting.setValue("Poti_2", ParameterSet[Set][P_KANAL_POTI2]); |
- | |
1066 | Setting.setValue("Poti_3", ParameterSet[Set][P_KANAL_POTI3]); |
- | |
1067 | Setting.setValue("Poti_4", ParameterSet[Set][P_KANAL_POTI4]); |
- | |
1068 | Setting.endGroup(); |
- | |
1069 | - | ||
1070 | Setting.beginGroup("Stick"); |
- | |
1071 | Setting.setValue("Nick_Roll-P", ParameterSet[Set][P_STICK_P]); |
- | |
1072 | Setting.setValue("Nick_Roll-D", ParameterSet[Set][P_STICK_D]); |
- | |
1073 | Setting.setValue("Gier-P", ParameterSet[Set][P_GIER_P]); |
- | |
1074 | Setting.setValue("ExternalControl", ParameterSet[Set][P_EXTERNAL]); |
- | |
1075 | Setting.endGroup(); |
- | |
1076 | - | ||
1077 | Setting.beginGroup("Altitude"); |
- | |
1078 | Setting.setValue("Setpoint", ParameterSet[Set][P_MAXHOEHE]); |
- | |
1079 | Setting.setValue("MinGas", ParameterSet[Set][P_MIN_GAS]); |
- | |
1080 | Setting.setValue("P", ParameterSet[Set][P_HOEHE_P]); |
- | |
1081 | Setting.setValue("Barometric-D", ParameterSet[Set][P_DRUCK_D]); |
- | |
1082 | Setting.setValue("Z-ACC-Effect", ParameterSet[Set][P_HOEHE_ACC]); |
- | |
1083 | Setting.setValue("Gain", ParameterSet[Set][P_HOEHE_GAIN]); |
- | |
1084 | Setting.endGroup(); |
- | |
1085 | - | ||
1086 | Setting.beginGroup("Gyro"); |
- | |
1087 | Setting.setValue("P", ParameterSet[Set][P_GYRO_P]); |
- | |
1088 | Setting.setValue("I", ParameterSet[Set][P_GYRO_I]); |
- | |
1089 | Setting.setValue("DynamicStability", ParameterSet[Set][P_DYNAMIC_STAB]); |
- | |
1090 | Setting.setValue("ACC_Gyro-Factor", ParameterSet[Set][P_GYRO_ACC_FAKTOR]); |
- | |
1091 | Setting.setValue("ACC_Gyro-Compensation", ParameterSet[Set][P_GYRO_ACC_ABGL]); |
- | |
1092 | Setting.setValue("DriftCompensation", ParameterSet[Set][P_DRIFT_KOMP]); |
- | |
1093 | Setting.setValue("Main-I", ParameterSet[Set][P_FAKTOR_I]); |
- | |
1094 | Setting.endGroup(); |
- | |
1095 | - | ||
1096 | Setting.beginGroup("Camera"); |
- | |
1097 | Setting.setValue("ServoNickControl", ParameterSet[Set][P_SERVO_NICK_CONT]); |
- | |
1098 | Setting.setValue("ServoNickCompensation", ParameterSet[Set][P_SERVO_NICK_COMP]); |
- | |
1099 | Setting.setValue("ServoNickInvert", ParameterSet[Set][P_SERVO_NICK_COMPI]); |
- | |
1100 | Setting.setValue("ServoNickMin", ParameterSet[Set][P_SERVO_NICK_MIN]); |
- | |
1101 | Setting.setValue("ServoNickMax", ParameterSet[Set][P_SERVO_NICK_MAX]); |
- | |
1102 | Setting.setValue("ServoNickRefreshRate", ParameterSet[Set][P_SERVO_NICK_REFR]); |
- | |
1103 | Setting.endGroup(); |
- | |
1104 | - | ||
1105 | Setting.beginGroup("Others"); |
- | |
1106 | Setting.setValue("MinGas", ParameterSet[Set][P_GAS_MIN]); |
- | |
1107 | Setting.setValue("MaxGas", ParameterSet[Set][P_GAS_MAX]); |
- | |
1108 | Setting.setValue("Compass-Effect", ParameterSet[Set][P_KOMPASS_WIRKUNG]); |
- | |
1109 | Setting.setValue("UnderVoltage", ParameterSet[Set][P_UNTERSPANNUNG]); |
- | |
1110 | Setting.setValue("NotGas", ParameterSet[Set][P_NOTGAS]); |
- | |
1111 | Setting.setValue("NotGasTime", ParameterSet[Set][P_NOTGASZEIT]); |
- | |
1112 | Setting.endGroup(); |
- | |
1113 | - | ||
1114 | Setting.beginGroup("Coupling"); |
- | |
1115 | Setting.setValue("YawPosFeedback", ParameterSet[Set][P_ACHS_KOPPLUNG]); |
- | |
1116 | Setting.setValue("YawNegFeedback", ParameterSet[Set][P_ACHS_GKOPPLUNG]); |
- | |
1117 | Setting.endGroup(); |
- | |
1118 | - | ||
1119 | Setting.beginGroup("Loop"); |
- | |
1120 | Setting.setValue("Config", ParameterSet[Set][P_LOOP_CONFIG]); |
- | |
1121 | Setting.setValue("GasLimit", ParameterSet[Set][P_LOOP_GAS_LIMIT]); |
- | |
1122 | Setting.setValue("StickThreshold", ParameterSet[Set][P_LOOP_THRESHOLD]); |
- | |
1123 | Setting.setValue("LoopHysteresis", ParameterSet[Set][P_LOOP_HYSTERESE]); |
- | |
1124 | Setting.setValue("TurnOverNick", ParameterSet[Set][P_WINKEL_NICK]); |
- | |
1125 | Setting.setValue("TurnOverRoll", ParameterSet[Set][P_WINKEL_ROLL]); |
- | |
1126 | Setting.endGroup(); |
- | |
1127 | - | ||
1128 | Setting.beginGroup("User"); |
- | |
1129 | Setting.setValue("Parameter_1", ParameterSet[Set][P_USER_1]); |
- | |
1130 | Setting.setValue("Parameter_2", ParameterSet[Set][P_USER_2]); |
- | |
1131 | Setting.setValue("Parameter_3", ParameterSet[Set][P_USER_3]); |
- | |
1132 | Setting.setValue("Parameter_4", ParameterSet[Set][P_USER_4]); |
- | |
1133 | Setting.setValue("Parameter_5", ParameterSet[Set][P_USER_5]); |
- | |
1134 | Setting.setValue("Parameter_6", ParameterSet[Set][P_USER_6]); |
- | |
1135 | Setting.setValue("Parameter_7", ParameterSet[Set][P_USER_7]); |
- | |
1136 | Setting.setValue("Parameter_8", ParameterSet[Set][P_USER_8]); |
- | |
1137 | Setting.endGroup(); |
- | |
1138 | - | ||
1139 | Setting.beginGroup("Output"); |
- | |
1140 | Setting.setValue("J16_Bitmask", ParameterSet[Set][P_J16_BITMASK]); |
- | |
1141 | Setting.setValue("J16_Timing", ParameterSet[Set][P_J16_TIMING]); |
- | |
1142 | Setting.setValue("J17_Bitmask", ParameterSet[Set][P_J17_BITMASK]); |
- | |
1143 | Setting.setValue("J17_Timing", ParameterSet[Set][P_J17_TIMING]); |
- | |
1144 | Setting.endGroup(); |
- | |
1145 | - | ||
1146 | Setting.beginGroup("NaviCtrl"); |
- | |
1147 | Setting.setValue("GPS_ModeControl", ParameterSet[Set][P_NAV_GPS_MODE]); |
- | |
1148 | Setting.setValue("GPS_Gain", ParameterSet[Set][P_NAV_GPS_GAIN]); |
- | |
1149 | Setting.setValue("GPS_P", ParameterSet[Set][P_NAV_GPS_P]); |
- | |
1150 | Setting.setValue("GPS_I", ParameterSet[Set][P_NAV_GPS_I]); |
- | |
1151 | Setting.setValue("GPS_D", ParameterSet[Set][P_NAV_GPS_D]); |
- | |
1152 | Setting.setValue("GPS_Acc", ParameterSet[Set][P_NAV_GPS_ACC]); |
- | |
1153 | Setting.setValue("GPS_MinSat", ParameterSet[Set][P_NAV_GPS_MIN]); |
- | |
1154 | Setting.setValue("GPS_StickThreshold", ParameterSet[Set][P_NAV_STICK_THRE]); |
- | |
1155 | Setting.setValue("GPS_WindCorrection", ParameterSet[Set][P_NAV_WIND_CORR]); |
- | |
1156 | Setting.setValue("GPS_SpeedCompensation", ParameterSet[Set][P_NAV_SPEED_COMP]); |
- | |
1157 | Setting.setValue("GPS_MaxRadius", ParameterSet[Set][P_NAV_RADIUS]); |
- | |
1158 | Setting.endGroup(); |
- | |
1159 | } |
- | |
1160 | } |
- | |
1161 | - | ||
1162 | void MKTool::slot_LoadParameter() // DONE 0.71g |
- | |
1163 | { |
- | |
1164 | QString Filename = QFileDialog::getOpenFileName(this, "Mikrokopter Parameter laden", Settings->DIR.Parameter, "Mikrokopter Parameter(*.mkp);;Alle Dateien (*)"); |
- | |
1165 | - | ||
1166 | if (!Filename.isEmpty()) |
- | |
1167 | { |
- | |
1168 | int Set = sb_Set->value(); |
- | |
1169 | QSettings Setting(Filename, QSettings::IniFormat); |
- | |
1170 | - | ||
1171 | Setting.beginGroup("Setup"); |
- | |
1172 | QString Name = Setting.value("Name", QString("--noname--")).toString(); |
- | |
1173 | char *CName = Name.toLatin1().data(); |
- | |
1174 | int a; |
- | |
1175 | - | ||
1176 | for (a=0; a < Name.length(); a++) |
- | |
1177 | { |
- | |
1178 | ParameterSet[Set][P_NAME+a] = CName[a]; |
- | |
1179 | } |
- | |
1180 | while (a < 12) |
- | |
1181 | { |
- | |
1182 | ParameterSet[Set][P_NAME+a] = 0; |
- | |
1183 | a++; |
- | |
1184 | } |
- | |
1185 | - | ||
1186 | ParameterSet[Set][P_GLOBAL_CONF] = Setting.value("GlobalConfig", 0).toInt(); |
- | |
1187 | Setting.endGroup(); |
- | |
1188 | - | ||
1189 | Setting.beginGroup("Channels"); |
- | |
1190 | ParameterSet[Set][P_KANAL_NICK] = Setting.value("Nick", 1).toInt(); |
- | |
1191 | ParameterSet[Set][P_KANAL_ROLL] = Setting.value("Roll", 2).toInt(); |
- | |
1192 | ParameterSet[Set][P_KANAL_GAS] = Setting.value("Gas", 3).toInt(); |
- | |
1193 | ParameterSet[Set][P_KANAL_GIER] = Setting.value("Gier", 4).toInt(); |
- | |
1194 | ParameterSet[Set][P_KANAL_POTI1] = Setting.value("Poti_1", 5).toInt(); |
- | |
1195 | ParameterSet[Set][P_KANAL_POTI2] = Setting.value("Poti_2", 6).toInt(); |
- | |
1196 | ParameterSet[Set][P_KANAL_POTI3] = Setting.value("Poti_3", 7).toInt(); |
- | |
1197 | ParameterSet[Set][P_KANAL_POTI4] = Setting.value("Poti_4", 8).toInt(); |
- | |
1198 | Setting.endGroup(); |
- | |
1199 | - | ||
1200 | Setting.beginGroup("Stick"); |
- | |
1201 | ParameterSet[Set][P_STICK_P] = Setting.value("Nick_Roll-P", 4).toInt(); |
- | |
1202 | ParameterSet[Set][P_STICK_D] = Setting.value("Nick_Roll-D", 8).toInt(); |
- | |
1203 | ParameterSet[Set][P_GIER_P] = Setting.value("Gier-P", 1).toInt(); |
- | |
1204 | ParameterSet[Set][P_EXTERNAL] = Setting.value("ExternalControl", 1).toInt(); |
- | |
1205 | Setting.endGroup(); |
- | |
1206 | - | ||
1207 | Setting.beginGroup("Altitude"); |
- | |
1208 | ParameterSet[Set][P_MAXHOEHE] = Setting.value("Setpoint", 251).toInt(); |
- | |
1209 | ParameterSet[Set][P_MIN_GAS] = Setting.value("MinGas", 30).toInt(); |
- | |
1210 | ParameterSet[Set][P_HOEHE_P] = Setting.value("P", 10).toInt(); |
- | |
1211 | ParameterSet[Set][P_DRUCK_D] = Setting.value("Barometric-D", 30).toInt(); |
- | |
1212 | ParameterSet[Set][P_HOEHE_ACC] = Setting.value("Z-ACC-Effect", 30).toInt(); |
- | |
1213 | ParameterSet[Set][P_HOEHE_GAIN] = Setting.value("Gain", 3).toInt(); |
- | |
1214 | Setting.endGroup(); |
- | |
1215 | - | ||
1216 | Setting.beginGroup("Gyro"); |
- | |
1217 | ParameterSet[Set][P_GYRO_P] = Setting.value("P", 80).toInt(); |
- | |
1218 | ParameterSet[Set][P_GYRO_I] = Setting.value("I", 120).toInt(); |
- | |
1219 | ParameterSet[Set][P_DYNAMIC_STAB] = Setting.value("DynamicStability", 75).toInt(); |
- | |
1220 | ParameterSet[Set][P_GYRO_ACC_FAKTOR] = Setting.value("ACC_Gyro-Factor", 30).toInt(); |
- | |
1221 | ParameterSet[Set][P_GYRO_ACC_ABGL] = Setting.value("ACC_Gyro-Compensation", 32).toInt(); |
- | |
1222 | ParameterSet[Set][P_DRIFT_KOMP] = Setting.value("DriftCompensation", 4).toInt(); |
- | |
1223 | ParameterSet[Set][P_FAKTOR_I] = Setting.value("Main-I", 32).toInt(); |
- | |
1224 | Setting.endGroup(); |
- | |
1225 | - | ||
1226 | Setting.beginGroup("Camera"); |
- | |
1227 | ParameterSet[Set][P_SERVO_NICK_CONT] = Setting.value("ServoNickControl", 100).toInt(); |
- | |
1228 | ParameterSet[Set][P_SERVO_NICK_COMP] = Setting.value("ServoNickCompensation", 40).toInt(); |
- | |
1229 | ParameterSet[Set][P_SERVO_NICK_COMPI] = Setting.value("ServoNickInvert", 0).toInt(); |
- | |
1230 | ParameterSet[Set][P_SERVO_NICK_MIN] = Setting.value("ServoNickMin", 50).toInt(); |
- | |
1231 | ParameterSet[Set][P_SERVO_NICK_MAX] = Setting.value("ServoNickMax", 150).toInt(); |
- | |
1232 | ParameterSet[Set][P_SERVO_NICK_REFR] = Setting.value("ServoNickRefreshRate", 5).toInt(); |
- | |
1233 | Setting.endGroup(); |
- | |
1234 | - | ||
1235 | Setting.beginGroup("Others"); |
- | |
1236 | ParameterSet[Set][P_GAS_MIN] = Setting.value("MinGas", 8).toInt(); |
- | |
1237 | ParameterSet[Set][P_GAS_MAX] = Setting.value("MaxGas", 230).toInt(); |
- | |
1238 | ParameterSet[Set][P_KOMPASS_WIRKUNG] = Setting.value("Compass-Effect", 128).toInt(); |
- | |
1239 | ParameterSet[Set][P_UNTERSPANNUNG] = Setting.value("UnderVoltage", 94).toInt(); |
- | |
1240 | ParameterSet[Set][P_NOTGAS] = Setting.value("NotGas", 35).toInt(); |
- | |
1241 | ParameterSet[Set][P_NOTGASZEIT] = Setting.value("NotGasTime", 30).toInt(); |
- | |
1242 | Setting.endGroup(); |
- | |
1243 | - | ||
1244 | Setting.beginGroup("Coupling"); |
- | |
1245 | ParameterSet[Set][P_ACHS_KOPPLUNG] = Setting.value("YawPosFeedback", 90).toInt(); |
- | |
1246 | ParameterSet[Set][P_ACHS_GKOPPLUNG] = Setting.value("YawNegFeedback", 5).toInt(); |
- | |
1247 | Setting.endGroup(); |
- | |
1248 | - | ||
1249 | Setting.beginGroup("Loop"); |
- | |
1250 | ParameterSet[Set][P_LOOP_CONFIG] = Setting.value("Config", 0).toInt(); |
- | |
1251 | ParameterSet[Set][P_LOOP_GAS_LIMIT] = Setting.value("GasLimit", 50).toInt(); |
- | |
1252 | ParameterSet[Set][P_LOOP_THRESHOLD] = Setting.value("StickThreshold", 90).toInt(); |
- | |
1253 | ParameterSet[Set][P_LOOP_HYSTERESE] = Setting.value("LoopHysteresis", 50).toInt(); |
- | |
1254 | ParameterSet[Set][P_WINKEL_NICK] = Setting.value("TurnOverNick", 85).toInt(); |
- | |
1255 | ParameterSet[Set][P_WINKEL_ROLL] = Setting.value("TurnOverRoll", 85).toInt(); |
- | |
1256 | Setting.endGroup(); |
- | |
1257 | - | ||
1258 | Setting.beginGroup("User"); |
- | |
1259 | ParameterSet[Set][P_USER_1] = Setting.value("Parameter_1", 0).toInt(); |
- | |
1260 | ParameterSet[Set][P_USER_2] = Setting.value("Parameter_2", 0).toInt(); |
- | |
1261 | ParameterSet[Set][P_USER_3] = Setting.value("Parameter_3", 0).toInt(); |
- | |
1262 | ParameterSet[Set][P_USER_4] = Setting.value("Parameter_4", 0).toInt(); |
- | |
1263 | ParameterSet[Set][P_USER_5] = Setting.value("Parameter_5", 0).toInt(); |
- | |
1264 | ParameterSet[Set][P_USER_6] = Setting.value("Parameter_6", 0).toInt(); |
- | |
1265 | ParameterSet[Set][P_USER_7] = Setting.value("Parameter_7", 0).toInt(); |
- | |
1266 | ParameterSet[Set][P_USER_8] = Setting.value("Parameter_8", 0).toInt(); |
- | |
1267 | Setting.endGroup(); |
- | |
1268 | - | ||
1269 | Setting.beginGroup("Output"); |
- | |
1270 | ParameterSet[Set][P_J16_BITMASK] = Setting.value("J16_Bitmask", 255).toInt(); |
- | |
1271 | ParameterSet[Set][P_J16_TIMING] = Setting.value("J16_Timing", 251).toInt(); |
- | |
1272 | ParameterSet[Set][P_J17_BITMASK] = Setting.value("J17_Bitmask", 255).toInt(); |
- | |
1273 | ParameterSet[Set][P_J17_TIMING] = Setting.value("J17_Timing", 251).toInt(); |
- | |
1274 | Setting.endGroup(); |
- | |
1275 | - | ||
1276 | Setting.beginGroup("NaviCtrl"); |
- | |
1277 | ParameterSet[Set][P_NAV_GPS_MODE] = Setting.value("GPS_ModeControl", 253).toInt(); |
- | |
1278 | ParameterSet[Set][P_NAV_GPS_GAIN] = Setting.value("GPS_Gain", 100).toInt(); |
- | |
1279 | ParameterSet[Set][P_NAV_GPS_P] = Setting.value("GPS_P", 90).toInt(); |
- | |
1280 | ParameterSet[Set][P_NAV_GPS_I] = Setting.value("GPS_I", 90).toInt(); |
- | |
1281 | ParameterSet[Set][P_NAV_GPS_D] = Setting.value("GPS_D", 90).toInt(); |
- | |
1282 | ParameterSet[Set][P_NAV_GPS_ACC] = Setting.value("GPS_Acc", 0).toInt(); |
- | |
1283 | ParameterSet[Set][P_NAV_GPS_MIN] = Setting.value("GPS_MinSat", 6).toInt(); |
- | |
1284 | ParameterSet[Set][P_NAV_STICK_THRE] = Setting.value("GPS_StickThreshold", 8).toInt(); |
- | |
1285 | ParameterSet[Set][P_NAV_WIND_CORR] = Setting.value("GPS_WindCorrection", 90).toInt(); |
- | |
1286 | ParameterSet[Set][P_NAV_SPEED_COMP] = Setting.value("GPS_SpeedCompensation", 30).toInt(); |
- | |
1287 | ParameterSet[Set][P_NAV_RADIUS] = Setting.value("GPS_MaxRadius", 100).toInt(); |
- | |
1288 | Setting.endGroup(); |
- | |
1289 | - | ||
1290 | show_ParameterSet(Set); |
- | |
1291 | } |
- | |
1292 | } |
- | |
1293 | - | ||
1294 | void MKTool::show_ParameterSet(int Set) // DONE 0.71h |
- | |
1295 | { |
- | |
1296 | char Name[12]; |
- | |
1297 | for (int a = 0; a < 12; a++) |
- | |
1298 | { |
- | |
1299 | Name[a] = ParameterSet[Set][P_NAME+a]; |
- | |
1300 | } |
- | |
1301 | le_SetName->setText(QString(Name)); |
- | |
1302 | - | ||
1303 | // Seite 1 |
- | |
1304 | { |
- | |
1305 | cb_1_1->setChecked(ParameterSet[Set][P_GLOBAL_CONF] & 0x01); |
- | |
1306 | cb_1_2->setChecked(ParameterSet[Set][P_GLOBAL_CONF] & 0x02); |
- | |
1307 | cb_1_3->setChecked(ParameterSet[Set][P_GLOBAL_CONF] & 0x04); |
- | |
1308 | cb_1_4->setChecked(ParameterSet[Set][P_GLOBAL_CONF] & 0x08); |
- | |
1309 | cb_1_5->setChecked(ParameterSet[Set][P_GLOBAL_CONF] & 0x10); |
- | |
1310 | cb_1_6->setChecked(ParameterSet[Set][P_GLOBAL_CONF] & 0x20); |
- | |
1311 | cb_1_7->setChecked(ParameterSet[Set][P_GLOBAL_CONF] & 0x40); |
- | |
1312 | cb_1_8->setChecked(ParameterSet[Set][P_GLOBAL_CONF] & 0x80); |
- | |
1313 | } |
- | |
1314 | // Seite 2 |
- | |
1315 | { |
- | |
1316 | sb_2_1->setValue(ParameterSet[Set][P_KANAL_NICK]); |
- | |
1317 | sb_2_2->setValue(ParameterSet[Set][P_KANAL_ROLL]); |
- | |
1318 | sb_2_3->setValue(ParameterSet[Set][P_KANAL_GAS]); |
- | |
1319 | sb_2_4->setValue(ParameterSet[Set][P_KANAL_GIER]); |
- | |
1320 | sb_2_5->setValue(ParameterSet[Set][P_KANAL_POTI1]); |
- | |
1321 | sb_2_6->setValue(ParameterSet[Set][P_KANAL_POTI2]); |
- | |
1322 | sb_2_7->setValue(ParameterSet[Set][P_KANAL_POTI3]); |
- | |
1323 | sb_2_8->setValue(ParameterSet[Set][P_KANAL_POTI4]); |
- | |
1324 | } |
- | |
1325 | // Seite 3 |
- | |
1326 | { |
- | |
1327 | sb_3_1->setValue(ParameterSet[Set][P_STICK_P]); |
- | |
1328 | sb_3_2->setValue(ParameterSet[Set][P_STICK_D]); |
- | |
1329 | cb_3_3 = setCombo(cb_3_3, Set, P_GIER_P); |
- | |
1330 | cb_3_4 = setCombo(cb_3_4, Set, P_EXTERNAL); |
- | |
1331 | } |
- | |
1332 | // Seite 4 |
- | |
1333 | { |
- | |
1334 | cb_4_1 = setCombo(cb_4_1, Set, P_MAXHOEHE); |
- | |
1335 | sb_4_2->setValue(ParameterSet[Set][P_MIN_GAS]); |
- | |
1336 | cb_4_3 = setCombo(cb_4_3, Set, P_HOEHE_P); |
- | |
1337 | cb_4_4 = setCombo(cb_4_4, Set, P_DRUCK_D); |
- | |
1338 | cb_4_5 = setCombo(cb_4_5, Set, P_HOEHE_ACC); |
- | |
1339 | sb_4_6->setValue(ParameterSet[Set][P_HOEHE_GAIN]); |
- | |
1340 | cb_4_7->setChecked(ParameterSet[Set][P_LOOP_CONFIG] & 0x10); |
- | |
1341 | } |
- | |
1342 | // Seite 5 |
- | |
1343 | { |
- | |
1344 | cb_5_1 = setCombo(cb_5_1, Set, P_GYRO_P); |
- | |
1345 | cb_5_2 = setCombo(cb_5_2, Set, P_GYRO_I); |
- | |
1346 | cb_5_3 = setCombo(cb_5_3, Set, P_DYNAMIC_STAB); |
- | |
1347 | sb_5_4->setValue(ParameterSet[Set][P_GYRO_ACC_FAKTOR]); |
- | |
1348 | sb_5_5->setValue(ParameterSet[Set][P_GYRO_ACC_ABGL]); |
- | |
1349 | cb_5_6 = setCombo(cb_5_6, Set, P_FAKTOR_I); |
- | |
1350 | sb_5_7->setValue(ParameterSet[Set][P_DRIFT_KOMP]); |
- | |
1351 | } |
- | |
1352 | // Seite 6 |
- | |
1353 | { |
- | |
1354 | cb_6_1 = setCombo(cb_6_1, Set, P_SERVO_NICK_CONT); |
- | |
1355 | sb_6_2->setValue(ParameterSet[Set][P_SERVO_NICK_COMP]); |
- | |
1356 | sb_6_3->setValue(ParameterSet[Set][P_SERVO_NICK_MIN]); |
- | |
1357 | sb_6_4->setValue(ParameterSet[Set][P_SERVO_NICK_MAX]); |
- | |
1358 | sb_6_5->setValue(ParameterSet[Set][P_SERVO_NICK_REFR]); |
- | |
1359 | cb_6_6->setChecked(ParameterSet[Set][P_SERVO_NICK_COMPI]); |
- | |
1360 | } |
- | |
1361 | // Seite 7 |
- | |
1362 | { |
- | |
1363 | sb_7_1->setValue(ParameterSet[Set][P_GAS_MIN]); |
- | |
1364 | sb_7_2->setValue(ParameterSet[Set][P_GAS_MAX]); |
- | |
1365 | cb_7_3 = setCombo(cb_7_3, Set, P_KOMPASS_WIRKUNG); |
- | |
1366 | sb_7_4->setValue(ParameterSet[Set][P_UNTERSPANNUNG]); |
- | |
1367 | sb_7_5->setValue(ParameterSet[Set][P_NOTGASZEIT]); |
- | |
1368 | sb_7_6->setValue(ParameterSet[Set][P_NOTGAS]); |
- | |
1369 | } |
- | |
1370 | // Seite 8 |
- | |
1371 | { |
- | |
1372 | cb_8_1 = setCombo(cb_8_1, Set, P_ACHS_KOPPLUNG); |
- | |
1373 | cb_8_2 = setCombo(cb_8_2, Set, P_ACHS_GKOPPLUNG); |
- | |
1374 | } |
- | |
1375 | // Seite 9 |
- | |
1376 | { |
- | |
1377 | if (ParameterSet[Set][P_LOOP_CONFIG] & 0x01) |
- | |
1378 | { |
- | |
1379 | tb_9_6->setIcon(Icons[20]); |
- | |
1380 | tb_9_6->setText("1"); |
- | |
1381 | } |
- | |
1382 | else |
- | |
1383 | { |
- | |
1384 | tb_9_6->setIcon(Icons[21]); |
- | |
1385 | tb_9_6->setText("0"); |
- | |
1386 | } |
- | |
1387 | - | ||
1388 | if (ParameterSet[Set][P_LOOP_CONFIG] & 0x02) |
- | |
1389 | { |
- | |
1390 | tb_9_7->setIcon(Icons[22]); |
- | |
1391 | tb_9_7->setText("1"); |
- | |
1392 | } |
- | |
1393 | else |
- | |
1394 | { |
- | |
1395 | tb_9_7->setIcon(Icons[23]); |
- | |
1396 | tb_9_7->setText("0"); |
- | |
1397 | } |
- | |
1398 | - | ||
1399 | if (ParameterSet[Set][P_LOOP_CONFIG] & 0x04) |
- | |
1400 | { |
- | |
1401 | tb_9_8->setIcon(Icons[24]); |
- | |
1402 | tb_9_8->setText("1"); |
- | |
1403 | } |
- | |
1404 | else |
- | |
1405 | { |
- | |
1406 | tb_9_8->setIcon(Icons[25]); |
- | |
1407 | tb_9_8->setText("0"); |
- | |
1408 | } |
- | |
1409 | - | ||
1410 | if (ParameterSet[Set][P_LOOP_CONFIG] & 0x08) |
- | |
1411 | { |
- | |
1412 | tb_9_9->setIcon(Icons[26]); |
- | |
1413 | tb_9_9->setText("1"); |
- | |
1414 | } |
- | |
1415 | else |
- | |
1416 | { |
- | |
1417 | tb_9_9->setIcon(Icons[27]); |
- | |
1418 | tb_9_9->setText("0"); |
- | |
1419 | } |
- | |
1420 | - | ||
1421 | cb_9_1 = setCombo(cb_9_1, Set, P_LOOP_GAS_LIMIT); |
- | |
1422 | sb_9_2->setValue(ParameterSet[Set][P_LOOP_THRESHOLD]); |
- | |
1423 | sb_9_3->setValue(ParameterSet[Set][P_WINKEL_NICK]); |
- | |
1424 | sb_9_4->setValue(ParameterSet[Set][P_LOOP_HYSTERESE]); |
- | |
1425 | sb_9_5->setValue(ParameterSet[Set][P_WINKEL_ROLL]); |
- | |
1426 | } |
- | |
1427 | // Seite 10 |
- | |
1428 | { |
- | |
1429 | cb_10_1 = setCombo(cb_10_1, Set, P_USER_1); |
- | |
1430 | cb_10_2 = setCombo(cb_10_2, Set, P_USER_2); |
- | |
1431 | cb_10_3 = setCombo(cb_10_3, Set, P_USER_3); |
- | |
1432 | cb_10_4 = setCombo(cb_10_4, Set, P_USER_4); |
- | |
1433 | cb_10_5 = setCombo(cb_10_5, Set, P_USER_5); |
- | |
1434 | cb_10_6 = setCombo(cb_10_6, Set, P_USER_6); |
- | |
1435 | cb_10_7 = setCombo(cb_10_7, Set, P_USER_7); |
- | |
1436 | cb_10_8 = setCombo(cb_10_8, Set, P_USER_8); |
- | |
1437 | } |
- | |
1438 | // Seite 11 |
- | |
1439 | { |
- | |
1440 | sb_11_1->setValue(ParameterSet[Set][P_J16_BITMASK]); |
- | |
1441 | cb_11_2 = setCombo(cb_11_2, Set, P_J16_TIMING); |
- | |
1442 | sb_11_3->setValue(ParameterSet[Set][P_J17_BITMASK]); |
- | |
1443 | cb_11_4 = setCombo(cb_11_4, Set, P_J17_TIMING); |
- | |
1444 | } |
- | |
1445 | // Seite 12 |
- | |
1446 | { |
- | |
1447 | cb_12_1 = setCombo(cb_12_1, Set, P_NAV_GPS_MODE); |
- | |
1448 | cb_12_2 = setCombo(cb_12_2, Set, P_NAV_GPS_GAIN); |
- | |
1449 | sb_12_3->setValue(ParameterSet[Set][P_NAV_STICK_THRE]); |
- | |
1450 | sb_12_4->setValue(ParameterSet[Set][P_NAV_GPS_MIN]); |
- | |
1451 | cb_12_5 = setCombo(cb_12_5, Set, P_NAV_GPS_P); |
- | |
1452 | cb_12_6 = setCombo(cb_12_6, Set, P_NAV_GPS_I); |
- | |
1453 | cb_12_7 = setCombo(cb_12_7, Set, P_NAV_GPS_D); |
- | |
1454 | cb_12_8 = setCombo(cb_12_8, Set, P_NAV_GPS_ACC); |
- | |
1455 | } |
- | |
1456 | - | ||
1457 | // Seite 13 |
- | |
1458 | { |
- | |
1459 | cb_13_1 = setCombo(cb_13_1, Set, P_NAV_WIND_CORR); |
- | |
1460 | cb_13_2 = setCombo(cb_13_2, Set, P_NAV_SPEED_COMP); |
- | |
1461 | cb_13_3 = setCombo(cb_13_3, Set, P_NAV_RADIUS); |
- | |
1462 | cb_13_4 = setCombo(cb_13_4, Set, P_NAV_ANGLE_LIMIT); |
- | |
1463 | } |
- | |
1464 | - | ||
1465 | - | ||
Line -... | Line 664... | ||
- | 664 | ||
1466 | } |
665 | |
1467 | 666 | // Wechsel der Tabs erkennen |
|
1468 | void MKTool::slot_TabChanged(int Tab) // DONE 0.71g |
667 | void MKTool::slot_TabChanged(int Tab) // DONE 0.71g |
1469 | { |
668 | { |
1470 | Tab = Tab; |
669 | Tab = Tab; |
1471 | if (tab_Main->count() != 0) |
670 | if (tab_Main->count() != 0) |
1472 | { |
671 | { |
1473 | if ((tab_Main->currentWidget()->objectName() == QString("Tab_2")) && (tab_Par->currentIndex() == 1)) |
672 | if ((tab_Main->currentWidget()->objectName() == QString("Tab_2")) && (f_Settings->tab_Par->currentIndex() == 1)) |
1474 | { |
673 | { |
Line 1475... | Line 674... | ||
1475 | TX_Data[0] = 0; |
674 | TX_Data[0] = 0; |
Line 1499... | Line 698... | ||
1499 | TickerEvent[2] = false; |
698 | TickerEvent[2] = false; |
1500 | } |
699 | } |
1501 | } |
700 | } |
1502 | } |
701 | } |
Line -... | Line 702... | ||
- | 702 | ||
1503 | 703 | // LCD-Seiten weiterschalten |
|
1504 | void MKTool::slot_LCD_UP() // DONE 0.71g |
704 | void MKTool::slot_LCD_UP() // DONE 0.71g |
1505 | { |
705 | { |
1506 | if (LCD_Page == LCD_MAX_Page) |
706 | if (LCD_Page == LCD_MAX_Page) |
1507 | TX_Data[0] = 0; |
707 | TX_Data[0] = 0; |
Line 1521... | Line 721... | ||
1521 | 721 | ||
1522 | TX_Data[1] = 0; |
722 | TX_Data[1] = 0; |
1523 | send_Data('l', ADDRESS_ALL, TX_Data, 1, true); |
723 | send_Data('l', ADDRESS_ALL, TX_Data, 1, true); |
Line -... | Line 724... | ||
- | 724 | } |
|
1524 | } |
725 | |
1525 | 726 | // Settings aus MK lesen / in MK schreiben |
|
1526 | void MKTool::slot_GetParameter() // DONE 0.71g |
727 | void MKTool::slot_GetParameter() // DONE 0.71g |
1527 | { |
728 | { |
1528 | TX_Data[0] = sb_Set->value(); |
729 | TX_Data[0] = f_Settings->sb_Set->value(); |
1529 | TX_Data[1] = 0; |
730 | TX_Data[1] = 0; |
Line 1530... | Line 731... | ||
1530 | send_Data('q', ADDRESS_FC, TX_Data, 1); |
731 | send_Data('q', ADDRESS_FC, TX_Data, 1); |
1531 | } |
732 | } |
1532 | 733 | ||
- | 734 | void MKTool::slot_SetParameter() // DONE 0.71g |
|
- | 735 | { |
|
Line 1533... | Line 736... | ||
1533 | void MKTool::slot_SetParameter() // DONE 0.71g |
736 | // store_ParameterSet(sb_Set->value()); |
1534 | { |
737 | /* |
Line 1535... | Line 738... | ||
1535 | store_ParameterSet(sb_Set->value()); |
738 | |
1536 | 739 | ||
1537 | TX_Data[0] = sb_Set->value(); |
740 | TX_Data[0] = sb_Set->value(); |
1538 | TX_Data[1] = VERSION_SETTINGS; |
741 | TX_Data[1] = VERSION_SETTINGS; |
Line 1539... | Line 742... | ||
1539 | 742 | ||
- | 743 | for (int a = 0; a < MaxParameter; a++) |
|
- | 744 | { |
|
- | 745 | TX_Data[a + 2] = ParameterSet[sb_Set->value()][a]; |
|
Line 1540... | Line 746... | ||
1540 | for (int a = 0; a < MaxParameter; a++) |
746 | } |
1541 | { |
747 | |
Line 1542... | Line 748... | ||
1542 | TX_Data[a + 2] = ParameterSet[sb_Set->value()][a]; |
748 | // store_ParameterSet(sb_Set->value()); |
1543 | } |
749 | */ |
1544 | 750 | ||
1545 | store_ParameterSet(sb_Set->value()); |
751 | char *TX_Data2 = f_Settings->SetParameter(); |
1546 | - | ||
1547 | send_Data('s', ADDRESS_FC, TX_Data, MaxParameter + 2, false); |
752 | |
1548 | } |
753 | send_Data('s', ADDRESS_FC, TX_Data2, MaxParameter + 2, false); |
1549 | 754 | } |
|
1550 | 755 | ||
1551 | // Save GUI-Settings |
756 | |
Line 1562... | Line 767... | ||
1562 | 767 | ||
1563 | Settings->GUI.Term_Info = cb_ShowMSG->isChecked(); |
768 | Settings->GUI.Term_Info = cb_ShowMSG->isChecked(); |
1564 | Settings->GUI.Term_Data = cb_ShowData->isChecked(); |
769 | Settings->GUI.Term_Data = cb_ShowData->isChecked(); |
1565 | Settings->GUI.Term_Always = cb_ShowAlways->isChecked(); |
770 | Settings->GUI.Term_Always = cb_ShowAlways->isChecked(); |
- | 771 | Settings->GUI.Term_Send = cb_ShowSend->isChecked(); |
|
- | 772 | Settings->GUI.isMax = isMaximized(); |
|
- | 773 | Settings->GUI.Size = size(); |
|
Line 1566... | Line 774... | ||
1566 | Settings->GUI.Term_Send = cb_ShowSend->isChecked(); |
774 | Settings->GUI.Point = pos(); |
1567 | - | ||
1568 | Settings->TTY.Port = le_Port->text(); |
- | |
1569 | - | ||
1570 | QSettings Setting("KeyOz-Net", "QMK-Groundstation"); |
- | |
1571 | - | ||
1572 | Setting.beginGroup("GUI"); |
- | |
1573 | Setting.setValue("IsMax", isMaximized()); |
- | |
1574 | Setting.setValue("Size", size()); |
- | |
1575 | Setting.setValue("Point", pos()); |
775 | |
Line 1576... | Line 776... | ||
1576 | Setting.endGroup(); |
776 | Settings->TTY.Port = le_Port->text(); |
1577 | } |
777 | } |
Line 1706... | Line 906... | ||
1706 | { |
906 | { |
1707 | } |
907 | } |
Line 1708... | Line 908... | ||
1708 | 908 | ||
Line 1709... | Line 909... | ||
1709 | int HardwareID = RX.Input[1] - 'a'; |
909 | int HardwareID = RX.Input[1] - 'a'; |
1710 | 910 | ||
- | 911 | switch(HardwareID) |
|
- | 912 | { |
|
- | 913 | case ADDRESS_FC : |
|
- | 914 | switch(RX.Input[2]) |
|
- | 915 | { |
|
- | 916 | // Stick-Belegung der Fernsteuerung |
|
- | 917 | case 'P' : // DONE 0.71g |
|
- | 918 | if (ToolBox::Decode64(RX)) |
|
- | 919 | { |
|
- | 920 | f_Settings->pb_K1->setValue(ToolBox::Data2Int(RX.Decode, 2,true)); |
|
- | 921 | f_Settings->pb_K2->setValue(ToolBox::Data2Int(RX.Decode, 4,true)); |
|
- | 922 | f_Settings->pb_K3->setValue(ToolBox::Data2Int(RX.Decode, 6,true)); |
|
- | 923 | f_Settings->pb_K4->setValue(ToolBox::Data2Int(RX.Decode, 8,true)); |
|
- | 924 | f_Settings->pb_K5->setValue(ToolBox::Data2Int(RX.Decode, 10 ,true)); |
|
- | 925 | f_Settings->pb_K6->setValue(ToolBox::Data2Int(RX.Decode, 12,true)); |
|
- | 926 | f_Settings->pb_K7->setValue(ToolBox::Data2Int(RX.Decode, 14,true)); |
|
- | 927 | f_Settings->pb_K8->setValue(ToolBox::Data2Int(RX.Decode, 16,true)); |
|
- | 928 | } |
|
- | 929 | break; |
|
- | 930 | // Settings lesen |
|
- | 931 | case 'Q' : // DONE 0.71g |
|
- | 932 | if (ToolBox::Decode64(RX)) |
|
- | 933 | { |
|
- | 934 | TickerEvent[0] = false; |
|
- | 935 | ||
- | 936 | if (RX.Decode[1] == VERSION_SETTINGS) |
|
- | 937 | { |
|
- | 938 | int Settings_ID = RX.Decode[0]; |
|
- | 939 | for (int a = 0; a < MaxParameter; a++) |
|
- | 940 | { |
|
- | 941 | ParameterSet[Settings_ID][a] = RX.Decode[a + 2]; |
|
- | 942 | } |
|
- | 943 | //show_ParameterSet(Settings_ID); |
|
- | 944 | f_Settings->show_ParameterSet(Settings_ID, ParameterSet); |
|
- | 945 | } |
|
- | 946 | else |
|
- | 947 | { |
|
- | 948 | f_Settings->pb_Read->setDisabled(true); |
|
- | 949 | f_Settings->pb_Write->setDisabled(true); |
|
- | 950 | ||
- | 951 | QMessageBox::warning(this, QA_NAME, |
|
- | 952 | "Versionen inkompatibel. \nParameterbearbeitung nicht moeglich.", QMessageBox::Ok); |
|
- | 953 | } |
|
- | 954 | } |
|
- | 955 | break; |
|
- | 956 | // Settings geschrieben |
|
- | 957 | case 'S' : // DONE 0.71g |
|
- | 958 | TickerEvent[0] = false; |
|
- | 959 | break; |
|
- | 960 | } |
|
- | 961 | ||
- | 962 | case ADDRESS_NC : |
|
- | 963 | switch(RX.Input[2]) |
|
- | 964 | { |
|
- | 965 | // Navigationsdaten |
|
- | 966 | case 'O' : // NOT DONE 0.12h |
|
- | 967 | if (ToolBox::Decode64(RX)) |
|
- | 968 | { |
|
- | 969 | } |
|
- | 970 | break; |
|
- | 971 | } |
|
- | 972 | // case ADDRESS_MK3MAG : |
|
- | 973 | ||
- | 974 | default : |
|
- | 975 | switch(RX.Input[2]) |
|
1711 | switch(RX.Input[2]) |
976 | { |
1712 | { |
977 | // LCD-Anzeige |
1713 | case 'L' : // DONE 0.71g |
978 | case 'L' : // DONE 0.71g |
1714 | if (ToolBox::Decode64(RX, true)) |
979 | if (ToolBox::Decode64(RX)) |
1715 | { |
980 | { |
Line 1716... | Line 981... | ||
1716 | int LCD[150]; |
981 | int LCD[150]; |
Line 1725... | Line 990... | ||
1725 | le_LCD3->setText(ToolBox::Data2QString(LCD,62,82)); |
990 | le_LCD3->setText(ToolBox::Data2QString(LCD,62,82)); |
Line 1726... | Line 991... | ||
1726 | 991 | ||
1727 | TickerEvent[0] = false; |
992 | TickerEvent[0] = false; |
1728 | } |
993 | } |
1729 | break; |
- | |
1730 | case 'P' : // DONE 0.71g |
- | |
1731 | if (ToolBox::Decode64(RX, true)) |
- | |
1732 | { |
- | |
1733 | pb_K1->setValue(ToolBox::Data2Int(RX.Decode, 0,true)); |
- | |
1734 | pb_K2->setValue(ToolBox::Data2Int(RX.Decode, 2,true)); |
- | |
1735 | pb_K3->setValue(ToolBox::Data2Int(RX.Decode, 4,true)); |
- | |
1736 | pb_K4->setValue(ToolBox::Data2Int(RX.Decode, 6,true)); |
- | |
1737 | pb_K5->setValue(ToolBox::Data2Int(RX.Decode, 8,true)); |
- | |
1738 | pb_K6->setValue(ToolBox::Data2Int(RX.Decode, 10,true)); |
- | |
1739 | pb_K7->setValue(ToolBox::Data2Int(RX.Decode, 12,true)); |
- | |
1740 | pb_K8->setValue(ToolBox::Data2Int(RX.Decode, 14,true)); |
- | |
1741 | } |
994 | break; |
1742 | break; |
995 | // Analoglabels |
1743 | case 'A' : // DONE 0.71g |
996 | case 'A' : // DONE 0.71g |
1744 | if (ToolBox::Decode64(RX, true)) |
997 | if (ToolBox::Decode64(RX)) |
1745 | { |
998 | { |
1746 | int Position = RX.Decode[0]; |
999 | int Position = RX.Decode[0]; |
1747 | if (Position != 31) |
1000 | if (Position != 31) |
1748 | { |
1001 | { |
- | 1002 | Settings->Analog1.Label[Position] = ToolBox::Data2QString(RX.Decode,1,17).trimmed(); |
|
- | 1003 | if (Settings->Analog1.Label[Position] == "") |
|
- | 1004 | { |
|
- | 1005 | Settings->Analog1.Label[Position] = "A-" + QString("%1").arg(Position); |
|
1749 | Settings->Analog1.Label[Position] = ToolBox::Data2QString(RX.Decode,1,17).trimmed(); |
1006 | } |
1750 | Position ++; |
1007 | Position ++; |
1751 | TX_Data[0] = Position; |
1008 | TX_Data[0] = Position; |
1752 | send_Data('a', ADDRESS_ALL, TX_Data, 1, false); |
1009 | send_Data('a', ADDRESS_ALL, TX_Data, 1, true); |
1753 | } |
1010 | } |
1754 | if (Position == 31) |
1011 | if (Position == 31) |
1755 | { |
1012 | { |
1756 | for (int a = 0; a < MaxAnalog; a++) |
1013 | for (int a = 0; a < MaxAnalog; a++) |
Line 1761... | Line 1018... | ||
1761 | Settings->write_Settings_AnalogLabels(HardwareID); |
1018 | Settings->write_Settings_AnalogLabels(HardwareID); |
1762 | config_Plot(); |
1019 | config_Plot(); |
1763 | } |
1020 | } |
1764 | } |
1021 | } |
1765 | break; |
1022 | break; |
- | 1023 | // Debug-Daten |
|
1766 | case 'D' : // DONE 0.71g |
1024 | case 'D' : // DONE 0.71g |
1767 | if (ToolBox::Decode64(RX, true)) |
1025 | if (ToolBox::Decode64(RX)) |
1768 | { |
1026 | { |
1769 | for (int i = 0; i < MaxAnalog; i++) |
1027 | for (int i = 0; i < MaxAnalog; i++) |
1770 | { |
1028 | { |
1771 | AnalogData[i] = ToolBox::Data2Int(RX.Decode, (i * 2) + 2); |
1029 | AnalogData[i] = ToolBox::Data2Int(RX.Decode, (i * 2) + 2); |
1772 | } |
1030 | } |
1773 | show_DebugData(); |
1031 | show_DebugData(); |
1774 | } |
1032 | } |
1775 | break; |
1033 | break; |
1776 | case 'Q' : // DONE 0.71g |
1034 | // Version |
1777 | TickerEvent[0] = false; |
1035 | case 'V' : // DONE 0.71h |
1778 | - | ||
1779 | ToolBox::Decode64(RX, true); |
1036 | if (ToolBox::Decode64(RX)) |
1780 | - | ||
1781 | if (RX.Decode[1] == VERSION_SETTINGS) |
- | |
1782 | { |
1037 | { |
1783 | int Settings_ID = RX.Decode[0]; |
- | |
1784 | for (int a = 0; a < MaxParameter; a++) |
- | |
1785 | { |
- | |
1786 | ParameterSet[Settings_ID][a] = RX.Decode[a + 2]; |
- | |
1787 | } |
- | |
1788 | // memcpy(ParameterSet[Settings_ID],RX.Decode, sizeof(RX.Decode)); |
- | |
1789 | show_ParameterSet(Settings_ID); |
- | |
1790 | } |
- | |
1791 | else |
- | |
1792 | { |
- | |
1793 | pb_Read->setDisabled(true); |
- | |
1794 | pb_Write->setDisabled(true); |
- | |
1795 | - | ||
1796 | QMessageBox::warning(this, QA_NAME, |
- | |
1797 | "Versionen inkompatibel. \nParameterbearbeitung nicht moeglich.", QMessageBox::Ok); |
- | |
1798 | } |
- | |
1799 | - | ||
1800 | break; |
- | |
1801 | case 'S' : // DONE 0.71g |
- | |
1802 | TickerEvent[0] = false; |
- | |
1803 | qDebug("Settings set...!!!"); |
- | |
1804 | break; |
- | |
1805 | case 'V' : // DONE 0.71g |
- | |
1806 | TickerEvent[0] = false; |
1038 | TickerEvent[0] = false; |
Line 1807... | Line 1039... | ||
1807 | 1039 | ||
- | 1040 | Mode.ID = HardwareID; |
|
- | 1041 | Mode.VERSION_MAJOR = RX.Decode[0]; |
|
- | 1042 | Mode.VERSION_MINOR = RX.Decode[1]; |
|
- | 1043 | Mode.VERSION_PATCH = RX.Decode[4]; |
|
- | 1044 | Mode.VERSION_SERIAL_MAJOR = RX.Decode[2]; |
|
Line 1808... | Line 1045... | ||
1808 | ToolBox::Decode64(RX, true); |
1045 | Mode.VERSION_SERIAL_MINOR = RX.Decode[3]; |
1809 | - | ||
1810 | Mode.ID = RX.Input[1] - 'a'; |
- | |
1811 | Mode.VERSION_MAJOR = RX.Decode[0]; |
- | |
1812 | Mode.VERSION_MINOR = RX.Decode[1]; |
- | |
1813 | Mode.VERSION_PATCH = RX.Decode[4]; |
1046 | |
Line 1814... | Line -... | ||
1814 | Mode.VERSION_SERIAL_MAJOR = RX.Decode[2]; |
- | |
1815 | Mode.VERSION_SERIAL_MINOR = RX.Decode[3]; |
1047 | Mode.Hardware = HardwareType[Mode.ID]; |
Line 1816... | Line 1048... | ||
1816 | 1048 | Mode.Version = QString("%1").arg(RX.Decode[0]) + "." + QString("%1").arg(RX.Decode[1]) + QString(RX.Decode[4] + 'a'); |
|
- | 1049 | ||
- | 1050 | setWindowTitle(QA_NAME + " v" + QA_VERSION + " - " + Mode.Hardware + " " + Mode.Version); |
|
- | 1051 | ||
- | 1052 | if (Mode.VERSION_SERIAL_MAJOR != VERSION_SERIAL_MAJOR) |
|
- | 1053 | { |
|
Line 1817... | Line 1054... | ||
1817 | Mode.Hardware = HardwareType[Mode.ID]; |
1054 | AllowSend = false; |
1818 | Mode.Version = QString("%1").arg(RX.Decode[0]) + "." + QString("%1").arg(RX.Decode[1]) + QString(RX.Decode[4] + 'a'); |
1055 | QMessageBox::warning(this, QA_NAME, |
1819 | 1056 | "Serielles Protokoll Inkompatibel. \nBitte neue Programmversion installieren,", QMessageBox::Ok); |
|
1820 | setWindowTitle(QA_NAME + " v" + QA_VERSION + " - " + Mode.Hardware + " " + Mode.Version); |
1057 | } |
1821 | - | ||
1822 | if (Mode.VERSION_SERIAL_MAJOR != VERSION_SERIAL_MAJOR) |
1058 | |
Line 1823... | Line 1059... | ||
1823 | { |
1059 | // Wenn MK3MAG dann andauernd Daten neu anfragen. |
1824 | AllowSend = false; |
1060 | if (Mode.ID == ADDRESS_MK3MAG) |
Line 1825... | Line 1061... | ||
1825 | QMessageBox::warning(this, QA_NAME, |
1061 | { |
1826 | "Serielles Protokoll Inkompatibel. \nBitte neue Programmversion installieren,", QMessageBox::Ok); |
1062 | TickerEvent[3] = true; |
1827 | } |
1063 | } |
- | 1064 | ||
1828 | 1065 | TX_Data[0] = Settings->Data.Debug_Slow / 10; |
|
1829 | TX_Data[0] = Settings->Data.Debug_Slow / 10; |
1066 | send_Data('d', ADDRESS_ALL, TX_Data, 1, false); |
1830 | send_Data('d', ADDRESS_ALL, TX_Data, 1, false); |
1067 | |
- | 1068 | // Wenn FlightCtrl dann Settings abfragen. |
|
- | 1069 | if (Mode.ID == ADDRESS_FC) |
|
- | 1070 | { |
|
- | 1071 | { |
|
- | 1072 | TX_Data[0] = 0xff; |
|
- | 1073 | TX_Data[1] = 0; |
|
- | 1074 | send_Data('q', ADDRESS_FC, TX_Data, 1); |
|
1831 | 1075 | } |
|
1832 | if (Mode.ID == ADDRESS_FC) |
- | |
1833 | { |
- | |
1834 | { |
- | |
1835 | TX_Data[0] = 0xff; |
- | |
1836 | TX_Data[1] = 0; |
- | |
1837 | send_Data('q', ADDRESS_FC, TX_Data, 1); |
- | |
1838 | } |
- | |
1839 | } |
- | |
1840 | else |
- | |
Line 1841... | Line 1076... | ||
1841 | { |
1076 | } |
1842 | pb_Read->setDisabled(true); |
1077 | // Wenn nicht Lesen und Schreiben der Settings deaktivieren. |
Line 1843... | Line 1078... | ||
1843 | pb_Write->setDisabled(true); |
1078 | else |
1844 | 1079 | { |
|
1845 | // QMessageBox::warning(this, QA_NAME, |
1080 | f_Settings->pb_Read->setDisabled(true); |
1846 | // "Keine Verbindung zur FlightCtrl. \nParameterbearbeitung nicht moeglich.", QMessageBox::Ok); |
1081 | f_Settings->pb_Write->setDisabled(true); |
1847 | } |
1082 | } |
1848 | 1083 | ||
1849 | Settings->read_Settings_Analog(HardwareID); |
1084 | Settings->read_Settings_Analog(HardwareID); |
1850 | Settings->read_Settings_AnalogLabels(HardwareID); |
1085 | Settings->read_Settings_AnalogLabels(HardwareID); |
1851 | 1086 | ||
- | 1087 | if (Settings->Analog1.Version != Mode.Version) |
|
- | 1088 | { |
|
1852 | if (Settings->Analog1.Version != Mode.Version) |
1089 | lb_Status->setText("Analoglabel-Version unterschiedlich. Lese Analoglabels neu aus."); |
1853 | { |
- | |
1854 | lb_Status->setText("Analoglabel-Version unterschiedlich. Lese Analoglabels neu aus."); |
- | |
1855 | slot_ac_GetLabels(); |
1090 | slot_ac_GetLabels(); |
- | 1091 | } |
|
1856 | } |
1092 | else |
1857 | else |
1093 | for (int a = 0; a < MaxAnalog; a++) |
Line 1858... | Line 1094... | ||
1858 | for (int a = 0; a < MaxAnalog; a++) |
1094 | { |
1859 | { |
1095 | lb_Analog[a]->setText(Settings->Analog1.Label[a]); |
Line 1928... | Line 1164... | ||
1928 | serialPort->close(); |
1164 | serialPort->close(); |
1929 | pb_Open->setText("Verbinden"); |
1165 | pb_Open->setText("Verbinden"); |
1930 | ac_ConnectTTY->setText("Verbinden"); |
1166 | ac_ConnectTTY->setText("Verbinden"); |
1931 | pb_Open->setIcon(Icons[9]); |
1167 | pb_Open->setIcon(Icons[9]); |
1932 | ac_ConnectTTY->setIcon(Icons[9]); |
1168 | ac_ConnectTTY->setIcon(Icons[9]); |
- | 1169 | ||
- | 1170 | Ticker->stop(); |
|
1933 | } |
1171 | } |
1934 | else |
1172 | else |
1935 | { |
1173 | { |
1936 | serialPort->setPort(le_Port->text()); //Port |
1174 | serialPort->setPort(le_Port->text()); //Port |
Line 1954... | Line 1192... | ||
1954 | 1192 | ||
1955 | pb_Open->setText("Trennen"); |
1193 | pb_Open->setText("Trennen"); |
1956 | ac_ConnectTTY->setText("Trennen"); |
1194 | ac_ConnectTTY->setText("Trennen"); |
1957 | pb_Open->setIcon(Icons[8]); |
1195 | pb_Open->setIcon(Icons[8]); |
- | 1196 | ac_ConnectTTY->setIcon(Icons[8]); |
|
- | 1197 | ||
1958 | ac_ConnectTTY->setIcon(Icons[8]); |
1198 | Ticker->start(2000); |
1959 | } |
1199 | } |
1960 | } |
1200 | } |
Line 1961... | Line 1201... | ||
1961 | } |
1201 | } |
Line 2002... | Line 1242... | ||
2002 | if (serialPort->isOpen()) |
1242 | if (serialPort->isOpen()) |
2003 | { |
1243 | { |
2004 | serialPort->close(); |
1244 | serialPort->close(); |
2005 | } |
1245 | } |
Line 2006... | Line 1246... | ||
2006 | 1246 | ||
2007 | write_Settings(); |
1247 | set_Preferences(); |
Line 2008... | Line 1248... | ||
2008 | Settings->write_Settings(); |
1248 | Settings->write_Settings(); |
2009 | 1249 | ||
2010 | if (CSVFile->isOpen()) |
1250 | if (CSVFile->isOpen()) |