Rev 159 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 159 | Rev 162 | ||
---|---|---|---|
1 | /*************************************************************************** |
1 | /*************************************************************************** |
2 | * Copyright (C) 2008 by Manuel Schrape * |
2 | * Copyright (C) 2008 by Manuel Schrape * |
3 | * manuel.schrape@gmx.de * |
3 | * manuel.schrape@gmx.de * |
4 | * * |
4 | * * |
5 | * This program is free software; you can redistribute it and/or modify * |
5 | * This program is free software; you can redistribute it and/or modify * |
6 | * it under the terms of the GNU General Public License as published by * |
6 | * it under the terms of the GNU General Public License as published by * |
7 | * the Free Software Foundation; either version 2 of the License. * |
7 | * the Free Software Foundation; either version 2 of the License. * |
8 | * * |
8 | * * |
9 | * This program is distributed in the hope that it will be useful, * |
9 | * This program is distributed in the hope that it will be useful, * |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
12 | * GNU General Public License for more details. * |
12 | * GNU General Public License for more details. * |
13 | * * |
13 | * * |
14 | * You should have received a copy of the GNU General Public License * |
14 | * You should have received a copy of the GNU General Public License * |
15 | * along with this program; if not, write to the * |
15 | * along with this program; if not, write to the * |
16 | * Free Software Foundation, Inc., * |
16 | * Free Software Foundation, Inc., * |
17 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
17 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
18 | ***************************************************************************/ |
18 | ***************************************************************************/ |
19 | 19 | ||
20 | #include <QtGui> |
20 | #include <QtGui> |
21 | 21 | ||
22 | #include <QLineEdit> |
22 | #include <QLineEdit> |
23 | #include <QString> |
23 | #include <QString> |
24 | #include <QTimer> |
24 | #include <QTimer> |
25 | #include <QIcon> |
25 | #include <QIcon> |
26 | #include <QToolButton> |
26 | #include <QToolButton> |
27 | #include <QSpinBox> |
27 | #include <QSpinBox> |
28 | 28 | ||
29 | #include "mktool.h" |
29 | #include "mktool.h" |
30 | #include "dlg_Config.h" |
30 | #include "dlg_Config.h" |
31 | #include "dlg_Motortest.h" |
31 | #include "dlg_Motortest.h" |
32 | #include "dlg_Preferences.h" |
32 | #include "dlg_Preferences.h" |
33 | #include "../global.h" |
33 | #include "../global.h" |
34 | #include "../ToolBox.h" |
34 | #include "../ToolBox.h" |
35 | 35 | ||
36 | #include <stdlib.h> |
36 | #include <stdlib.h> |
37 | 37 | ||
38 | MKTool::MKTool() |
38 | MKTool::MKTool() |
39 | { |
39 | { |
40 | setupUi(this); |
40 | setupUi(this); |
41 | 41 | ||
42 | Settings = new cSettings; |
42 | Settings = new cSettings; |
43 | Settings->read_Settings(); |
43 | // Settings->read_Settings(); |
44 | Settings->read_Settings_FC(); |
44 | // Settings->read_Settings_FC(); |
45 | 45 | ||
46 | init_Arrays(); |
46 | init_Arrays(); |
47 | init_Icons(); |
47 | init_Icons(); |
48 | init_GUI(); |
48 | init_GUI(); |
49 | 49 | ||
50 | init_Objects(); |
50 | init_Objects(); |
51 | init_Connections(); |
51 | init_Connections(); |
52 | 52 | ||
53 | init_Plot(); |
53 | init_Plot(); |
54 | 54 | ||
55 | Ticker->start(2000); |
55 | Ticker->start(2000); |
56 | } |
56 | } |
57 | 57 | ||
58 | void MKTool::init_GUI() |
58 | void MKTool::init_GUI() |
59 | { |
59 | { |
60 | setWindowTitle(QA_NAME + " v" + QA_VERSION); |
60 | setWindowTitle(QA_NAME + " v" + QA_VERSION); |
61 | 61 | ||
62 | #ifdef _EEEPC_ |
62 | #ifdef _EEEPC_ |
63 | toolBar->hide(); |
63 | toolBar->hide(); |
64 | #endif |
64 | #endif |
65 | 65 | ||
66 | resize(Settings->GUI.Size); |
66 | resize(Settings->GUI.Size); |
67 | move(Settings->GUI.Point); |
67 | move(Settings->GUI.Point); |
68 | 68 | ||
69 | if (Settings->GUI.isMax) |
69 | if (Settings->GUI.isMax) |
70 | { |
70 | { |
71 | showMaximized(); |
71 | showMaximized(); |
72 | } |
72 | } |
73 | 73 | ||
74 | for (int a = 0; a < MaxAnalog; a++) |
74 | for (int a = 0; a < MaxAnalog; a++) |
75 | { |
75 | { |
76 | lb_Analog[a]->setText(Settings->Analog[a].Name); |
76 | lb_Analog[a]->setText(Settings->Analog1.Label[a]); |
77 | } |
77 | } |
78 | 78 | ||
79 | for (int b = 0; b < 6; b++) |
79 | for (int b = 0; b < 6; b++) |
80 | { |
80 | { |
81 | TabWidgets[b] = tab_Main->widget(b); |
81 | TabWidgets[b] = tab_Main->widget(b); |
82 | } |
82 | } |
83 | 83 | ||
84 | for (int c = 0; c < 6; c++) |
84 | for (int c = 0; c < 6; c++) |
85 | { |
85 | { |
86 | if (Settings->GUI.TabViews[c] == false) |
86 | if (Settings->GUI.TabViews[c] == false) |
87 | { |
87 | { |
88 | QString TabName = QString("Tab_%1").arg(c); |
88 | QString TabName = QString("Tab_%1").arg(c); |
89 | 89 | ||
90 | for (int d = 0; d < tab_Main->count(); d++) |
90 | for (int d = 0; d < tab_Main->count(); d++) |
91 | { |
91 | { |
92 | if (tab_Main->widget(d)->objectName() == TabName) |
92 | if (tab_Main->widget(d)->objectName() == TabName) |
93 | { |
93 | { |
94 | tab_Main->removeTab(d); |
94 | tab_Main->removeTab(d); |
95 | } |
95 | } |
96 | } |
96 | } |
97 | } |
97 | } |
98 | } |
98 | } |
99 | 99 | ||
100 | ac_View0->setChecked(Settings->GUI.TabViews[0]); |
100 | ac_View0->setChecked(Settings->GUI.TabViews[0]); |
101 | ac_View1->setChecked(Settings->GUI.TabViews[1]); |
101 | ac_View1->setChecked(Settings->GUI.TabViews[1]); |
102 | ac_View2->setChecked(Settings->GUI.TabViews[2]); |
102 | ac_View2->setChecked(Settings->GUI.TabViews[2]); |
103 | ac_View3->setChecked(Settings->GUI.TabViews[3]); |
103 | ac_View3->setChecked(Settings->GUI.TabViews[3]); |
104 | ac_View4->setChecked(Settings->GUI.TabViews[4]); |
104 | ac_View4->setChecked(Settings->GUI.TabViews[4]); |
105 | ac_View5->setChecked(Settings->GUI.TabViews[5]); |
105 | ac_View5->setChecked(Settings->GUI.TabViews[5]); |
106 | 106 | ||
107 | le_Port->setText(Settings->TTY.Port); |
107 | le_Port->setText(Settings->TTY.Port); |
- | 108 | ||
- | 109 | cb_ShowMSG->setChecked(Settings->GUI.Term_Info); |
|
- | 110 | cb_ShowData->setChecked(Settings->GUI.Term_Data); |
|
- | 111 | cb_ShowAlways->setChecked(Settings->GUI.Term_Always); |
|
108 | } |
112 | } |
109 | 113 | ||
110 | void MKTool::init_Objects() |
114 | void MKTool::init_Objects() |
111 | { |
115 | { |
112 | // QTimer-Instanzen |
116 | // QTimer-Instanzen |
113 | Ticker = new QTimer(this); |
117 | Ticker = new QTimer(this); |
114 | 118 | ||
115 | // Seriell-Port |
119 | // Seriell-Port |
116 | serialPort = new ManageSerialPort; |
120 | serialPort = new ManageSerialPort; |
117 | 121 | ||
118 | // QFile-Instanz (Log-Datei) |
122 | // QFile-Instanz (Log-Datei) |
119 | CSVFile = new QFile(""); |
123 | CSVFile = new QFile(""); |
120 | 124 | ||
121 | AllowSend = true; |
125 | AllowSend = true; |
122 | } |
126 | } |
123 | 127 | ||
124 | void MKTool::init_Connections() |
128 | void MKTool::init_Connections() |
125 | { |
129 | { |
126 | // Seriel-Port Empfang |
130 | // Seriel-Port Empfang |
127 | connect(serialPort, SIGNAL(newDataReceived(const QByteArray &)), this, SLOT(slot_newDataReceived(const QByteArray &))); |
131 | connect(serialPort, SIGNAL(newDataReceived(const QByteArray &)), this, SLOT(slot_newDataReceived(const QByteArray &))); |
128 | 132 | ||
129 | // Buttons und Menüpunkte / Toolbar |
133 | // Buttons und Menüpunkte / Toolbar |
130 | connect(pb_Load, SIGNAL(clicked()), this, SLOT(slot_LoadParameter())); |
134 | connect(pb_Load, SIGNAL(clicked()), this, SLOT(slot_LoadParameter())); |
131 | connect(pb_Save, SIGNAL(clicked()), this, SLOT(slot_SaveParameter())); |
135 | connect(pb_Save, SIGNAL(clicked()), this, SLOT(slot_SaveParameter())); |
132 | connect(pb_Read, SIGNAL(clicked()), this, SLOT(slot_GetParameter())); |
136 | connect(pb_Read, SIGNAL(clicked()), this, SLOT(slot_GetParameter())); |
133 | connect(pb_Write, SIGNAL(clicked()), this, SLOT(slot_SetParameter())); |
137 | connect(pb_Write, SIGNAL(clicked()), this, SLOT(slot_SetParameter())); |
134 | 138 | ||
135 | connect(pb_LCDup, SIGNAL(clicked()), this, SLOT(slot_LCD_UP())); |
139 | connect(pb_LCDup, SIGNAL(clicked()), this, SLOT(slot_LCD_UP())); |
136 | connect(pb_LCDdown, SIGNAL(clicked()), this, SLOT(slot_LCD_DOWN())); |
140 | connect(pb_LCDdown, SIGNAL(clicked()), this, SLOT(slot_LCD_DOWN())); |
137 | 141 | ||
138 | // Actions |
142 | // Actions |
139 | connect(ac_Config, SIGNAL(triggered()), this, SLOT(slot_ac_Config())); |
143 | connect(ac_Config, SIGNAL(triggered()), this, SLOT(slot_ac_Config())); |
140 | connect(ac_Preferences, SIGNAL(triggered()), this, SLOT(slot_ac_Preferences())); |
144 | connect(ac_Preferences, SIGNAL(triggered()), this, SLOT(slot_ac_Preferences())); |
141 | 145 | ||
142 | connect(ac_Motortest, SIGNAL(triggered()), this, SLOT(slot_ac_Motortest())); |
146 | connect(ac_Motortest, SIGNAL(triggered()), this, SLOT(slot_ac_Motortest())); |
143 | connect(ac_StartPlotter, SIGNAL(triggered()), this, SLOT(slot_ac_StartPlotter())); |
147 | connect(ac_StartPlotter, SIGNAL(triggered()), this, SLOT(slot_ac_StartPlotter())); |
144 | connect(ac_MehrDaten, SIGNAL(triggered()), this, SLOT(slot_ac_MehrDaten())); |
148 | connect(ac_MehrDaten, SIGNAL(triggered()), this, SLOT(slot_ac_MehrDaten())); |
145 | connect(ac_About, SIGNAL(triggered()), this, SLOT(slot_ac_About())); |
149 | connect(ac_About, SIGNAL(triggered()), this, SLOT(slot_ac_About())); |
146 | connect(ac_GetLabels, SIGNAL(triggered()), this, SLOT(slot_ac_GetLabels())); |
150 | connect(ac_GetLabels, SIGNAL(triggered()), this, SLOT(slot_ac_GetLabels())); |
147 | 151 | ||
148 | // Tabs ein & ausblenden |
152 | // Tabs ein & ausblenden |
149 | connect(ac_View0, SIGNAL(triggered()), this, SLOT(slot_ac_View())); |
153 | connect(ac_View0, SIGNAL(triggered()), this, SLOT(slot_ac_View())); |
150 | connect(ac_View1, SIGNAL(triggered()), this, SLOT(slot_ac_View())); |
154 | connect(ac_View1, SIGNAL(triggered()), this, SLOT(slot_ac_View())); |
151 | connect(ac_View2, SIGNAL(triggered()), this, SLOT(slot_ac_View())); |
155 | connect(ac_View2, SIGNAL(triggered()), this, SLOT(slot_ac_View())); |
152 | connect(ac_View3, SIGNAL(triggered()), this, SLOT(slot_ac_View())); |
156 | connect(ac_View3, SIGNAL(triggered()), this, SLOT(slot_ac_View())); |
153 | connect(ac_View4, SIGNAL(triggered()), this, SLOT(slot_ac_View())); |
157 | connect(ac_View4, SIGNAL(triggered()), this, SLOT(slot_ac_View())); |
154 | connect(ac_View5, SIGNAL(triggered()), this, SLOT(slot_ac_View())); |
158 | connect(ac_View5, SIGNAL(triggered()), this, SLOT(slot_ac_View())); |
155 | 159 | ||
156 | connect(pb_Update, SIGNAL(clicked()), this, SLOT(slot_pb_Update())); |
160 | // connect(pb_Update, SIGNAL(clicked()), this, SLOT(slot_pb_Update())); |
157 | - | ||
158 | connect(ac_ConnectTTY, SIGNAL(triggered()), this, SLOT(slot_OpenPort())); |
161 | |
159 | connect(ac_Quit, SIGNAL(triggered()), this, SLOT(slot_Quit())); |
162 | connect(ac_ConnectTTY, SIGNAL(triggered()), this, SLOT(slot_OpenPort())); |
160 | connect(ac_RecordCSV, SIGNAL(triggered()), this, SLOT(slot_RecordCSV())); |
163 | connect(ac_RecordCSV, SIGNAL(triggered()), this, SLOT(slot_RecordCSV())); |
161 | 164 | ||
162 | connect(ac_LogDir, SIGNAL(triggered()), this, SLOT(slot_SetLogDir())); |
165 | connect(ac_LogDir, SIGNAL(triggered()), this, SLOT(slot_SetLogDir())); |
163 | connect(ac_ParameterDir, SIGNAL(triggered()), this, SLOT(slot_SetParDir())); |
166 | connect(ac_ParameterDir, SIGNAL(triggered()), this, SLOT(slot_SetParDir())); |
164 | 167 | ||
165 | // Timer-Events |
168 | // Timer-Events |
166 | // connect(timer, SIGNAL(timeout()), SLOT(slot_Timer())); |
- | |
167 | // connect(Poll, SIGNAL(timeout()), SLOT(slot_Poll())); |
- | |
168 | connect(Ticker, SIGNAL(timeout()), SLOT(slot_Ticker())); |
169 | connect(Ticker, SIGNAL(timeout()), SLOT(slot_Ticker())); |
169 | 170 | ||
170 | // Seitenwechsel :) |
171 | // Seitenwechsel :) |
171 | connect(tab_Main, SIGNAL(currentChanged(int)), this, SLOT(slot_TabChanged(int))); |
172 | connect(tab_Main, SIGNAL(currentChanged(int)), this, SLOT(slot_TabChanged(int))); |
172 | connect(tab_Par, SIGNAL(currentChanged(int)), this, SLOT(slot_TabChanged(int))); |
173 | connect(tab_Par, SIGNAL(currentChanged(int)), this, SLOT(slot_TabChanged(int))); |
173 | 174 | ||
174 | // Parameterevents |
175 | // Parameterevents |
175 | connect(tb_9_6, SIGNAL(clicked()), this, SLOT(slot_tbUp())); |
176 | connect(tb_9_6, SIGNAL(clicked()), this, SLOT(slot_tbUp())); |
176 | connect(tb_9_7, SIGNAL(clicked()), this, SLOT(slot_tbDown())); |
177 | connect(tb_9_7, SIGNAL(clicked()), this, SLOT(slot_tbDown())); |
177 | connect(tb_9_8, SIGNAL(clicked()), this, SLOT(slot_tbLeft())); |
178 | connect(tb_9_8, SIGNAL(clicked()), this, SLOT(slot_tbLeft())); |
178 | connect(tb_9_9, SIGNAL(clicked()), this, SLOT(slot_tbRight())); |
179 | connect(tb_9_9, SIGNAL(clicked()), this, SLOT(slot_tbRight())); |
179 | 180 | ||
180 | connect(J16_0, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
181 | connect(J16_0, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
181 | connect(J16_1, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
182 | connect(J16_1, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
182 | connect(J16_2, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
183 | connect(J16_2, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
183 | connect(J16_3, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
184 | connect(J16_3, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
184 | connect(J16_4, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
185 | connect(J16_4, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
185 | connect(J16_5, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
186 | connect(J16_5, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
186 | connect(J16_6, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
187 | connect(J16_6, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
187 | connect(J16_7, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
188 | connect(J16_7, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
188 | 189 | ||
189 | connect(J17_0, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
190 | connect(J17_0, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
190 | connect(J17_1, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
191 | connect(J17_1, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
191 | connect(J17_2, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
192 | connect(J17_2, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
192 | connect(J17_3, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
193 | connect(J17_3, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
193 | connect(J17_4, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
194 | connect(J17_4, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
194 | connect(J17_5, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
195 | connect(J17_5, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
195 | connect(J17_6, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
196 | connect(J17_6, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
196 | connect(J17_7, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
197 | connect(J17_7, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
197 | 198 | ||
198 | connect(sb_11_1, SIGNAL(valueChanged(int)), this, SLOT(slot_ValuetoLED16(int))); |
199 | connect(sb_11_1, SIGNAL(valueChanged(int)), this, SLOT(slot_ValuetoLED16(int))); |
199 | connect(sb_11_3, SIGNAL(valueChanged(int)), this, SLOT(slot_ValuetoLED17(int))); |
200 | connect(sb_11_3, SIGNAL(valueChanged(int)), this, SLOT(slot_ValuetoLED17(int))); |
200 | 201 | ||
201 | // Plotter |
202 | // Plotter |
202 | connect(scroll_plot, SIGNAL(valueChanged(int)), this, SLOT(slot_ScrollPlot(int))); |
203 | connect(scroll_plot, SIGNAL(valueChanged(int)), this, SLOT(slot_ScrollPlot(int))); |
203 | 204 | ||
204 | // About-QT Dialog einfügen |
205 | // About-QT Dialog einfügen |
205 | menu_Help->addAction(trUtf8("Über &Qt"), qApp, SLOT(aboutQt())); |
206 | menu_Help->addAction(trUtf8("Über &Qt"), qApp, SLOT(aboutQt())); |
206 | } |
207 | } |
207 | 208 | ||
208 | void MKTool::init_Arrays() |
209 | void MKTool::init_Arrays() |
209 | { |
210 | { |
210 | lb_Analog[0] = lb_A_0; |
211 | lb_Analog[0] = lb_A_0; |
211 | lb_Analog[1] = lb_A_1; |
212 | lb_Analog[1] = lb_A_1; |
212 | lb_Analog[2] = lb_A_2; |
213 | lb_Analog[2] = lb_A_2; |
213 | lb_Analog[3] = lb_A_3; |
214 | lb_Analog[3] = lb_A_3; |
214 | lb_Analog[4] = lb_A_4; |
215 | lb_Analog[4] = lb_A_4; |
215 | lb_Analog[5] = lb_A_5; |
216 | lb_Analog[5] = lb_A_5; |
216 | lb_Analog[6] = lb_A_6; |
217 | lb_Analog[6] = lb_A_6; |
217 | lb_Analog[7] = lb_A_7; |
218 | lb_Analog[7] = lb_A_7; |
218 | lb_Analog[8] = lb_A_8; |
219 | lb_Analog[8] = lb_A_8; |
219 | lb_Analog[9] = lb_A_9; |
220 | lb_Analog[9] = lb_A_9; |
220 | lb_Analog[10] = lb_A_10; |
221 | lb_Analog[10] = lb_A_10; |
221 | lb_Analog[11] = lb_A_11; |
222 | lb_Analog[11] = lb_A_11; |
222 | lb_Analog[12] = lb_A_12; |
223 | lb_Analog[12] = lb_A_12; |
223 | lb_Analog[13] = lb_A_13; |
224 | lb_Analog[13] = lb_A_13; |
224 | lb_Analog[14] = lb_A_14; |
225 | lb_Analog[14] = lb_A_14; |
225 | lb_Analog[15] = lb_A_15; |
226 | lb_Analog[15] = lb_A_15; |
226 | lb_Analog[16] = lb_A_16; |
227 | lb_Analog[16] = lb_A_16; |
227 | lb_Analog[17] = lb_A_17; |
228 | lb_Analog[17] = lb_A_17; |
228 | lb_Analog[18] = lb_A_18; |
229 | lb_Analog[18] = lb_A_18; |
229 | lb_Analog[19] = lb_A_19; |
230 | lb_Analog[19] = lb_A_19; |
230 | lb_Analog[20] = lb_A_20; |
231 | lb_Analog[20] = lb_A_20; |
231 | lb_Analog[21] = lb_A_21; |
232 | lb_Analog[21] = lb_A_21; |
232 | lb_Analog[22] = lb_A_22; |
233 | lb_Analog[22] = lb_A_22; |
233 | lb_Analog[23] = lb_A_23; |
234 | lb_Analog[23] = lb_A_23; |
234 | lb_Analog[24] = lb_A_24; |
235 | lb_Analog[24] = lb_A_24; |
235 | lb_Analog[25] = lb_A_25; |
236 | lb_Analog[25] = lb_A_25; |
236 | lb_Analog[26] = lb_A_26; |
237 | lb_Analog[26] = lb_A_26; |
237 | lb_Analog[27] = lb_A_27; |
238 | lb_Analog[27] = lb_A_27; |
238 | lb_Analog[28] = lb_A_28; |
239 | lb_Analog[28] = lb_A_28; |
239 | lb_Analog[29] = lb_A_29; |
240 | lb_Analog[29] = lb_A_29; |
240 | lb_Analog[30] = lb_A_30; |
241 | lb_Analog[30] = lb_A_30; |
241 | lb_Analog[31] = lb_A_31; |
242 | lb_Analog[31] = lb_A_31; |
242 | } |
243 | } |
243 | 244 | ||
244 | void MKTool::init_Plot() |
245 | void MKTool::init_Plot() |
245 | { |
246 | { |
246 | NextPlot = 0; |
247 | NextPlot = 0; |
247 | 248 | ||
248 | qwtPlot->setCanvasBackground(QColor(QRgb(0x00000000))); |
249 | qwtPlot->setCanvasBackground(QColor(QRgb(0x00000000))); |
249 | 250 | ||
250 | qwtPlot->insertLegend(new QwtLegend(), QwtPlot::RightLegend); |
251 | qwtPlot->insertLegend(new QwtLegend(), QwtPlot::RightLegend); |
251 | 252 | ||
252 | QwtPlotGrid *Grid = new QwtPlotGrid(); |
253 | QwtPlotGrid *Grid = new QwtPlotGrid(); |
253 | Grid->setMajPen(QPen(Qt::gray, 0, Qt::DotLine)); |
254 | Grid->setMajPen(QPen(Qt::gray, 0, Qt::DotLine)); |
254 | 255 | ||
255 | 256 | ||
256 | Grid->attach(qwtPlot); |
257 | Grid->attach(qwtPlot); |
257 | 258 | ||
258 | qwtPlot->setAxisScale(QwtPlot::xBottom,0,PlotWide,0); |
259 | qwtPlot->setAxisScale(QwtPlot::xBottom,0,PlotWide,0); |
259 | 260 | ||
260 | for (int a = 0; a < MaxAnalog; a++) |
261 | for (int a = 0; a < MaxAnalog; a++) |
261 | { |
262 | { |
262 | Plot[a] = new QwtPlotCurve(Settings->Analog[a].Name); |
263 | Plot[a] = new QwtPlotCurve(Settings->Analog1.Label[a]); |
263 | Plot[a]->setPen(QPen(QColor(Settings->Analog[a].Color))); |
264 | Plot[a]->setPen(QPen(QColor(Def_Colors[a]))); |
264 | // Plot[a]->setRenderHint(QwtPlotItem::RenderAntialiased); |
265 | // Plot[a]->setRenderHint(QwtPlotItem::RenderAntialiased); |
265 | 266 | ||
266 | if (Settings->Analog[a].Plot) |
267 | if (Settings->Analog1.PlotView[a]) |
267 | Plot[a]->attach(qwtPlot); |
268 | Plot[a]->attach(qwtPlot); |
268 | } |
269 | } |
269 | qwtPlot->replot(); |
270 | qwtPlot->replot(); |
270 | } |
271 | } |
271 | 272 | ||
272 | void MKTool::init_Icons() |
273 | void MKTool::init_Icons() |
273 | { |
274 | { |
274 | Icons[0].addPixmap(QPixmap(QString::fromUtf8(":/LED/Images/16X16/ledred.png")), QIcon::Normal, QIcon::Off); |
275 | Icons[0].addPixmap(QPixmap(QString::fromUtf8(":/LED/Images/16X16/ledred.png")), QIcon::Normal, QIcon::Off); |
275 | Icons[1].addPixmap(QPixmap(QString::fromUtf8(":/LED/Images/16X16/ledyellow.png")), QIcon::Normal, QIcon::Off); |
276 | Icons[1].addPixmap(QPixmap(QString::fromUtf8(":/LED/Images/16X16/ledyellow.png")), QIcon::Normal, QIcon::Off); |
276 | Icons[3].addPixmap(QPixmap(QString::fromUtf8(":/LED/Images/16X16/ledyellow.png")), QIcon::Normal, QIcon::Off); |
277 | Icons[3].addPixmap(QPixmap(QString::fromUtf8(":/LED/Images/16X16/ledyellow.png")), QIcon::Normal, QIcon::Off); |
277 | Icons[4].addPixmap(QPixmap(QString::fromUtf8(":/LED/Images/16X16/ledoff.png")), QIcon::Normal, QIcon::Off); |
278 | Icons[4].addPixmap(QPixmap(QString::fromUtf8(":/LED/Images/16X16/ledoff.png")), QIcon::Normal, QIcon::Off); |
278 | 279 | ||
279 | Icons[5].addPixmap(QPixmap(QString::fromUtf8(":/Actions/Images/22X22/application-exit.png")), QIcon::Normal, QIcon::Off); |
280 | Icons[5].addPixmap(QPixmap(QString::fromUtf8(":/Actions/Images/22X22/application-exit.png")), QIcon::Normal, QIcon::Off); |
280 | Icons[6].addPixmap(QPixmap(QString::fromUtf8(":/Actions/Images/22X22/media-playback-stop.png")), QIcon::Normal, QIcon::Off); |
281 | Icons[6].addPixmap(QPixmap(QString::fromUtf8(":/Actions/Images/22X22/media-playback-stop.png")), QIcon::Normal, QIcon::Off); |
281 | Icons[7].addPixmap(QPixmap(QString::fromUtf8(":/Actions/Images/22X22/media-record.png")), QIcon::Normal, QIcon::Off); |
282 | Icons[7].addPixmap(QPixmap(QString::fromUtf8(":/Actions/Images/22X22/media-record.png")), QIcon::Normal, QIcon::Off); |
282 | Icons[8].addPixmap(QPixmap(QString::fromUtf8(":/Actions/Images/22X22/network-connect.png")), QIcon::Normal, QIcon::Off); |
283 | Icons[8].addPixmap(QPixmap(QString::fromUtf8(":/Actions/Images/22X22/network-connect.png")), QIcon::Normal, QIcon::Off); |
283 | Icons[9].addPixmap(QPixmap(QString::fromUtf8(":/Actions/Images/22X22/network-disconnect.png")), QIcon::Normal, QIcon::Off); |
284 | Icons[9].addPixmap(QPixmap(QString::fromUtf8(":/Actions/Images/22X22/network-disconnect.png")), QIcon::Normal, QIcon::Off); |
284 | Icons[10].addPixmap(QPixmap(QString::fromUtf8(":/Actions/Images/22X22/utilities-system-monitor.png")), QIcon::Normal, QIcon::Off); |
285 | Icons[10].addPixmap(QPixmap(QString::fromUtf8(":/Actions/Images/22X22/utilities-system-monitor.png")), QIcon::Normal, QIcon::Off); |
285 | 286 | ||
286 | Icons[20].addPixmap(QPixmap(QString::fromUtf8(":/Arrows/Images/32X32/arrow-up-double.png")), QIcon::Normal, QIcon::Off); |
287 | Icons[20].addPixmap(QPixmap(QString::fromUtf8(":/Arrows/Images/32X32/arrow-up-double.png")), QIcon::Normal, QIcon::Off); |
287 | Icons[21].addPixmap(QPixmap(QString::fromUtf8(":/Arrows/Images/32X32/arrow-up.png")), QIcon::Normal, QIcon::Off); |
288 | Icons[21].addPixmap(QPixmap(QString::fromUtf8(":/Arrows/Images/32X32/arrow-up.png")), QIcon::Normal, QIcon::Off); |
288 | Icons[22].addPixmap(QPixmap(QString::fromUtf8(":/Arrows/Images/32X32/arrow-down-double.png")), QIcon::Normal, QIcon::Off); |
289 | Icons[22].addPixmap(QPixmap(QString::fromUtf8(":/Arrows/Images/32X32/arrow-down-double.png")), QIcon::Normal, QIcon::Off); |
289 | Icons[23].addPixmap(QPixmap(QString::fromUtf8(":/Arrows/Images/32X32/arrow-down.png")), QIcon::Normal, QIcon::Off); |
290 | Icons[23].addPixmap(QPixmap(QString::fromUtf8(":/Arrows/Images/32X32/arrow-down.png")), QIcon::Normal, QIcon::Off); |
290 | Icons[24].addPixmap(QPixmap(QString::fromUtf8(":/Arrows/Images/32X32/arrow-left-double.png")), QIcon::Normal, QIcon::Off); |
291 | Icons[24].addPixmap(QPixmap(QString::fromUtf8(":/Arrows/Images/32X32/arrow-left-double.png")), QIcon::Normal, QIcon::Off); |
291 | Icons[25].addPixmap(QPixmap(QString::fromUtf8(":/Arrows/Images/32X32/arrow-left.png")), QIcon::Normal, QIcon::Off); |
292 | Icons[25].addPixmap(QPixmap(QString::fromUtf8(":/Arrows/Images/32X32/arrow-left.png")), QIcon::Normal, QIcon::Off); |
292 | Icons[26].addPixmap(QPixmap(QString::fromUtf8(":/Arrows/Images/32X32/arrow-right-double.png")), QIcon::Normal, QIcon::Off); |
293 | Icons[26].addPixmap(QPixmap(QString::fromUtf8(":/Arrows/Images/32X32/arrow-right-double.png")), QIcon::Normal, QIcon::Off); |
293 | Icons[27].addPixmap(QPixmap(QString::fromUtf8(":/Arrows/Images/32X32/arrow-right.png")), QIcon::Normal, QIcon::Off); |
294 | Icons[27].addPixmap(QPixmap(QString::fromUtf8(":/Arrows/Images/32X32/arrow-right.png")), QIcon::Normal, QIcon::Off); |
294 | } |
295 | } |
295 | 296 | ||
296 | 297 | ||
297 | // Ticker-Event |
298 | // Ticker-Event |
298 | /////////////// |
299 | /////////////// |
299 | void MKTool::slot_Ticker() |
300 | void MKTool::slot_Ticker() |
300 | { |
301 | { |
301 | if (TickerDiv) |
302 | if (TickerDiv) |
302 | TickerDiv = false; |
303 | TickerDiv = false; |
303 | else |
304 | else |
304 | TickerDiv = true; |
305 | TickerDiv = true; |
305 | 306 | ||
306 | for (int a = 0; a < MaxTickerEvents; a++) |
307 | for (int a = 0; a < MaxTickerEvents; a++) |
307 | { |
308 | { |
308 | if (TickerEvent[a] == true) |
309 | if (TickerEvent[a] == true) |
309 | { |
310 | { |
310 | switch(a) |
311 | switch(a) |
311 | { |
312 | { |
312 | case 0 : |
313 | case 0 : |
313 | if (TickerDiv) |
314 | if (TickerDiv) |
314 | { |
315 | { |
315 | QByteArray Temp(LastSend.toUtf8()); |
316 | QByteArray Temp(LastSend.toUtf8()); |
316 | serialPort->sendData(Temp); |
317 | serialPort->sendData(Temp); |
317 | } |
318 | } |
318 | break; |
319 | break; |
319 | case 1 : |
320 | case 1 : |
320 | TX_Data[0] = 0; |
321 | TX_Data[0] = 0; |
321 | send_Data('p', ADDRESS_FC, TX_Data, 0, false); |
322 | send_Data('p', ADDRESS_FC, TX_Data, 0, false); |
322 | break; |
323 | break; |
323 | case 2 : |
324 | case 2 : |
324 | TX_Data[0] = LCD_Page; |
325 | TX_Data[0] = LCD_Page; |
325 | TX_Data[1] = 0; |
326 | TX_Data[1] = 0; |
326 | send_Data('l', ADDRESS_ALL, TX_Data, 1, true); |
327 | send_Data('l', ADDRESS_ALL, TX_Data, 1, true); |
327 | break; |
328 | break; |
328 | } |
329 | } |
329 | } |
330 | } |
330 | } |
331 | } |
331 | } |
332 | } |
332 | 333 | ||
333 | 334 | ||
334 | // Slots der Actions (Menüpunkte, Buttons) |
335 | // Slots der Actions (Menüpunkte, Buttons) |
335 | ////////////////////////////////////////// |
336 | ////////////////////////////////////////// |
336 | void MKTool::slot_ac_Motortest() |
337 | void MKTool::slot_ac_Motortest() |
337 | { |
338 | { |
338 | dlg_Motortest *f_Motortest = new dlg_Motortest(this); |
339 | dlg_Motortest *f_Motortest = new dlg_Motortest(this); |
339 | 340 | ||
340 | connect(f_Motortest, SIGNAL(updateMotor(int, int, int, int)), this, SLOT(slot_Motortest(int, int, int, int))); |
341 | connect(f_Motortest, SIGNAL(updateMotor(int, int, int, int)), this, SLOT(slot_Motortest(int, int, int, int))); |
341 | 342 | ||
342 | if (f_Motortest->exec()==QDialog::Accepted) |
343 | if (f_Motortest->exec()==QDialog::Accepted) |
343 | { |
344 | { |
344 | } |
345 | } |
345 | 346 | ||
346 | disconnect(f_Motortest, 0,0,0); |
347 | disconnect(f_Motortest, 0,0,0); |
347 | slot_Motortest(0,0,0,0); |
348 | slot_Motortest(0,0,0,0); |
348 | } |
349 | } |
349 | 350 | ||
350 | void MKTool::slot_Motortest(int Motor1, int Motor2, int Motor3, int Motor4) |
351 | void MKTool::slot_Motortest(int Motor1, int Motor2, int Motor3, int Motor4) |
351 | { |
352 | { |
352 | TX_Data[0] = Motor1; |
353 | TX_Data[0] = Motor1; |
353 | TX_Data[1] = Motor2; |
354 | TX_Data[1] = Motor2; |
354 | TX_Data[2] = Motor3; |
355 | TX_Data[2] = Motor3; |
355 | TX_Data[3] = Motor4; |
356 | TX_Data[3] = Motor4; |
356 | send_Data('t', ADDRESS_FC, TX_Data, 4, false); |
357 | send_Data('t', ADDRESS_FC, TX_Data, 4, false); |
357 | } |
358 | } |
358 | 359 | ||
359 | void MKTool::slot_ac_Config() |
360 | void MKTool::slot_ac_Config() |
360 | { |
361 | { |
361 | set_Analog Old_Analog[MaxAnalog]; |
362 | set_Analog Old_Analog1; |
- | 363 | ||
362 | memcpy(Old_Analog, Settings->Analog, sizeof(Settings->Analog)); |
364 | Old_Analog1 = Settings->Analog1; |
363 | 365 | ||
364 | dlg_Config *f_Config = new dlg_Config(this); |
366 | dlg_Config *f_Config = new dlg_Config(this); |
365 | f_Config->set_Settings(Settings); |
367 | f_Config->set_Settings(Settings, Mode.ID); |
366 | 368 | ||
367 | if (f_Config->exec()==QDialog::Accepted) |
369 | if (f_Config->exec()==QDialog::Accepted) |
368 | { |
370 | { |
369 | Settings = f_Config->get_Settings(); |
371 | Settings = f_Config->get_Settings(); |
370 | Settings->write_Settings_FC(); |
372 | Settings->write_Settings_Analog(Mode.ID); |
371 | 373 | ||
372 | for (int a = 0; a < MaxAnalog; a++) |
374 | for (int a = 0; a < MaxAnalog; a++) |
373 | { |
375 | { |
374 | if (Old_Analog[a].Plot == Settings->Analog[a].Plot) |
376 | if (Old_Analog1.PlotView[a] == Settings->Analog1.PlotView[a]) |
375 | continue; |
377 | continue; |
376 | else |
378 | else |
377 | { |
379 | { |
378 | config_Plot(); |
380 | config_Plot(); |
379 | break; |
381 | break; |
380 | } |
382 | } |
381 | } |
383 | } |
382 | 384 | ||
383 | if (CSVFile->isOpen()) |
385 | if (CSVFile->isOpen()) |
384 | { |
386 | { |
385 | for (int a = 0; a < MaxAnalog; a++) |
387 | for (int a = 0; a < MaxAnalog; a++) |
386 | { |
388 | { |
387 | if (Old_Analog[a].Log == Settings->Analog[a].Log) |
389 | if (Old_Analog1.LogView[a] == Settings->Analog1.LogView[a]) |
388 | continue; |
390 | continue; |
389 | else |
391 | else |
390 | { |
392 | { |
391 | slot_RecordCSV(); |
393 | slot_RecordCSV(); |
392 | slot_RecordCSV(); |
394 | slot_RecordCSV(); |
393 | break; |
395 | break; |
394 | } |
396 | } |
395 | } |
397 | } |
396 | } |
398 | } |
397 | 399 | ||
398 | } |
400 | } |
399 | } |
401 | } |
400 | 402 | ||
401 | void MKTool::slot_ac_Preferences() |
403 | void MKTool::slot_ac_Preferences() |
402 | { |
404 | { |
403 | dlg_Preferences *f_Preferences = new dlg_Preferences(this); |
405 | dlg_Preferences *f_Preferences = new dlg_Preferences(this); |
404 | 406 | ||
405 | if (f_Preferences->exec()==QDialog::Accepted) |
407 | if (f_Preferences->exec()==QDialog::Accepted) |
406 | { |
408 | { |
407 | 409 | ||
408 | } |
410 | } |
409 | } |
411 | } |
410 | 412 | ||
411 | void MKTool::slot_ac_StartPlotter() |
413 | void MKTool::slot_ac_StartPlotter() |
412 | { |
414 | { |
413 | if (ac_StartPlotter->isChecked()) |
415 | if (ac_StartPlotter->isChecked()) |
414 | { |
416 | { |
415 | ac_StartPlotter->setText("Stop Plotter"); |
417 | ac_StartPlotter->setText("Stop Plotter"); |
416 | pb_StartPlotter->setText("Stop Plotter"); |
418 | pb_StartPlotter->setText("Stop Plotter"); |
417 | } |
419 | } |
418 | else |
420 | else |
419 | { |
421 | { |
420 | ac_StartPlotter->setText("Start Plotter"); |
422 | ac_StartPlotter->setText("Start Plotter"); |
421 | pb_StartPlotter->setText("Start Plotter"); |
423 | pb_StartPlotter->setText("Start Plotter"); |
422 | } |
424 | } |
423 | } |
425 | } |
424 | 426 | ||
425 | void MKTool::slot_ac_View() |
427 | void MKTool::slot_ac_View() |
426 | { |
428 | { |
427 | int Aktive; |
429 | int Aktive; |
428 | 430 | ||
429 | QAction *Action = (QAction*)sender(); |
431 | QAction *Action = (QAction*)sender(); |
430 | 432 | ||
431 | if (Action->objectName() == QString("ac_View0")) |
433 | if (Action->objectName() == QString("ac_View0")) |
432 | Aktive = 0; |
434 | Aktive = 0; |
433 | if (Action->objectName() == QString("ac_View1")) |
435 | if (Action->objectName() == QString("ac_View1")) |
434 | Aktive = 1; |
436 | Aktive = 1; |
435 | if (Action->objectName() == QString("ac_View2")) |
437 | if (Action->objectName() == QString("ac_View2")) |
436 | Aktive = 2; |
438 | Aktive = 2; |
437 | if (Action->objectName() == QString("ac_View3")) |
439 | if (Action->objectName() == QString("ac_View3")) |
438 | Aktive = 3; |
440 | Aktive = 3; |
439 | if (Action->objectName() == QString("ac_View4")) |
441 | if (Action->objectName() == QString("ac_View4")) |
440 | Aktive = 4; |
442 | Aktive = 4; |
441 | if (Action->objectName() == QString("ac_View5")) |
443 | if (Action->objectName() == QString("ac_View5")) |
442 | Aktive = 5; |
444 | Aktive = 5; |
443 | 445 | ||
444 | QString TabName = QString("Tab_%1").arg(Aktive); |
446 | QString TabName = QString("Tab_%1").arg(Aktive); |
445 | 447 | ||
446 | if (!Action->isChecked()) |
448 | if (!Action->isChecked()) |
447 | { |
449 | { |
448 | for (int a = 0; a < tab_Main->count(); a++) |
450 | for (int a = 0; a < tab_Main->count(); a++) |
449 | { |
451 | { |
450 | if (tab_Main->widget(a)->objectName() == TabName) |
452 | if (tab_Main->widget(a)->objectName() == TabName) |
451 | { |
453 | { |
452 | tab_Main->removeTab(a); |
454 | tab_Main->removeTab(a); |
453 | } |
455 | } |
454 | } |
456 | } |
455 | 457 | ||
456 | // Action->setChecked(false); |
458 | // Action->setChecked(false); |
457 | } |
459 | } |
458 | else |
460 | else |
459 | { |
461 | { |
460 | // Action->setChecked(true); |
462 | // Action->setChecked(true); |
461 | tab_Main->insertTab(Aktive, TabWidgets[Aktive], Action->text()); |
463 | tab_Main->insertTab(Aktive, TabWidgets[Aktive], Action->text()); |
462 | } |
464 | } |
463 | } |
465 | } |
464 | 466 | ||
465 | void MKTool::slot_ac_MehrDaten() // DONE 0.71g |
467 | void MKTool::slot_ac_MehrDaten() // DONE 0.71g |
466 | { |
468 | { |
467 | if (ac_MehrDaten->isChecked()) |
469 | if (ac_MehrDaten->isChecked()) |
468 | { |
470 | { |
469 | TX_Data[0] = 10; |
471 | TX_Data[0] = 10; |
470 | send_Data('d', ADDRESS_ALL, TX_Data, 1, false); } |
472 | send_Data('d', ADDRESS_ALL, TX_Data, 1, false); } |
471 | else |
473 | else |
472 | { |
474 | { |
473 | TX_Data[0] = 50; |
475 | TX_Data[0] = 50; |
474 | send_Data('d', ADDRESS_ALL, TX_Data, 1, false); } |
476 | send_Data('d', ADDRESS_ALL, TX_Data, 1, false); } |
475 | } |
477 | } |
476 | 478 | ||
477 | void MKTool::slot_ac_About() |
479 | void MKTool::slot_ac_About() |
478 | { |
480 | { |
479 | QMessageBox::about(this, trUtf8(("Über ")) + QA_NAME, QA_ABOUT); |
481 | QMessageBox::about(this, trUtf8(("Über ")) + QA_NAME, QA_ABOUT); |
480 | } |
482 | } |
481 | 483 | ||
482 | void MKTool::slot_ac_GetLabels() // DONE 0.71g |
484 | void MKTool::slot_ac_GetLabels() // DONE 0.71g |
483 | { |
485 | { |
484 | TX_Data[0] = 0; |
486 | TX_Data[0] = 0; |
485 | send_Data('a', ADDRESS_ALL, TX_Data, 1, false); |
487 | send_Data('a', ADDRESS_ALL, TX_Data, 1, false); |
486 | } |
488 | } |
487 | 489 | ||
488 | 490 | ||
489 | // Daten-Plotter |
491 | // Daten-Plotter |
490 | ///////////////// |
492 | ///////////////// |
491 | void MKTool::update_Plot() |
493 | void MKTool::update_Plot() |
492 | { |
494 | { |
493 | for (int a = 0; a < MaxAnalog; a++) |
495 | for (int a = 0; a < MaxAnalog; a++) |
494 | { |
496 | { |
495 | Plot[a]->setData(aID,aData[a],NextPlot - 1); |
497 | Plot[a]->setData(aID,aData[a],NextPlot - 1); |
496 | } |
498 | } |
497 | 499 | ||
498 | if ((NextPlot > PlotWide)) |
500 | if ((NextPlot > PlotWide)) |
499 | { |
501 | { |
500 | scroll_plot->setMaximum(NextPlot - PlotWide); |
502 | scroll_plot->setMaximum(NextPlot - PlotWide); |
501 | } |
503 | } |
502 | 504 | ||
503 | if ((scroll_plot->value() == NextPlot - (PlotWide + 1))) |
505 | if ((scroll_plot->value() == NextPlot - (PlotWide + 1))) |
504 | { |
506 | { |
505 | qwtPlot->setAxisScale(QwtPlot::xBottom,NextPlot - PlotWide,NextPlot,0); |
507 | qwtPlot->setAxisScale(QwtPlot::xBottom,NextPlot - PlotWide,NextPlot,0); |
506 | scroll_plot->setValue(NextPlot - PlotWide); |
508 | scroll_plot->setValue(NextPlot - PlotWide); |
507 | } |
509 | } |
508 | 510 | ||
509 | qwtPlot->replot(); |
511 | qwtPlot->replot(); |
510 | } |
512 | } |
511 | 513 | ||
512 | void MKTool::config_Plot() |
514 | void MKTool::config_Plot() |
513 | { |
515 | { |
514 | for (int a = 0; a < MaxAnalog; a++) |
516 | for (int a = 0; a < MaxAnalog; a++) |
515 | { |
517 | { |
516 | Plot[a]->detach(); |
518 | Plot[a]->detach(); |
517 | Plot[a]->setPen(QPen(QColor(Settings->Analog[a].Color))); |
519 | Plot[a]->setPen(QPen(QColor(Def_Colors[a]))); |
518 | 520 | ||
- | 521 | if (Settings->Analog1.PlotView[a]) |
|
- | 522 | { |
|
519 | if (Settings->Analog[a].Plot) |
523 | Plot[a]->setTitle(Settings->Analog1.Label[a]); |
- | 524 | Plot[a]->attach(qwtPlot); |
|
520 | Plot[a]->attach(qwtPlot); |
525 | } |
521 | } |
526 | } |
522 | } |
527 | } |
523 | 528 | ||
524 | void MKTool::slot_ScrollPlot(int Pos) |
529 | void MKTool::slot_ScrollPlot(int Pos) |
525 | { |
530 | { |
526 | qwtPlot->setAxisScale(QwtPlot::xBottom,Pos,Pos + PlotWide,0); |
531 | qwtPlot->setAxisScale(QwtPlot::xBottom,Pos,Pos + PlotWide,0); |
527 | qwtPlot->replot(); |
532 | qwtPlot->replot(); |
528 | } |
533 | } |
529 | 534 | ||
530 | 535 | ||
531 | // Firmeware-Update |
536 | // Firmeware-Update |
532 | /////////////////// |
537 | /////////////////// |
533 | void MKTool::slot_pb_Update() |
538 | void MKTool::slot_pb_Update() |
534 | { |
539 | { |
- | 540 | qDebug("Update"); |
|
- | 541 | ||
535 | diskfree = new QProcess(); |
542 | if (serialPort->isOpen()) |
- | 543 | { |
|
536 | QByteArray ausgabe; |
544 | slot_OpenPort(); |
- | 545 | } |
|
- | 546 | ||
537 | const QString programm = "find"; |
547 | Update = new QProcess(); |
- | 548 | ||
- | 549 | const QString Programm = "avrdude -p m644 -P /dev/ttyS0 -c butterfly -b 57600 -U flash:w:Flight-Ctrl_MEGA644_V0_71f.hex"; |
|
538 | const QStringList argumente = (QStringList() << "/home/Manuel/"); |
550 | const QStringList Argumente = (QStringList() << "-?"); |
539 | 551 | ||
540 | te_Shell->setText(""); // Ausgabefenster säubern |
552 | te_Shell->setText(""); // Ausgabefenster säubern |
541 | diskfree->start(programm, argumente); // Programmaufruf |
553 | Update->start(Programm); // Programmaufruf |
542 | // diskfree.waitForFinished(); // auf Rückmeldung warten |
554 | // Update.waitForFinished(); // auf Rückmeldung warten |
543 | // diskfree.close(); // Kanal schließen |
555 | // Update.close(); // Kanal schließen |
544 | connect(diskfree, SIGNAL(readyReadStandardOutput()), this, SLOT(slot_UpdateShell()) ); |
556 | connect(Update, SIGNAL(readyReadStandardOutput()), this, SLOT(slot_UpdateShell()) ); |
545 | } |
557 | } |
546 | 558 | ||
547 | void MKTool::slot_UpdateShell() |
559 | void MKTool::slot_UpdateShell() |
548 | { |
560 | { |
549 | QByteArray ausgabe; |
561 | QByteArray Output; |
550 | // te_Shell->setText(""); // Ausgabefenster säubern |
562 | // te_Shell->setText(""); // Ausgabefenster säubern |
551 | // ausgabe = diskfree->readAllStandardOutput(); // Shellausgabe an Variable |
563 | Output = Update->readAllStandardOutput(); // Shellausgabe an Variable |
552 | 564 | ||
553 | te_Shell->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor); |
565 | te_Shell->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor); |
554 | te_Shell->insertPlainText(QString::fromUtf8(ausgabe)); |
566 | te_Shell->insertPlainText(QString::fromUtf8(Output)); |
555 | 567 | ||
556 | // te_Shell->setText(QString::fromUtf8(ausgabe)); // ...und endlich: Ausgabe im QLabel |
568 | te_Shell->setText(QString::fromUtf8(Output)); // ...und endlich: Ausgabe im QLabel |
557 | // qDebug("Shell"); |
- | |
558 | } |
569 | qDebug("Shell"); |
559 | 570 | } |
|
560 | 571 | ||
561 | // Configuration -> Verzeichnisse |
572 | // Configuration -> Verzeichnisse |
562 | ///////////////////////////////// |
573 | ///////////////////////////////// |
563 | void MKTool::slot_SetLogDir() |
574 | void MKTool::slot_SetLogDir() |
564 | { |
575 | { |
565 | QString directory = QFileDialog::getExistingDirectory(this, "Verzeichniss für CSV-Logdateien", Settings->DIR.Logging, QFileDialog::DontResolveSymlinks | QFileDialog::ShowDirsOnly); |
576 | QString directory = QFileDialog::getExistingDirectory(this, "Verzeichniss für CSV-Logdateien", Settings->DIR.Logging, QFileDialog::DontResolveSymlinks | QFileDialog::ShowDirsOnly); |
566 | 577 | ||
567 | if ((!directory.isEmpty()) && (Settings->DIR.Logging != directory)) |
578 | if ((!directory.isEmpty()) && (Settings->DIR.Logging != directory)) |
568 | { |
579 | { |
569 | Settings->DIR.Logging = directory; |
580 | Settings->DIR.Logging = directory; |
570 | Settings->write_Settings(); |
581 | Settings->write_Settings(); |
571 | } |
582 | } |
572 | } |
583 | } |
573 | 584 | ||
574 | void MKTool::slot_SetParDir() |
585 | void MKTool::slot_SetParDir() |
575 | { |
586 | { |
576 | QString directory = QFileDialog::getExistingDirectory(this, "Verzeichniss für Parameter-Dateien", Settings->DIR.Parameter, QFileDialog::DontResolveSymlinks | QFileDialog::ShowDirsOnly); |
587 | QString directory = QFileDialog::getExistingDirectory(this, "Verzeichniss für Parameter-Dateien", Settings->DIR.Parameter, QFileDialog::DontResolveSymlinks | QFileDialog::ShowDirsOnly); |
577 | 588 | ||
578 | if ((!directory.isEmpty()) && (Settings->DIR.Parameter != directory)) |
589 | if ((!directory.isEmpty()) && (Settings->DIR.Parameter != directory)) |
579 | { |
590 | { |
580 | Settings->DIR.Parameter = directory; |
591 | Settings->DIR.Parameter = directory; |
581 | Settings->write_Settings(); |
592 | Settings->write_Settings(); |
582 | } |
593 | } |
583 | 594 | ||
584 | } |
595 | } |
585 | 596 | ||
586 | 597 | ||
587 | // Settings-Bereich |
598 | // Settings-Bereich |
588 | /////////////////// |
599 | /////////////////// |
589 | 600 | ||
590 | void MKTool::slot_LEDtoValue() |
601 | void MKTool::slot_LEDtoValue() |
591 | { |
602 | { |
592 | QToolButton *ToolButton = (QToolButton*)sender(); |
603 | QToolButton *ToolButton = (QToolButton*)sender(); |
593 | if (ToolButton->text() == QString("0")) |
604 | if (ToolButton->text() == QString("0")) |
594 | { |
605 | { |
595 | set_LED(ToolButton, true); |
606 | set_LED(ToolButton, true); |
596 | sb_11_1->setValue(sb_11_1->value() + ToolButton->toolTip().toInt()); |
607 | sb_11_1->setValue(sb_11_1->value() + ToolButton->toolTip().toInt()); |
597 | } |
608 | } |
598 | else if (ToolButton->text() == QString("1")) |
609 | else if (ToolButton->text() == QString("1")) |
599 | { |
610 | { |
600 | set_LED(ToolButton); |
611 | set_LED(ToolButton); |
601 | sb_11_1->setValue(sb_11_1->value() - ToolButton->toolTip().toInt()); |
612 | sb_11_1->setValue(sb_11_1->value() - ToolButton->toolTip().toInt()); |
602 | } |
613 | } |
603 | else if (ToolButton->text() == QString("00")) |
614 | else if (ToolButton->text() == QString("00")) |
604 | { |
615 | { |
605 | set_LED(ToolButton, true); |
616 | set_LED(ToolButton, true); |
606 | sb_11_3->setValue(sb_11_3->value() + ToolButton->toolTip().toInt()); |
617 | sb_11_3->setValue(sb_11_3->value() + ToolButton->toolTip().toInt()); |
607 | } |
618 | } |
608 | else if (ToolButton->text() == QString("11")) |
619 | else if (ToolButton->text() == QString("11")) |
609 | { |
620 | { |
610 | set_LED(ToolButton); |
621 | set_LED(ToolButton); |
611 | sb_11_3->setValue(sb_11_3->value() - ToolButton->toolTip().toInt()); |
622 | sb_11_3->setValue(sb_11_3->value() - ToolButton->toolTip().toInt()); |
612 | } |
623 | } |
613 | } |
624 | } |
614 | 625 | ||
615 | void MKTool::slot_ValuetoLED16(int Wert) |
626 | void MKTool::slot_ValuetoLED16(int Wert) |
616 | { |
627 | { |
617 | // QSpinBox *SpinBox = (QSpinBox*)sender(); |
628 | // QSpinBox *SpinBox = (QSpinBox*)sender(); |
618 | 629 | ||
619 | // int Wert = SpinBox->value(); |
630 | // int Wert = SpinBox->value(); |
620 | 631 | ||
621 | set_LED(J16_0); |
632 | set_LED(J16_0); |
622 | set_LED(J16_1); |
633 | set_LED(J16_1); |
623 | set_LED(J16_2); |
634 | set_LED(J16_2); |
624 | set_LED(J16_3); |
635 | set_LED(J16_3); |
625 | set_LED(J16_4); |
636 | set_LED(J16_4); |
626 | set_LED(J16_5); |
637 | set_LED(J16_5); |
627 | set_LED(J16_6); |
638 | set_LED(J16_6); |
628 | set_LED(J16_7); |
639 | set_LED(J16_7); |
629 | 640 | ||
630 | for (int a = 0; a < 8; a++) |
641 | for (int a = 0; a < 8; a++) |
631 | { |
642 | { |
632 | if (Wert > 127) |
643 | if (Wert > 127) |
633 | { |
644 | { |
634 | set_LED(J16_0, true); |
645 | set_LED(J16_0, true); |
635 | Wert = Wert - 128; |
646 | Wert = Wert - 128; |
636 | } |
647 | } |
637 | if (Wert > 63) |
648 | if (Wert > 63) |
638 | { |
649 | { |
639 | set_LED(J16_1, true); |
650 | set_LED(J16_1, true); |
640 | Wert = Wert - 64; |
651 | Wert = Wert - 64; |
641 | } |
652 | } |
642 | if (Wert > 31) |
653 | if (Wert > 31) |
643 | { |
654 | { |
644 | set_LED(J16_2, true); |
655 | set_LED(J16_2, true); |
645 | Wert = Wert - 32; |
656 | Wert = Wert - 32; |
646 | } |
657 | } |
647 | if (Wert > 15) |
658 | if (Wert > 15) |
648 | { |
659 | { |
649 | set_LED(J16_3, true); |
660 | set_LED(J16_3, true); |
650 | Wert = Wert - 16; |
661 | Wert = Wert - 16; |
651 | } |
662 | } |
652 | if (Wert > 7) |
663 | if (Wert > 7) |
653 | { |
664 | { |
654 | set_LED(J16_4, true); |
665 | set_LED(J16_4, true); |
655 | Wert = Wert - 8; |
666 | Wert = Wert - 8; |
656 | } |
667 | } |
657 | if (Wert > 3) |
668 | if (Wert > 3) |
658 | { |
669 | { |
659 | set_LED(J16_5, true); |
670 | set_LED(J16_5, true); |
660 | Wert = Wert - 4; |
671 | Wert = Wert - 4; |
661 | } |
672 | } |
662 | if (Wert > 1) |
673 | if (Wert > 1) |
663 | { |
674 | { |
664 | set_LED(J16_6, true); |
675 | set_LED(J16_6, true); |
665 | Wert = Wert - 2; |
676 | Wert = Wert - 2; |
666 | } |
677 | } |
667 | if (Wert > 0) |
678 | if (Wert > 0) |
668 | { |
679 | { |
669 | set_LED(J16_7, true); |
680 | set_LED(J16_7, true); |
670 | Wert = Wert - 1; |
681 | Wert = Wert - 1; |
671 | } |
682 | } |
672 | } |
683 | } |
673 | } |
684 | } |
674 | 685 | ||
675 | void MKTool::slot_ValuetoLED17(int Wert) |
686 | void MKTool::slot_ValuetoLED17(int Wert) |
676 | { |
687 | { |
677 | // QSpinBox *SpinBox = (QSpinBox*)sender(); |
688 | // QSpinBox *SpinBox = (QSpinBox*)sender(); |
678 | 689 | ||
679 | // int Wert = SpinBox->value(); |
690 | // int Wert = SpinBox->value(); |
680 | 691 | ||
681 | set_LED(J17_0); |
692 | set_LED(J17_0); |
682 | set_LED(J17_1); |
693 | set_LED(J17_1); |
683 | set_LED(J17_2); |
694 | set_LED(J17_2); |
684 | set_LED(J17_3); |
695 | set_LED(J17_3); |
685 | set_LED(J17_4); |
696 | set_LED(J17_4); |
686 | set_LED(J17_5); |
697 | set_LED(J17_5); |
687 | set_LED(J17_6); |
698 | set_LED(J17_6); |
688 | set_LED(J17_7); |
699 | set_LED(J17_7); |
689 | 700 | ||
690 | for (int a = 0; a < 8; a++) |
701 | for (int a = 0; a < 8; a++) |
691 | { |
702 | { |
692 | if (Wert > 127) |
703 | if (Wert > 127) |
693 | { |
704 | { |
694 | set_LED(J17_0, true); |
705 | set_LED(J17_0, true); |
695 | Wert = Wert - 128; |
706 | Wert = Wert - 128; |
696 | } |
707 | } |
697 | if (Wert > 63) |
708 | if (Wert > 63) |
698 | { |
709 | { |
699 | set_LED(J17_1, true); |
710 | set_LED(J17_1, true); |
700 | Wert = Wert - 64; |
711 | Wert = Wert - 64; |
701 | } |
712 | } |
702 | if (Wert > 31) |
713 | if (Wert > 31) |
703 | { |
714 | { |
704 | set_LED(J17_2, true); |
715 | set_LED(J17_2, true); |
705 | Wert = Wert - 32; |
716 | Wert = Wert - 32; |
706 | } |
717 | } |
707 | if (Wert > 15) |
718 | if (Wert > 15) |
708 | { |
719 | { |
709 | set_LED(J17_3, true); |
720 | set_LED(J17_3, true); |
710 | Wert = Wert - 16; |
721 | Wert = Wert - 16; |
711 | } |
722 | } |
712 | if (Wert > 7) |
723 | if (Wert > 7) |
713 | { |
724 | { |
714 | set_LED(J17_4, true); |
725 | set_LED(J17_4, true); |
715 | Wert = Wert - 8; |
726 | Wert = Wert - 8; |
716 | } |
727 | } |
717 | if (Wert > 3) |
728 | if (Wert > 3) |
718 | { |
729 | { |
719 | set_LED(J17_5, true); |
730 | set_LED(J17_5, true); |
720 | Wert = Wert - 4; |
731 | Wert = Wert - 4; |
721 | } |
732 | } |
722 | if (Wert > 1) |
733 | if (Wert > 1) |
723 | { |
734 | { |
724 | set_LED(J17_6, true); |
735 | set_LED(J17_6, true); |
725 | Wert = Wert - 2; |
736 | Wert = Wert - 2; |
726 | } |
737 | } |
727 | if (Wert > 0) |
738 | if (Wert > 0) |
728 | { |
739 | { |
729 | set_LED(J17_7, true); |
740 | set_LED(J17_7, true); |
730 | Wert = Wert - 1; |
741 | Wert = Wert - 1; |
731 | } |
742 | } |
732 | } |
743 | } |
733 | } |
744 | } |
734 | 745 | ||
735 | void MKTool::set_LED(QToolButton *ToolButton, bool On) |
746 | void MKTool::set_LED(QToolButton *ToolButton, bool On) |
736 | { |
747 | { |
737 | if (ToolButton->text() == QString("0") && On) |
748 | if (ToolButton->text() == QString("0") && On) |
738 | { |
749 | { |
739 | ToolButton->setIcon(Icons[0]); |
750 | ToolButton->setIcon(Icons[0]); |
740 | ToolButton->setText("1"); |
751 | ToolButton->setText("1"); |
741 | } |
752 | } |
742 | else if (ToolButton->text() == QString("1") && !On) |
753 | else if (ToolButton->text() == QString("1") && !On) |
743 | { |
754 | { |
744 | ToolButton->setIcon(Icons[4]); |
755 | ToolButton->setIcon(Icons[4]); |
745 | ToolButton->setText("0"); |
756 | ToolButton->setText("0"); |
746 | } |
757 | } |
747 | else if (ToolButton->text() == QString("00") && On) |
758 | else if (ToolButton->text() == QString("00") && On) |
748 | { |
759 | { |
749 | ToolButton->setIcon(Icons[0]); |
760 | ToolButton->setIcon(Icons[0]); |
750 | ToolButton->setText("11"); |
761 | ToolButton->setText("11"); |
751 | } |
762 | } |
752 | else if (ToolButton->text() == QString("11") && !On) |
763 | else if (ToolButton->text() == QString("11") && !On) |
753 | { |
764 | { |
754 | ToolButton->setIcon(Icons[4]); |
765 | ToolButton->setIcon(Icons[4]); |
755 | ToolButton->setText("00"); |
766 | ToolButton->setText("00"); |
756 | } |
767 | } |
757 | } |
768 | } |
758 | 769 | ||
759 | void MKTool::slot_tbUp() |
770 | void MKTool::slot_tbUp() |
760 | { |
771 | { |
761 | if (tb_9_6->text() == QString("0")) |
772 | if (tb_9_6->text() == QString("0")) |
762 | { |
773 | { |
763 | tb_9_6->setIcon(Icons[20]); |
774 | tb_9_6->setIcon(Icons[20]); |
764 | tb_9_6->setText("1"); |
775 | tb_9_6->setText("1"); |
765 | } |
776 | } |
766 | else |
777 | else |
767 | { |
778 | { |
768 | tb_9_6->setIcon(Icons[21]); |
779 | tb_9_6->setIcon(Icons[21]); |
769 | tb_9_6->setText("0"); |
780 | tb_9_6->setText("0"); |
770 | } |
781 | } |
771 | } |
782 | } |
772 | 783 | ||
773 | void MKTool::slot_tbDown() |
784 | void MKTool::slot_tbDown() |
774 | { |
785 | { |
775 | if (tb_9_7->text() == QString("0")) |
786 | if (tb_9_7->text() == QString("0")) |
776 | { |
787 | { |
777 | tb_9_7->setIcon(Icons[22]); |
788 | tb_9_7->setIcon(Icons[22]); |
778 | tb_9_7->setText("1"); |
789 | tb_9_7->setText("1"); |
779 | } |
790 | } |
780 | else |
791 | else |
781 | { |
792 | { |
782 | tb_9_7->setIcon(Icons[23]); |
793 | tb_9_7->setIcon(Icons[23]); |
783 | tb_9_7->setText("0"); |
794 | tb_9_7->setText("0"); |
784 | } |
795 | } |
785 | } |
796 | } |
786 | 797 | ||
787 | void MKTool::slot_tbLeft() |
798 | void MKTool::slot_tbLeft() |
788 | { |
799 | { |
789 | if (tb_9_8->text() == QString("0")) |
800 | if (tb_9_8->text() == QString("0")) |
790 | { |
801 | { |
791 | tb_9_8->setIcon(Icons[24]); |
802 | tb_9_8->setIcon(Icons[24]); |
792 | tb_9_8->setText("1"); |
803 | tb_9_8->setText("1"); |
793 | } |
804 | } |
794 | else |
805 | else |
795 | { |
806 | { |
796 | tb_9_8->setIcon(Icons[25]); |
807 | tb_9_8->setIcon(Icons[25]); |
797 | tb_9_8->setText("0"); |
808 | tb_9_8->setText("0"); |
798 | } |
809 | } |
799 | } |
810 | } |
800 | 811 | ||
801 | void MKTool::slot_tbRight() |
812 | void MKTool::slot_tbRight() |
802 | { |
813 | { |
803 | if (tb_9_9->text() == QString("0")) |
814 | if (tb_9_9->text() == QString("0")) |
804 | { |
815 | { |
805 | tb_9_9->setIcon(Icons[26]); |
816 | tb_9_9->setIcon(Icons[26]); |
806 | tb_9_9->setText("1"); |
817 | tb_9_9->setText("1"); |
807 | } |
818 | } |
808 | else |
819 | else |
809 | { |
820 | { |
810 | tb_9_9->setIcon(Icons[27]); |
821 | tb_9_9->setIcon(Icons[27]); |
811 | tb_9_9->setText("0"); |
822 | tb_9_9->setText("0"); |
812 | } |
823 | } |
813 | } |
824 | } |
814 | 825 | ||
815 | QComboBox *MKTool::setCombo(QComboBox *Combo, int Set, int Wert) |
826 | QComboBox *MKTool::setCombo(QComboBox *Combo, int Set, int Wert) |
816 | { |
827 | { |
817 | if (ParameterSet[Set][Wert] <= 250) |
828 | if (ParameterSet[Set][Wert] <= 250) |
818 | { |
829 | { |
819 | Combo->setItemText(4, QString("%1").arg(ParameterSet[Set][Wert])); |
830 | Combo->setItemText(4, QString("%1").arg(ParameterSet[Set][Wert])); |
820 | Combo->setCurrentIndex(4); |
831 | Combo->setCurrentIndex(4); |
821 | } |
832 | } |
822 | else |
833 | else |
823 | { |
834 | { |
824 | Combo->setCurrentIndex(ParameterSet[Set][Wert] - 251); |
835 | Combo->setCurrentIndex(ParameterSet[Set][Wert] - 251); |
825 | } |
836 | } |
826 | return Combo; |
837 | return Combo; |
827 | } |
838 | } |
828 | 839 | ||
829 | int MKTool::get_Value(QComboBox *Combo) |
840 | int MKTool::get_Value(QComboBox *Combo) |
830 | { |
841 | { |
831 | if (Combo->currentText() == QString("Poti 1")) |
842 | if (Combo->currentText() == QString("Poti 1")) |
832 | return 251; |
843 | return 251; |
833 | if (Combo->currentText() == QString("Poti 2")) |
844 | if (Combo->currentText() == QString("Poti 2")) |
834 | return 252; |
845 | return 252; |
835 | if (Combo->currentText() == QString("Poti 3")) |
846 | if (Combo->currentText() == QString("Poti 3")) |
836 | return 253; |
847 | return 253; |
837 | if (Combo->currentText() == QString("Poti 4")) |
848 | if (Combo->currentText() == QString("Poti 4")) |
838 | return 254; |
849 | return 254; |
839 | return Combo->currentText().toInt(); |
850 | return Combo->currentText().toInt(); |
840 | } |
851 | } |
841 | 852 | ||
842 | void MKTool::store_ParameterSet(int Set) // DONE 0.71g |
853 | void MKTool::store_ParameterSet(int Set) // DONE 0.71g |
843 | { |
854 | { |
844 | char *Name = le_SetName->text().toLatin1().data(); |
855 | char *Name = le_SetName->text().toLatin1().data(); |
845 | 856 | ||
846 | int a; |
857 | int a; |
847 | 858 | ||
848 | for (a = 0; a < le_SetName->text().length(); a++) |
859 | for (a = 0; a < le_SetName->text().length(); a++) |
849 | { |
860 | { |
850 | ParameterSet[Set][P_NAME+a] = Name[a]; |
861 | ParameterSet[Set][P_NAME+a] = Name[a]; |
851 | } |
862 | } |
852 | 863 | ||
853 | while(a < 12) |
864 | while(a < 12) |
854 | { |
865 | { |
855 | ParameterSet[Set][P_NAME+a] = 0; |
866 | ParameterSet[Set][P_NAME+a] = 0; |
856 | a++; |
867 | a++; |
857 | } |
868 | } |
858 | 869 | ||
859 | // Seite 1 |
870 | // Seite 1 |
860 | ParameterSet[Set][P_GLOBAL_CONF] = 0; |
871 | ParameterSet[Set][P_GLOBAL_CONF] = 0; |
861 | 872 | ||
862 | if (cb_1_1->isChecked()) |
873 | if (cb_1_1->isChecked()) |
863 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x01; |
874 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x01; |
864 | if (cb_1_2->isChecked()) |
875 | if (cb_1_2->isChecked()) |
865 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x02; |
876 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x02; |
866 | if (cb_1_3->isChecked()) |
877 | if (cb_1_3->isChecked()) |
867 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x04; |
878 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x04; |
868 | if (cb_1_4->isChecked()) |
879 | if (cb_1_4->isChecked()) |
869 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x08; |
880 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x08; |
870 | if (cb_1_5->isChecked()) |
881 | if (cb_1_5->isChecked()) |
871 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x10; |
882 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x10; |
872 | if (cb_1_6->isChecked()) |
883 | if (cb_1_6->isChecked()) |
873 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x20; |
884 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x20; |
874 | if (cb_1_7->isChecked()) |
885 | if (cb_1_7->isChecked()) |
875 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x40; |
886 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x40; |
876 | if (cb_1_8->isChecked()) |
887 | if (cb_1_8->isChecked()) |
877 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x80; |
888 | ParameterSet[Set][P_GLOBAL_CONF] = ParameterSet[Set][P_GLOBAL_CONF] | 0x80; |
878 | 889 | ||
879 | // Seite 2 |
890 | // Seite 2 |
880 | ParameterSet[Set][P_KANAL_NICK] = sb_2_1->value(); |
891 | ParameterSet[Set][P_KANAL_NICK] = sb_2_1->value(); |
881 | ParameterSet[Set][P_KANAL_ROLL] = sb_2_2->value(); |
892 | ParameterSet[Set][P_KANAL_ROLL] = sb_2_2->value(); |
882 | ParameterSet[Set][P_KANAL_GAS] = sb_2_3->value(); |
893 | ParameterSet[Set][P_KANAL_GAS] = sb_2_3->value(); |
883 | ParameterSet[Set][P_KANAL_GIER] = sb_2_4->value(); |
894 | ParameterSet[Set][P_KANAL_GIER] = sb_2_4->value(); |
884 | ParameterSet[Set][P_KANAL_POTI1] = sb_2_5->value(); |
895 | ParameterSet[Set][P_KANAL_POTI1] = sb_2_5->value(); |
885 | ParameterSet[Set][P_KANAL_POTI2] = sb_2_6->value(); |
896 | ParameterSet[Set][P_KANAL_POTI2] = sb_2_6->value(); |
886 | ParameterSet[Set][P_KANAL_POTI3] = sb_2_7->value(); |
897 | ParameterSet[Set][P_KANAL_POTI3] = sb_2_7->value(); |
887 | ParameterSet[Set][P_KANAL_POTI4] = sb_2_8->value(); |
898 | ParameterSet[Set][P_KANAL_POTI4] = sb_2_8->value(); |
888 | 899 | ||
889 | // Seite 3 |
900 | // Seite 3 |
890 | ParameterSet[Set][P_STICK_P] = sb_3_1->value(); |
901 | ParameterSet[Set][P_STICK_P] = sb_3_1->value(); |
891 | ParameterSet[Set][P_STICK_D] = sb_3_2->value(); |
902 | ParameterSet[Set][P_STICK_D] = sb_3_2->value(); |
892 | ParameterSet[Set][P_GIER_P] = get_Value(cb_3_3); |
903 | ParameterSet[Set][P_GIER_P] = get_Value(cb_3_3); |
893 | ParameterSet[Set][P_EXTERNAL] = get_Value(cb_3_4); |
904 | ParameterSet[Set][P_EXTERNAL] = get_Value(cb_3_4); |
894 | 905 | ||
895 | // Seite 4 |
906 | // Seite 4 |
896 | ParameterSet[Set][P_MAXHOEHE] = get_Value(cb_4_1); |
907 | ParameterSet[Set][P_MAXHOEHE] = get_Value(cb_4_1); |
897 | ParameterSet[Set][P_MIN_GAS] = sb_4_2->value(); |
908 | ParameterSet[Set][P_MIN_GAS] = sb_4_2->value(); |
898 | ParameterSet[Set][P_HOEHE_P] = get_Value(cb_4_3); |
909 | ParameterSet[Set][P_HOEHE_P] = get_Value(cb_4_3); |
899 | ParameterSet[Set][P_DRUCK_D] = get_Value(cb_4_4); |
910 | ParameterSet[Set][P_DRUCK_D] = get_Value(cb_4_4); |
900 | ParameterSet[Set][P_HOEHE_ACC] = get_Value(cb_4_5); |
911 | ParameterSet[Set][P_HOEHE_ACC] = get_Value(cb_4_5); |
901 | ParameterSet[Set][P_HOEHE_GAIN] = sb_4_6->value(); |
912 | ParameterSet[Set][P_HOEHE_GAIN] = sb_4_6->value(); |
902 | 913 | ||
903 | // Seite 5 |
914 | // Seite 5 |
904 | ParameterSet[Set][P_GYRO_P] = get_Value(cb_5_1); |
915 | ParameterSet[Set][P_GYRO_P] = get_Value(cb_5_1); |
905 | ParameterSet[Set][P_GYRO_I] = get_Value(cb_5_2); |
916 | ParameterSet[Set][P_GYRO_I] = get_Value(cb_5_2); |
906 | ParameterSet[Set][P_DYNAMIC_STAB] = get_Value(cb_5_3); |
917 | ParameterSet[Set][P_DYNAMIC_STAB] = get_Value(cb_5_3); |
907 | ParameterSet[Set][P_GYRO_ACC_FAKTOR] = sb_5_4->value(); |
918 | ParameterSet[Set][P_GYRO_ACC_FAKTOR] = sb_5_4->value(); |
908 | ParameterSet[Set][P_GYRO_ACC_ABGL] = sb_5_5->value(); |
919 | ParameterSet[Set][P_GYRO_ACC_ABGL] = sb_5_5->value(); |
909 | ParameterSet[Set][P_FAKTOR_I] = get_Value(cb_5_6); |
920 | ParameterSet[Set][P_FAKTOR_I] = get_Value(cb_5_6); |
910 | ParameterSet[Set][P_DRIFT_KOMP] = sb_5_7->value(); |
921 | ParameterSet[Set][P_DRIFT_KOMP] = sb_5_7->value(); |
911 | 922 | ||
912 | // Seite 6 |
923 | // Seite 6 |
913 | ParameterSet[Set][P_SERVO_NICK_CONT] = get_Value(cb_6_1); |
924 | ParameterSet[Set][P_SERVO_NICK_CONT] = get_Value(cb_6_1); |
914 | ParameterSet[Set][P_SERVO_NICK_COMP] = sb_6_2->value(); |
925 | ParameterSet[Set][P_SERVO_NICK_COMP] = sb_6_2->value(); |
915 | ParameterSet[Set][P_SERVO_NICK_MIN] = sb_6_3->value(); |
926 | ParameterSet[Set][P_SERVO_NICK_MIN] = sb_6_3->value(); |
916 | ParameterSet[Set][P_SERVO_NICK_MAX] = sb_6_4->value(); |
927 | ParameterSet[Set][P_SERVO_NICK_MAX] = sb_6_4->value(); |
917 | ParameterSet[Set][P_SERVO_NICK_REFR] = sb_6_5->value(); |
928 | ParameterSet[Set][P_SERVO_NICK_REFR] = sb_6_5->value(); |
918 | ParameterSet[Set][P_SERVO_NICK_COMPI] = cb_6_6->isChecked(); |
929 | ParameterSet[Set][P_SERVO_NICK_COMPI] = cb_6_6->isChecked(); |
919 | 930 | ||
920 | // Seite 7 |
931 | // Seite 7 |
921 | ParameterSet[Set][P_GAS_MIN] = sb_7_1->value(); |
932 | ParameterSet[Set][P_GAS_MIN] = sb_7_1->value(); |
922 | ParameterSet[Set][P_GAS_MAX] = sb_7_2->value(); |
933 | ParameterSet[Set][P_GAS_MAX] = sb_7_2->value(); |
923 | ParameterSet[Set][P_KOMPASS_WIRKUNG] = get_Value(cb_7_3); |
934 | ParameterSet[Set][P_KOMPASS_WIRKUNG] = get_Value(cb_7_3); |
924 | ParameterSet[Set][P_UNTERSPANNUNG] = sb_7_4->value(); |
935 | ParameterSet[Set][P_UNTERSPANNUNG] = sb_7_4->value(); |
925 | ParameterSet[Set][P_NOTGASZEIT] = sb_7_5->value(); |
936 | ParameterSet[Set][P_NOTGASZEIT] = sb_7_5->value(); |
926 | ParameterSet[Set][P_NOTGAS] = sb_7_6->value(); |
937 | ParameterSet[Set][P_NOTGAS] = sb_7_6->value(); |
927 | 938 | ||
928 | // Seite 8 |
939 | // Seite 8 |
929 | ParameterSet[Set][P_ACHS_KOPPLUNG] = get_Value(cb_8_1); |
940 | ParameterSet[Set][P_ACHS_KOPPLUNG] = get_Value(cb_8_1); |
930 | ParameterSet[Set][P_ACHS_GKOPPLUNG] = get_Value(cb_8_2); |
941 | ParameterSet[Set][P_ACHS_GKOPPLUNG] = get_Value(cb_8_2); |
931 | 942 | ||
932 | // Seite 9 |
943 | // Seite 9 |
933 | ParameterSet[Set][P_LOOP_CONFIG] = 0; |
944 | ParameterSet[Set][P_LOOP_CONFIG] = 0; |
934 | if (tb_9_6->text() == QString("1")) |
945 | if (tb_9_6->text() == QString("1")) |
935 | ParameterSet[Set][P_LOOP_CONFIG] = ParameterSet[Set][P_LOOP_CONFIG] | 0x01; |
946 | ParameterSet[Set][P_LOOP_CONFIG] = ParameterSet[Set][P_LOOP_CONFIG] | 0x01; |
936 | if (tb_9_7->text() == QString("1")) |
947 | if (tb_9_7->text() == QString("1")) |
937 | ParameterSet[Set][P_LOOP_CONFIG] = ParameterSet[Set][P_LOOP_CONFIG] | 0x02; |
948 | ParameterSet[Set][P_LOOP_CONFIG] = ParameterSet[Set][P_LOOP_CONFIG] | 0x02; |
938 | if (tb_9_8->text() == QString("1")) |
949 | if (tb_9_8->text() == QString("1")) |
939 | ParameterSet[Set][P_LOOP_CONFIG] = ParameterSet[Set][P_LOOP_CONFIG] | 0x04; |
950 | ParameterSet[Set][P_LOOP_CONFIG] = ParameterSet[Set][P_LOOP_CONFIG] | 0x04; |
940 | if (tb_9_9->text() == QString("1")) |
951 | if (tb_9_9->text() == QString("1")) |
941 | ParameterSet[Set][P_LOOP_CONFIG] = ParameterSet[Set][P_LOOP_CONFIG] | 0x08; |
952 | ParameterSet[Set][P_LOOP_CONFIG] = ParameterSet[Set][P_LOOP_CONFIG] | 0x08; |
942 | if (cb_4_7->isChecked()) |
953 | if (cb_4_7->isChecked()) |
943 | ParameterSet[Set][P_LOOP_CONFIG] = ParameterSet[Set][P_LOOP_CONFIG] | 0x10; |
954 | ParameterSet[Set][P_LOOP_CONFIG] = ParameterSet[Set][P_LOOP_CONFIG] | 0x10; |
944 | 955 | ||
945 | ParameterSet[Set][P_LOOP_GAS_LIMIT] = get_Value(cb_9_1); |
956 | ParameterSet[Set][P_LOOP_GAS_LIMIT] = get_Value(cb_9_1); |
946 | ParameterSet[Set][P_LOOP_THRESHOLD] = sb_9_2->value(); |
957 | ParameterSet[Set][P_LOOP_THRESHOLD] = sb_9_2->value(); |
947 | ParameterSet[Set][P_WINKEL_NICK] = sb_9_3->value(); |
958 | ParameterSet[Set][P_WINKEL_NICK] = sb_9_3->value(); |
948 | ParameterSet[Set][P_LOOP_HYSTERESE] = sb_9_4->value(); |
959 | ParameterSet[Set][P_LOOP_HYSTERESE] = sb_9_4->value(); |
949 | ParameterSet[Set][P_WINKEL_ROLL] = sb_9_5->value(); |
960 | ParameterSet[Set][P_WINKEL_ROLL] = sb_9_5->value(); |
950 | 961 | ||
951 | // Seite 10 |
962 | // Seite 10 |
952 | ParameterSet[Set][P_USER_1] = get_Value(cb_10_1); |
963 | ParameterSet[Set][P_USER_1] = get_Value(cb_10_1); |
953 | ParameterSet[Set][P_USER_2] = get_Value(cb_10_2); |
964 | ParameterSet[Set][P_USER_2] = get_Value(cb_10_2); |
954 | ParameterSet[Set][P_USER_3] = get_Value(cb_10_3); |
965 | ParameterSet[Set][P_USER_3] = get_Value(cb_10_3); |
955 | ParameterSet[Set][P_USER_4] = get_Value(cb_10_4); |
966 | ParameterSet[Set][P_USER_4] = get_Value(cb_10_4); |
956 | ParameterSet[Set][P_USER_5] = get_Value(cb_10_5); |
967 | ParameterSet[Set][P_USER_5] = get_Value(cb_10_5); |
957 | ParameterSet[Set][P_USER_6] = get_Value(cb_10_6); |
968 | ParameterSet[Set][P_USER_6] = get_Value(cb_10_6); |
958 | ParameterSet[Set][P_USER_7] = get_Value(cb_10_7); |
969 | ParameterSet[Set][P_USER_7] = get_Value(cb_10_7); |
959 | ParameterSet[Set][P_USER_8] = get_Value(cb_10_8); |
970 | ParameterSet[Set][P_USER_8] = get_Value(cb_10_8); |
960 | 971 | ||
961 | // Seite 11 |
972 | // Seite 11 |
962 | ParameterSet[Set][P_J16_BITMASK] = sb_11_1->value(); |
973 | ParameterSet[Set][P_J16_BITMASK] = sb_11_1->value(); |
963 | ParameterSet[Set][P_J16_TIMING] = get_Value(cb_11_2); |
974 | ParameterSet[Set][P_J16_TIMING] = get_Value(cb_11_2); |
964 | ParameterSet[Set][P_J17_BITMASK] = sb_11_3->value(); |
975 | ParameterSet[Set][P_J17_BITMASK] = sb_11_3->value(); |
965 | ParameterSet[Set][P_J17_TIMING] = get_Value(cb_11_4); |
976 | ParameterSet[Set][P_J17_TIMING] = get_Value(cb_11_4); |
966 | 977 | ||
967 | // Seite 12 |
978 | // Seite 12 |
968 | ParameterSet[Set][P_NAV_GPS_MODE] = get_Value(cb_12_1); |
979 | ParameterSet[Set][P_NAV_GPS_MODE] = get_Value(cb_12_1); |
969 | ParameterSet[Set][P_NAV_GPS_GAIN] = get_Value(cb_12_2); |
980 | ParameterSet[Set][P_NAV_GPS_GAIN] = get_Value(cb_12_2); |
970 | ParameterSet[Set][P_NAV_STICK_THRE] = sb_12_3->value(); |
981 | ParameterSet[Set][P_NAV_STICK_THRE] = sb_12_3->value(); |
971 | ParameterSet[Set][P_NAV_GPS_MIN] = sb_12_4->value(); |
982 | ParameterSet[Set][P_NAV_GPS_MIN] = sb_12_4->value(); |
972 | ParameterSet[Set][P_NAV_GPS_P] = get_Value(cb_12_5); |
983 | ParameterSet[Set][P_NAV_GPS_P] = get_Value(cb_12_5); |
973 | ParameterSet[Set][P_NAV_GPS_I] = get_Value(cb_12_6); |
984 | ParameterSet[Set][P_NAV_GPS_I] = get_Value(cb_12_6); |
974 | ParameterSet[Set][P_NAV_GPS_D] = get_Value(cb_12_7); |
985 | ParameterSet[Set][P_NAV_GPS_D] = get_Value(cb_12_7); |
975 | ParameterSet[Set][P_NAV_GPS_ACC] = get_Value(cb_12_8); |
986 | ParameterSet[Set][P_NAV_GPS_ACC] = get_Value(cb_12_8); |
976 | 987 | ||
977 | //Seite 13 |
988 | //Seite 13 |
978 | ParameterSet[Set][P_NAV_WIND_CORR] = get_Value(cb_13_1); |
989 | ParameterSet[Set][P_NAV_WIND_CORR] = get_Value(cb_13_1); |
979 | ParameterSet[Set][P_NAV_SPEED_COMP] = get_Value(cb_13_2); |
990 | ParameterSet[Set][P_NAV_SPEED_COMP] = get_Value(cb_13_2); |
980 | ParameterSet[Set][P_NAV_RADIUS] = get_Value(cb_13_3); |
991 | ParameterSet[Set][P_NAV_RADIUS] = get_Value(cb_13_3); |
981 | } |
992 | } |
982 | 993 | ||
983 | void MKTool::slot_SaveParameter() // DONE 0.71g |
994 | void MKTool::slot_SaveParameter() // DONE 0.71g |
984 | { |
995 | { |
985 | int Set = sb_Set->value() + 5; |
996 | int Set = sb_Set->value() + 5; |
986 | 997 | ||
987 | QString Filename = QFileDialog::getSaveFileName(this, "Mikrokopter Parameter speichern", Settings->DIR.Parameter + le_SetName->text(), "Mikrokopter Parameter(*.mkp);;Alle Dateien (*)"); |
998 | QString Filename = QFileDialog::getSaveFileName(this, "Mikrokopter Parameter speichern", Settings->DIR.Parameter + le_SetName->text(), "Mikrokopter Parameter(*.mkp);;Alle Dateien (*)"); |
988 | 999 | ||
989 | if (!Filename.isEmpty()) |
1000 | if (!Filename.isEmpty()) |
990 | { |
1001 | { |
991 | if (!(Filename.endsWith(".mkp", Qt::CaseInsensitive))) |
1002 | if (!(Filename.endsWith(".mkp", Qt::CaseInsensitive))) |
992 | { |
1003 | { |
993 | Filename = Filename + QString(".mkp"); |
1004 | Filename = Filename + QString(".mkp"); |
994 | } |
1005 | } |
995 | store_ParameterSet(Set); |
1006 | store_ParameterSet(Set); |
996 | QSettings Setting(Filename, QSettings::IniFormat); |
1007 | QSettings Setting(Filename, QSettings::IniFormat); |
997 | 1008 | ||
998 | Setting.beginGroup("Setup"); |
1009 | Setting.beginGroup("Setup"); |
999 | Setting.setValue("Name", le_SetName->text()); |
1010 | Setting.setValue("Name", le_SetName->text()); |
1000 | Setting.setValue("GlobalConfig", ParameterSet[Set][P_GLOBAL_CONF]); |
1011 | Setting.setValue("GlobalConfig", ParameterSet[Set][P_GLOBAL_CONF]); |
1001 | Setting.endGroup(); |
1012 | Setting.endGroup(); |
1002 | 1013 | ||
1003 | Setting.beginGroup("Channels"); |
1014 | Setting.beginGroup("Channels"); |
1004 | Setting.setValue("Nick", ParameterSet[Set][P_KANAL_NICK]); |
1015 | Setting.setValue("Nick", ParameterSet[Set][P_KANAL_NICK]); |
1005 | Setting.setValue("Roll", ParameterSet[Set][P_KANAL_ROLL]); |
1016 | Setting.setValue("Roll", ParameterSet[Set][P_KANAL_ROLL]); |
1006 | Setting.setValue("Gas", ParameterSet[Set][P_KANAL_GAS]); |
1017 | Setting.setValue("Gas", ParameterSet[Set][P_KANAL_GAS]); |
1007 | Setting.setValue("Gier", ParameterSet[Set][P_KANAL_GIER]); |
1018 | Setting.setValue("Gier", ParameterSet[Set][P_KANAL_GIER]); |
1008 | Setting.setValue("Poti_1", ParameterSet[Set][P_KANAL_POTI1]); |
1019 | Setting.setValue("Poti_1", ParameterSet[Set][P_KANAL_POTI1]); |
1009 | Setting.setValue("Poti_2", ParameterSet[Set][P_KANAL_POTI2]); |
1020 | Setting.setValue("Poti_2", ParameterSet[Set][P_KANAL_POTI2]); |
1010 | Setting.setValue("Poti_3", ParameterSet[Set][P_KANAL_POTI3]); |
1021 | Setting.setValue("Poti_3", ParameterSet[Set][P_KANAL_POTI3]); |
1011 | Setting.setValue("Poti_4", ParameterSet[Set][P_KANAL_POTI4]); |
1022 | Setting.setValue("Poti_4", ParameterSet[Set][P_KANAL_POTI4]); |
1012 | Setting.endGroup(); |
1023 | Setting.endGroup(); |
1013 | 1024 | ||
1014 | Setting.beginGroup("Stick"); |
1025 | Setting.beginGroup("Stick"); |
1015 | Setting.setValue("Nick_Roll-P", ParameterSet[Set][P_STICK_P]); |
1026 | Setting.setValue("Nick_Roll-P", ParameterSet[Set][P_STICK_P]); |
1016 | Setting.setValue("Nick_Roll-D", ParameterSet[Set][P_STICK_D]); |
1027 | Setting.setValue("Nick_Roll-D", ParameterSet[Set][P_STICK_D]); |
1017 | Setting.setValue("Gier-P", ParameterSet[Set][P_GIER_P]); |
1028 | Setting.setValue("Gier-P", ParameterSet[Set][P_GIER_P]); |
1018 | Setting.setValue("ExternalControl", ParameterSet[Set][P_EXTERNAL]); |
1029 | Setting.setValue("ExternalControl", ParameterSet[Set][P_EXTERNAL]); |
1019 | Setting.endGroup(); |
1030 | Setting.endGroup(); |
1020 | 1031 | ||
1021 | Setting.beginGroup("Altitude"); |
1032 | Setting.beginGroup("Altitude"); |
1022 | Setting.setValue("Setpoint", ParameterSet[Set][P_MAXHOEHE]); |
1033 | Setting.setValue("Setpoint", ParameterSet[Set][P_MAXHOEHE]); |
1023 | Setting.setValue("MinGas", ParameterSet[Set][P_MIN_GAS]); |
1034 | Setting.setValue("MinGas", ParameterSet[Set][P_MIN_GAS]); |
1024 | Setting.setValue("P", ParameterSet[Set][P_HOEHE_P]); |
1035 | Setting.setValue("P", ParameterSet[Set][P_HOEHE_P]); |
1025 | Setting.setValue("Barometric-D", ParameterSet[Set][P_DRUCK_D]); |
1036 | Setting.setValue("Barometric-D", ParameterSet[Set][P_DRUCK_D]); |
1026 | Setting.setValue("Z-ACC-Effect", ParameterSet[Set][P_HOEHE_ACC]); |
1037 | Setting.setValue("Z-ACC-Effect", ParameterSet[Set][P_HOEHE_ACC]); |
1027 | Setting.setValue("Gain", ParameterSet[Set][P_HOEHE_GAIN]); |
1038 | Setting.setValue("Gain", ParameterSet[Set][P_HOEHE_GAIN]); |
1028 | Setting.endGroup(); |
1039 | Setting.endGroup(); |
1029 | 1040 | ||
1030 | Setting.beginGroup("Gyro"); |
1041 | Setting.beginGroup("Gyro"); |
1031 | Setting.setValue("P", ParameterSet[Set][P_GYRO_P]); |
1042 | Setting.setValue("P", ParameterSet[Set][P_GYRO_P]); |
1032 | Setting.setValue("I", ParameterSet[Set][P_GYRO_I]); |
1043 | Setting.setValue("I", ParameterSet[Set][P_GYRO_I]); |
1033 | Setting.setValue("DynamicStability", ParameterSet[Set][P_DYNAMIC_STAB]); |
1044 | Setting.setValue("DynamicStability", ParameterSet[Set][P_DYNAMIC_STAB]); |
1034 | Setting.setValue("ACC_Gyro-Factor", ParameterSet[Set][P_GYRO_ACC_FAKTOR]); |
1045 | Setting.setValue("ACC_Gyro-Factor", ParameterSet[Set][P_GYRO_ACC_FAKTOR]); |
1035 | Setting.setValue("ACC_Gyro-Compensation", ParameterSet[Set][P_GYRO_ACC_ABGL]); |
1046 | Setting.setValue("ACC_Gyro-Compensation", ParameterSet[Set][P_GYRO_ACC_ABGL]); |
1036 | Setting.setValue("DriftCompensation", ParameterSet[Set][P_DRIFT_KOMP]); |
1047 | Setting.setValue("DriftCompensation", ParameterSet[Set][P_DRIFT_KOMP]); |
1037 | Setting.setValue("Main-I", ParameterSet[Set][P_FAKTOR_I]); |
1048 | Setting.setValue("Main-I", ParameterSet[Set][P_FAKTOR_I]); |
1038 | Setting.endGroup(); |
1049 | Setting.endGroup(); |
1039 | 1050 | ||
1040 | Setting.beginGroup("Camera"); |
1051 | Setting.beginGroup("Camera"); |
1041 | Setting.setValue("ServoNickControl", ParameterSet[Set][P_SERVO_NICK_CONT]); |
1052 | Setting.setValue("ServoNickControl", ParameterSet[Set][P_SERVO_NICK_CONT]); |
1042 | Setting.setValue("ServoNickCompensation", ParameterSet[Set][P_SERVO_NICK_COMP]); |
1053 | Setting.setValue("ServoNickCompensation", ParameterSet[Set][P_SERVO_NICK_COMP]); |
1043 | Setting.setValue("ServoNickInvert", ParameterSet[Set][P_SERVO_NICK_COMPI]); |
1054 | Setting.setValue("ServoNickInvert", ParameterSet[Set][P_SERVO_NICK_COMPI]); |
1044 | Setting.setValue("ServoNickMin", ParameterSet[Set][P_SERVO_NICK_MIN]); |
1055 | Setting.setValue("ServoNickMin", ParameterSet[Set][P_SERVO_NICK_MIN]); |
1045 | Setting.setValue("ServoNickMax", ParameterSet[Set][P_SERVO_NICK_MAX]); |
1056 | Setting.setValue("ServoNickMax", ParameterSet[Set][P_SERVO_NICK_MAX]); |
1046 | Setting.setValue("ServoNickRefreshRate", ParameterSet[Set][P_SERVO_NICK_REFR]); |
1057 | Setting.setValue("ServoNickRefreshRate", ParameterSet[Set][P_SERVO_NICK_REFR]); |
1047 | Setting.endGroup(); |
1058 | Setting.endGroup(); |
1048 | 1059 | ||
1049 | Setting.beginGroup("Others"); |
1060 | Setting.beginGroup("Others"); |
1050 | Setting.setValue("MinGas", ParameterSet[Set][P_GAS_MIN]); |
1061 | Setting.setValue("MinGas", ParameterSet[Set][P_GAS_MIN]); |
1051 | Setting.setValue("MaxGas", ParameterSet[Set][P_GAS_MAX]); |
1062 | Setting.setValue("MaxGas", ParameterSet[Set][P_GAS_MAX]); |
1052 | Setting.setValue("Compass-Effect", ParameterSet[Set][P_KOMPASS_WIRKUNG]); |
1063 | Setting.setValue("Compass-Effect", ParameterSet[Set][P_KOMPASS_WIRKUNG]); |
1053 | Setting.setValue("UnderVoltage", ParameterSet[Set][P_UNTERSPANNUNG]); |
1064 | Setting.setValue("UnderVoltage", ParameterSet[Set][P_UNTERSPANNUNG]); |
1054 | Setting.setValue("NotGas", ParameterSet[Set][P_NOTGAS]); |
1065 | Setting.setValue("NotGas", ParameterSet[Set][P_NOTGAS]); |
1055 | Setting.setValue("NotGasTime", ParameterSet[Set][P_NOTGASZEIT]); |
1066 | Setting.setValue("NotGasTime", ParameterSet[Set][P_NOTGASZEIT]); |
1056 | Setting.endGroup(); |
1067 | Setting.endGroup(); |
1057 | 1068 | ||
1058 | Setting.beginGroup("Coupling"); |
1069 | Setting.beginGroup("Coupling"); |
1059 | Setting.setValue("YawPosFeedback", ParameterSet[Set][P_ACHS_KOPPLUNG]); |
1070 | Setting.setValue("YawPosFeedback", ParameterSet[Set][P_ACHS_KOPPLUNG]); |
1060 | Setting.setValue("YawNegFeedback", ParameterSet[Set][P_ACHS_GKOPPLUNG]); |
1071 | Setting.setValue("YawNegFeedback", ParameterSet[Set][P_ACHS_GKOPPLUNG]); |
1061 | Setting.endGroup(); |
1072 | Setting.endGroup(); |
1062 | 1073 | ||
1063 | Setting.beginGroup("Loop"); |
1074 | Setting.beginGroup("Loop"); |
1064 | Setting.setValue("Config", ParameterSet[Set][P_LOOP_CONFIG]); |
1075 | Setting.setValue("Config", ParameterSet[Set][P_LOOP_CONFIG]); |
1065 | Setting.setValue("GasLimit", ParameterSet[Set][P_LOOP_GAS_LIMIT]); |
1076 | Setting.setValue("GasLimit", ParameterSet[Set][P_LOOP_GAS_LIMIT]); |
1066 | Setting.setValue("StickThreshold", ParameterSet[Set][P_LOOP_THRESHOLD]); |
1077 | Setting.setValue("StickThreshold", ParameterSet[Set][P_LOOP_THRESHOLD]); |
1067 | Setting.setValue("LoopHysteresis", ParameterSet[Set][P_LOOP_HYSTERESE]); |
1078 | Setting.setValue("LoopHysteresis", ParameterSet[Set][P_LOOP_HYSTERESE]); |
1068 | Setting.setValue("TurnOverNick", ParameterSet[Set][P_WINKEL_NICK]); |
1079 | Setting.setValue("TurnOverNick", ParameterSet[Set][P_WINKEL_NICK]); |
1069 | Setting.setValue("TurnOverRoll", ParameterSet[Set][P_WINKEL_ROLL]); |
1080 | Setting.setValue("TurnOverRoll", ParameterSet[Set][P_WINKEL_ROLL]); |
1070 | Setting.endGroup(); |
1081 | Setting.endGroup(); |
1071 | 1082 | ||
1072 | Setting.beginGroup("User"); |
1083 | Setting.beginGroup("User"); |
1073 | Setting.setValue("Parameter_1", ParameterSet[Set][P_USER_1]); |
1084 | Setting.setValue("Parameter_1", ParameterSet[Set][P_USER_1]); |
1074 | Setting.setValue("Parameter_2", ParameterSet[Set][P_USER_2]); |
1085 | Setting.setValue("Parameter_2", ParameterSet[Set][P_USER_2]); |
1075 | Setting.setValue("Parameter_3", ParameterSet[Set][P_USER_3]); |
1086 | Setting.setValue("Parameter_3", ParameterSet[Set][P_USER_3]); |
1076 | Setting.setValue("Parameter_4", ParameterSet[Set][P_USER_4]); |
1087 | Setting.setValue("Parameter_4", ParameterSet[Set][P_USER_4]); |
1077 | Setting.setValue("Parameter_5", ParameterSet[Set][P_USER_5]); |
1088 | Setting.setValue("Parameter_5", ParameterSet[Set][P_USER_5]); |
1078 | Setting.setValue("Parameter_6", ParameterSet[Set][P_USER_6]); |
1089 | Setting.setValue("Parameter_6", ParameterSet[Set][P_USER_6]); |
1079 | Setting.setValue("Parameter_7", ParameterSet[Set][P_USER_7]); |
1090 | Setting.setValue("Parameter_7", ParameterSet[Set][P_USER_7]); |
1080 | Setting.setValue("Parameter_8", ParameterSet[Set][P_USER_8]); |
1091 | Setting.setValue("Parameter_8", ParameterSet[Set][P_USER_8]); |
1081 | Setting.endGroup(); |
1092 | Setting.endGroup(); |
1082 | 1093 | ||
1083 | Setting.beginGroup("Output"); |
1094 | Setting.beginGroup("Output"); |
1084 | Setting.setValue("J16_Bitmask", ParameterSet[Set][P_J16_BITMASK]); |
1095 | Setting.setValue("J16_Bitmask", ParameterSet[Set][P_J16_BITMASK]); |
1085 | Setting.setValue("J16_Timing", ParameterSet[Set][P_J16_TIMING]); |
1096 | Setting.setValue("J16_Timing", ParameterSet[Set][P_J16_TIMING]); |
1086 | Setting.setValue("J17_Bitmask", ParameterSet[Set][P_J17_BITMASK]); |
1097 | Setting.setValue("J17_Bitmask", ParameterSet[Set][P_J17_BITMASK]); |
1087 | Setting.setValue("J17_Timing", ParameterSet[Set][P_J17_TIMING]); |
1098 | Setting.setValue("J17_Timing", ParameterSet[Set][P_J17_TIMING]); |
1088 | Setting.endGroup(); |
1099 | Setting.endGroup(); |
1089 | 1100 | ||
1090 | Setting.beginGroup("NaviCtrl"); |
1101 | Setting.beginGroup("NaviCtrl"); |
1091 | Setting.setValue("GPS_ModeControl", ParameterSet[Set][P_NAV_GPS_MODE]); |
1102 | Setting.setValue("GPS_ModeControl", ParameterSet[Set][P_NAV_GPS_MODE]); |
1092 | Setting.setValue("GPS_Gain", ParameterSet[Set][P_NAV_GPS_GAIN]); |
1103 | Setting.setValue("GPS_Gain", ParameterSet[Set][P_NAV_GPS_GAIN]); |
1093 | Setting.setValue("GPS_P", ParameterSet[Set][P_NAV_GPS_P]); |
1104 | Setting.setValue("GPS_P", ParameterSet[Set][P_NAV_GPS_P]); |
1094 | Setting.setValue("GPS_I", ParameterSet[Set][P_NAV_GPS_I]); |
1105 | Setting.setValue("GPS_I", ParameterSet[Set][P_NAV_GPS_I]); |
1095 | Setting.setValue("GPS_D", ParameterSet[Set][P_NAV_GPS_D]); |
1106 | Setting.setValue("GPS_D", ParameterSet[Set][P_NAV_GPS_D]); |
1096 | Setting.setValue("GPS_Acc", ParameterSet[Set][P_NAV_GPS_ACC]); |
1107 | Setting.setValue("GPS_Acc", ParameterSet[Set][P_NAV_GPS_ACC]); |
1097 | Setting.setValue("GPS_MinSat", ParameterSet[Set][P_NAV_GPS_MIN]); |
1108 | Setting.setValue("GPS_MinSat", ParameterSet[Set][P_NAV_GPS_MIN]); |
1098 | Setting.setValue("GPS_StickThreshold", ParameterSet[Set][P_NAV_STICK_THRE]); |
1109 | Setting.setValue("GPS_StickThreshold", ParameterSet[Set][P_NAV_STICK_THRE]); |
1099 | Setting.setValue("GPS_WindCorrection", ParameterSet[Set][P_NAV_WIND_CORR]); |
1110 | Setting.setValue("GPS_WindCorrection", ParameterSet[Set][P_NAV_WIND_CORR]); |
1100 | Setting.setValue("GPS_SpeedCompensation", ParameterSet[Set][P_NAV_SPEED_COMP]); |
1111 | Setting.setValue("GPS_SpeedCompensation", ParameterSet[Set][P_NAV_SPEED_COMP]); |
1101 | Setting.setValue("GPS_MaxRadius", ParameterSet[Set][P_NAV_RADIUS]); |
1112 | Setting.setValue("GPS_MaxRadius", ParameterSet[Set][P_NAV_RADIUS]); |
1102 | Setting.endGroup(); |
1113 | Setting.endGroup(); |
1103 | } |
1114 | } |
1104 | } |
1115 | } |
1105 | 1116 | ||
1106 | void MKTool::slot_LoadParameter() // DONE 0.71g |
1117 | void MKTool::slot_LoadParameter() // DONE 0.71g |
1107 | { |
1118 | { |
1108 | QString Filename = QFileDialog::getOpenFileName(this, "Mikrokopter Parameter laden", Settings->DIR.Parameter, "Mikrokopter Parameter(*.mkp);;Alle Dateien (*)"); |
1119 | QString Filename = QFileDialog::getOpenFileName(this, "Mikrokopter Parameter laden", Settings->DIR.Parameter, "Mikrokopter Parameter(*.mkp);;Alle Dateien (*)"); |
1109 | 1120 | ||
1110 | if (!Filename.isEmpty()) |
1121 | if (!Filename.isEmpty()) |
1111 | { |
1122 | { |
1112 | int Set = sb_Set->value(); |
1123 | int Set = sb_Set->value(); |
1113 | QSettings Setting(Filename, QSettings::IniFormat); |
1124 | QSettings Setting(Filename, QSettings::IniFormat); |
1114 | 1125 | ||
1115 | Setting.beginGroup("Setup"); |
1126 | Setting.beginGroup("Setup"); |
1116 | QString Name = Setting.value("Name", QString("--noname--")).toString(); |
1127 | QString Name = Setting.value("Name", QString("--noname--")).toString(); |
1117 | char *CName = Name.toLatin1().data(); |
1128 | char *CName = Name.toLatin1().data(); |
1118 | int a; |
1129 | int a; |
1119 | 1130 | ||
1120 | for (a=0; a < Name.length(); a++) |
1131 | for (a=0; a < Name.length(); a++) |
1121 | { |
1132 | { |
1122 | ParameterSet[Set][P_NAME+a] = CName[a]; |
1133 | ParameterSet[Set][P_NAME+a] = CName[a]; |
1123 | } |
1134 | } |
1124 | while (a < 12) |
1135 | while (a < 12) |
1125 | { |
1136 | { |
1126 | ParameterSet[Set][P_NAME+a] = 0; |
1137 | ParameterSet[Set][P_NAME+a] = 0; |
1127 | a++; |
1138 | a++; |
1128 | } |
1139 | } |
1129 | 1140 | ||
1130 | ParameterSet[Set][P_GLOBAL_CONF] = Setting.value("GlobalConfig", 0).toInt(); |
1141 | ParameterSet[Set][P_GLOBAL_CONF] = Setting.value("GlobalConfig", 0).toInt(); |
1131 | Setting.endGroup(); |
1142 | Setting.endGroup(); |
1132 | 1143 | ||
1133 | Setting.beginGroup("Channels"); |
1144 | Setting.beginGroup("Channels"); |
1134 | ParameterSet[Set][P_KANAL_NICK] = Setting.value("Nick", 1).toInt(); |
1145 | ParameterSet[Set][P_KANAL_NICK] = Setting.value("Nick", 1).toInt(); |
1135 | ParameterSet[Set][P_KANAL_ROLL] = Setting.value("Roll", 2).toInt(); |
1146 | ParameterSet[Set][P_KANAL_ROLL] = Setting.value("Roll", 2).toInt(); |
1136 | ParameterSet[Set][P_KANAL_GAS] = Setting.value("Gas", 3).toInt(); |
1147 | ParameterSet[Set][P_KANAL_GAS] = Setting.value("Gas", 3).toInt(); |
1137 | ParameterSet[Set][P_KANAL_GIER] = Setting.value("Gier", 4).toInt(); |
1148 | ParameterSet[Set][P_KANAL_GIER] = Setting.value("Gier", 4).toInt(); |
1138 | ParameterSet[Set][P_KANAL_POTI1] = Setting.value("Poti_1", 5).toInt(); |
1149 | ParameterSet[Set][P_KANAL_POTI1] = Setting.value("Poti_1", 5).toInt(); |
1139 | ParameterSet[Set][P_KANAL_POTI2] = Setting.value("Poti_2", 6).toInt(); |
1150 | ParameterSet[Set][P_KANAL_POTI2] = Setting.value("Poti_2", 6).toInt(); |
1140 | ParameterSet[Set][P_KANAL_POTI3] = Setting.value("Poti_3", 7).toInt(); |
1151 | ParameterSet[Set][P_KANAL_POTI3] = Setting.value("Poti_3", 7).toInt(); |
1141 | ParameterSet[Set][P_KANAL_POTI4] = Setting.value("Poti_4", 8).toInt(); |
1152 | ParameterSet[Set][P_KANAL_POTI4] = Setting.value("Poti_4", 8).toInt(); |
1142 | Setting.endGroup(); |
1153 | Setting.endGroup(); |
1143 | 1154 | ||
1144 | Setting.beginGroup("Stick"); |
1155 | Setting.beginGroup("Stick"); |
1145 | ParameterSet[Set][P_STICK_P] = Setting.value("Nick_Roll-P", 4).toInt(); |
1156 | ParameterSet[Set][P_STICK_P] = Setting.value("Nick_Roll-P", 4).toInt(); |
1146 | ParameterSet[Set][P_STICK_D] = Setting.value("Nick_Roll-D", 8).toInt(); |
1157 | ParameterSet[Set][P_STICK_D] = Setting.value("Nick_Roll-D", 8).toInt(); |
1147 | ParameterSet[Set][P_GIER_P] = Setting.value("Gier-P", 1).toInt(); |
1158 | ParameterSet[Set][P_GIER_P] = Setting.value("Gier-P", 1).toInt(); |
1148 | ParameterSet[Set][P_EXTERNAL] = Setting.value("ExternalControl", 1).toInt(); |
1159 | ParameterSet[Set][P_EXTERNAL] = Setting.value("ExternalControl", 1).toInt(); |
1149 | Setting.endGroup(); |
1160 | Setting.endGroup(); |
1150 | 1161 | ||
1151 | Setting.beginGroup("Altitude"); |
1162 | Setting.beginGroup("Altitude"); |
1152 | ParameterSet[Set][P_MAXHOEHE] = Setting.value("Setpoint", 251).toInt(); |
1163 | ParameterSet[Set][P_MAXHOEHE] = Setting.value("Setpoint", 251).toInt(); |
1153 | ParameterSet[Set][P_MIN_GAS] = Setting.value("MinGas", 30).toInt(); |
1164 | ParameterSet[Set][P_MIN_GAS] = Setting.value("MinGas", 30).toInt(); |
1154 | ParameterSet[Set][P_HOEHE_P] = Setting.value("P", 10).toInt(); |
1165 | ParameterSet[Set][P_HOEHE_P] = Setting.value("P", 10).toInt(); |
1155 | ParameterSet[Set][P_DRUCK_D] = Setting.value("Barometric-D", 30).toInt(); |
1166 | ParameterSet[Set][P_DRUCK_D] = Setting.value("Barometric-D", 30).toInt(); |
1156 | ParameterSet[Set][P_HOEHE_ACC] = Setting.value("Z-ACC-Effect", 30).toInt(); |
1167 | ParameterSet[Set][P_HOEHE_ACC] = Setting.value("Z-ACC-Effect", 30).toInt(); |
1157 | ParameterSet[Set][P_HOEHE_GAIN] = Setting.value("Gain", 3).toInt(); |
1168 | ParameterSet[Set][P_HOEHE_GAIN] = Setting.value("Gain", 3).toInt(); |
1158 | Setting.endGroup(); |
1169 | Setting.endGroup(); |
1159 | 1170 | ||
1160 | Setting.beginGroup("Gyro"); |
1171 | Setting.beginGroup("Gyro"); |
1161 | ParameterSet[Set][P_GYRO_P] = Setting.value("P", 80).toInt(); |
1172 | ParameterSet[Set][P_GYRO_P] = Setting.value("P", 80).toInt(); |
1162 | ParameterSet[Set][P_GYRO_I] = Setting.value("I", 120).toInt(); |
1173 | ParameterSet[Set][P_GYRO_I] = Setting.value("I", 120).toInt(); |
1163 | ParameterSet[Set][P_DYNAMIC_STAB] = Setting.value("DynamicStability", 75).toInt(); |
1174 | ParameterSet[Set][P_DYNAMIC_STAB] = Setting.value("DynamicStability", 75).toInt(); |
1164 | ParameterSet[Set][P_GYRO_ACC_FAKTOR] = Setting.value("ACC_Gyro-Factor", 30).toInt(); |
1175 | ParameterSet[Set][P_GYRO_ACC_FAKTOR] = Setting.value("ACC_Gyro-Factor", 30).toInt(); |
1165 | ParameterSet[Set][P_GYRO_ACC_ABGL] = Setting.value("ACC_Gyro-Compensation", 32).toInt(); |
1176 | ParameterSet[Set][P_GYRO_ACC_ABGL] = Setting.value("ACC_Gyro-Compensation", 32).toInt(); |
1166 | ParameterSet[Set][P_DRIFT_KOMP] = Setting.value("DriftCompensation", 4).toInt(); |
1177 | ParameterSet[Set][P_DRIFT_KOMP] = Setting.value("DriftCompensation", 4).toInt(); |
1167 | ParameterSet[Set][P_FAKTOR_I] = Setting.value("Main-I", 32).toInt(); |
1178 | ParameterSet[Set][P_FAKTOR_I] = Setting.value("Main-I", 32).toInt(); |
1168 | Setting.endGroup(); |
1179 | Setting.endGroup(); |
1169 | 1180 | ||
1170 | Setting.beginGroup("Camera"); |
1181 | Setting.beginGroup("Camera"); |
1171 | ParameterSet[Set][P_SERVO_NICK_CONT] = Setting.value("ServoNickControl", 100).toInt(); |
1182 | ParameterSet[Set][P_SERVO_NICK_CONT] = Setting.value("ServoNickControl", 100).toInt(); |
1172 | ParameterSet[Set][P_SERVO_NICK_COMP] = Setting.value("ServoNickCompensation", 40).toInt(); |
1183 | ParameterSet[Set][P_SERVO_NICK_COMP] = Setting.value("ServoNickCompensation", 40).toInt(); |
1173 | ParameterSet[Set][P_SERVO_NICK_COMPI] = Setting.value("ServoNickInvert", 0).toInt(); |
1184 | ParameterSet[Set][P_SERVO_NICK_COMPI] = Setting.value("ServoNickInvert", 0).toInt(); |
1174 | ParameterSet[Set][P_SERVO_NICK_MIN] = Setting.value("ServoNickMin", 50).toInt(); |
1185 | ParameterSet[Set][P_SERVO_NICK_MIN] = Setting.value("ServoNickMin", 50).toInt(); |
1175 | ParameterSet[Set][P_SERVO_NICK_MAX] = Setting.value("ServoNickMax", 150).toInt(); |
1186 | ParameterSet[Set][P_SERVO_NICK_MAX] = Setting.value("ServoNickMax", 150).toInt(); |
1176 | ParameterSet[Set][P_SERVO_NICK_REFR] = Setting.value("ServoNickRefreshRate", 5).toInt(); |
1187 | ParameterSet[Set][P_SERVO_NICK_REFR] = Setting.value("ServoNickRefreshRate", 5).toInt(); |
1177 | Setting.endGroup(); |
1188 | Setting.endGroup(); |
1178 | 1189 | ||
1179 | Setting.beginGroup("Others"); |
1190 | Setting.beginGroup("Others"); |
1180 | ParameterSet[Set][P_GAS_MIN] = Setting.value("MinGas", 8).toInt(); |
1191 | ParameterSet[Set][P_GAS_MIN] = Setting.value("MinGas", 8).toInt(); |
1181 | ParameterSet[Set][P_GAS_MAX] = Setting.value("MaxGas", 230).toInt(); |
1192 | ParameterSet[Set][P_GAS_MAX] = Setting.value("MaxGas", 230).toInt(); |
1182 | ParameterSet[Set][P_KOMPASS_WIRKUNG] = Setting.value("Compass-Effect", 128).toInt(); |
1193 | ParameterSet[Set][P_KOMPASS_WIRKUNG] = Setting.value("Compass-Effect", 128).toInt(); |
1183 | ParameterSet[Set][P_UNTERSPANNUNG] = Setting.value("UnderVoltage", 94).toInt(); |
1194 | ParameterSet[Set][P_UNTERSPANNUNG] = Setting.value("UnderVoltage", 94).toInt(); |
1184 | ParameterSet[Set][P_NOTGAS] = Setting.value("NotGas", 35).toInt(); |
1195 | ParameterSet[Set][P_NOTGAS] = Setting.value("NotGas", 35).toInt(); |
1185 | ParameterSet[Set][P_NOTGASZEIT] = Setting.value("NotGasTime", 30).toInt(); |
1196 | ParameterSet[Set][P_NOTGASZEIT] = Setting.value("NotGasTime", 30).toInt(); |
1186 | Setting.endGroup(); |
1197 | Setting.endGroup(); |
1187 | 1198 | ||
1188 | Setting.beginGroup("Coupling"); |
1199 | Setting.beginGroup("Coupling"); |
1189 | ParameterSet[Set][P_ACHS_KOPPLUNG] = Setting.value("YawPosFeedback", 90).toInt(); |
1200 | ParameterSet[Set][P_ACHS_KOPPLUNG] = Setting.value("YawPosFeedback", 90).toInt(); |
1190 | ParameterSet[Set][P_ACHS_GKOPPLUNG] = Setting.value("YawNegFeedback", 5).toInt(); |
1201 | ParameterSet[Set][P_ACHS_GKOPPLUNG] = Setting.value("YawNegFeedback", 5).toInt(); |
1191 | Setting.endGroup(); |
1202 | Setting.endGroup(); |
1192 | 1203 | ||
1193 | Setting.beginGroup("Loop"); |
1204 | Setting.beginGroup("Loop"); |
1194 | ParameterSet[Set][P_LOOP_CONFIG] = Setting.value("Config", 0).toInt(); |
1205 | ParameterSet[Set][P_LOOP_CONFIG] = Setting.value("Config", 0).toInt(); |
1195 | ParameterSet[Set][P_LOOP_GAS_LIMIT] = Setting.value("GasLimit", 50).toInt(); |
1206 | ParameterSet[Set][P_LOOP_GAS_LIMIT] = Setting.value("GasLimit", 50).toInt(); |
1196 | ParameterSet[Set][P_LOOP_THRESHOLD] = Setting.value("StickThreshold", 90).toInt(); |
1207 | ParameterSet[Set][P_LOOP_THRESHOLD] = Setting.value("StickThreshold", 90).toInt(); |
1197 | ParameterSet[Set][P_LOOP_HYSTERESE] = Setting.value("LoopHysteresis", 50).toInt(); |
1208 | ParameterSet[Set][P_LOOP_HYSTERESE] = Setting.value("LoopHysteresis", 50).toInt(); |
1198 | ParameterSet[Set][P_WINKEL_NICK] = Setting.value("TurnOverNick", 85).toInt(); |
1209 | ParameterSet[Set][P_WINKEL_NICK] = Setting.value("TurnOverNick", 85).toInt(); |
1199 | ParameterSet[Set][P_WINKEL_ROLL] = Setting.value("TurnOverRoll", 85).toInt(); |
1210 | ParameterSet[Set][P_WINKEL_ROLL] = Setting.value("TurnOverRoll", 85).toInt(); |
1200 | Setting.endGroup(); |
1211 | Setting.endGroup(); |
1201 | 1212 | ||
1202 | Setting.beginGroup("User"); |
1213 | Setting.beginGroup("User"); |
1203 | ParameterSet[Set][P_USER_1] = Setting.value("Parameter_1", 0).toInt(); |
1214 | ParameterSet[Set][P_USER_1] = Setting.value("Parameter_1", 0).toInt(); |
1204 | ParameterSet[Set][P_USER_2] = Setting.value("Parameter_2", 0).toInt(); |
1215 | ParameterSet[Set][P_USER_2] = Setting.value("Parameter_2", 0).toInt(); |
1205 | ParameterSet[Set][P_USER_3] = Setting.value("Parameter_3", 0).toInt(); |
1216 | ParameterSet[Set][P_USER_3] = Setting.value("Parameter_3", 0).toInt(); |
1206 | ParameterSet[Set][P_USER_4] = Setting.value("Parameter_4", 0).toInt(); |
1217 | ParameterSet[Set][P_USER_4] = Setting.value("Parameter_4", 0).toInt(); |
1207 | ParameterSet[Set][P_USER_5] = Setting.value("Parameter_5", 0).toInt(); |
1218 | ParameterSet[Set][P_USER_5] = Setting.value("Parameter_5", 0).toInt(); |
1208 | ParameterSet[Set][P_USER_6] = Setting.value("Parameter_6", 0).toInt(); |
1219 | ParameterSet[Set][P_USER_6] = Setting.value("Parameter_6", 0).toInt(); |
1209 | ParameterSet[Set][P_USER_7] = Setting.value("Parameter_7", 0).toInt(); |
1220 | ParameterSet[Set][P_USER_7] = Setting.value("Parameter_7", 0).toInt(); |
1210 | ParameterSet[Set][P_USER_8] = Setting.value("Parameter_8", 0).toInt(); |
1221 | ParameterSet[Set][P_USER_8] = Setting.value("Parameter_8", 0).toInt(); |
1211 | Setting.endGroup(); |
1222 | Setting.endGroup(); |
1212 | 1223 | ||
1213 | Setting.beginGroup("Output"); |
1224 | Setting.beginGroup("Output"); |
1214 | ParameterSet[Set][P_J16_BITMASK] = Setting.value("J16_Bitmask", 255).toInt(); |
1225 | ParameterSet[Set][P_J16_BITMASK] = Setting.value("J16_Bitmask", 255).toInt(); |
1215 | ParameterSet[Set][P_J16_TIMING] = Setting.value("J16_Timing", 251).toInt(); |
1226 | ParameterSet[Set][P_J16_TIMING] = Setting.value("J16_Timing", 251).toInt(); |
1216 | ParameterSet[Set][P_J17_BITMASK] = Setting.value("J17_Bitmask", 255).toInt(); |
1227 | ParameterSet[Set][P_J17_BITMASK] = Setting.value("J17_Bitmask", 255).toInt(); |
1217 | ParameterSet[Set][P_J17_TIMING] = Setting.value("J17_Timing", 251).toInt(); |
1228 | ParameterSet[Set][P_J17_TIMING] = Setting.value("J17_Timing", 251).toInt(); |
1218 | Setting.endGroup(); |
1229 | Setting.endGroup(); |
1219 | 1230 | ||
1220 | Setting.beginGroup("NaviCtrl"); |
1231 | Setting.beginGroup("NaviCtrl"); |
1221 | ParameterSet[Set][P_NAV_GPS_MODE] = Setting.value("GPS_ModeControl", 253).toInt(); |
1232 | ParameterSet[Set][P_NAV_GPS_MODE] = Setting.value("GPS_ModeControl", 253).toInt(); |
1222 | ParameterSet[Set][P_NAV_GPS_GAIN] = Setting.value("GPS_Gain", 100).toInt(); |
1233 | ParameterSet[Set][P_NAV_GPS_GAIN] = Setting.value("GPS_Gain", 100).toInt(); |
1223 | ParameterSet[Set][P_NAV_GPS_P] = Setting.value("GPS_P", 90).toInt(); |
1234 | ParameterSet[Set][P_NAV_GPS_P] = Setting.value("GPS_P", 90).toInt(); |
1224 | ParameterSet[Set][P_NAV_GPS_I] = Setting.value("GPS_I", 90).toInt(); |
1235 | ParameterSet[Set][P_NAV_GPS_I] = Setting.value("GPS_I", 90).toInt(); |
1225 | ParameterSet[Set][P_NAV_GPS_D] = Setting.value("GPS_D", 90).toInt(); |
1236 | ParameterSet[Set][P_NAV_GPS_D] = Setting.value("GPS_D", 90).toInt(); |
1226 | ParameterSet[Set][P_NAV_GPS_ACC] = Setting.value("GPS_Acc", 0).toInt(); |
1237 | ParameterSet[Set][P_NAV_GPS_ACC] = Setting.value("GPS_Acc", 0).toInt(); |
1227 | ParameterSet[Set][P_NAV_GPS_MIN] = Setting.value("GPS_MinSat", 6).toInt(); |
1238 | ParameterSet[Set][P_NAV_GPS_MIN] = Setting.value("GPS_MinSat", 6).toInt(); |
1228 | ParameterSet[Set][P_NAV_STICK_THRE] = Setting.value("GPS_StickThreshold", 8).toInt(); |
1239 | ParameterSet[Set][P_NAV_STICK_THRE] = Setting.value("GPS_StickThreshold", 8).toInt(); |
1229 | ParameterSet[Set][P_NAV_WIND_CORR] = Setting.value("GPS_WindCorrection", 90).toInt(); |
1240 | ParameterSet[Set][P_NAV_WIND_CORR] = Setting.value("GPS_WindCorrection", 90).toInt(); |
1230 | ParameterSet[Set][P_NAV_SPEED_COMP] = Setting.value("GPS_SpeedCompensation", 30).toInt(); |
1241 | ParameterSet[Set][P_NAV_SPEED_COMP] = Setting.value("GPS_SpeedCompensation", 30).toInt(); |
1231 | ParameterSet[Set][P_NAV_RADIUS] = Setting.value("GPS_MaxRadius", 100).toInt(); |
1242 | ParameterSet[Set][P_NAV_RADIUS] = Setting.value("GPS_MaxRadius", 100).toInt(); |
1232 | Setting.endGroup(); |
1243 | Setting.endGroup(); |
1233 | 1244 | ||
1234 | show_ParameterSet(Set); |
1245 | show_ParameterSet(Set); |
1235 | } |
1246 | } |
1236 | } |
1247 | } |
1237 | 1248 | ||
1238 | void MKTool::show_ParameterSet(int Set) // DONE 0.71g |
1249 | void MKTool::show_ParameterSet(int Set) // DONE 0.71g |
1239 | { |
1250 | { |
1240 | char Name[12]; |
1251 | char Name[12]; |
1241 | for (int a = 0; a < 12; a++) |
1252 | for (int a = 0; a < 12; a++) |
1242 | { |
1253 | { |
1243 | Name[a] = ParameterSet[Set][P_NAME+a]; |
1254 | Name[a] = ParameterSet[Set][P_NAME+a]; |
1244 | } |
1255 | } |
1245 | le_SetName->setText(QString(Name)); |
1256 | le_SetName->setText(QString(Name)); |
1246 | 1257 | ||
1247 | // Seite 1 |
1258 | // Seite 1 |
1248 | { |
1259 | { |
1249 | cb_1_1->setChecked(ParameterSet[Set][P_GLOBAL_CONF] & 0x01); |
1260 | cb_1_1->setChecked(ParameterSet[Set][P_GLOBAL_CONF] & 0x01); |
1250 | cb_1_2->setChecked(ParameterSet[Set][P_GLOBAL_CONF] & 0x02); |
1261 | cb_1_2->setChecked(ParameterSet[Set][P_GLOBAL_CONF] & 0x02); |
1251 | cb_1_3->setChecked(ParameterSet[Set][P_GLOBAL_CONF] & 0x04); |
1262 | cb_1_3->setChecked(ParameterSet[Set][P_GLOBAL_CONF] & 0x04); |
1252 | cb_1_4->setChecked(ParameterSet[Set][P_GLOBAL_CONF] & 0x08); |
1263 | cb_1_4->setChecked(ParameterSet[Set][P_GLOBAL_CONF] & 0x08); |
1253 | cb_1_5->setChecked(ParameterSet[Set][P_GLOBAL_CONF] & 0x10); |
1264 | cb_1_5->setChecked(ParameterSet[Set][P_GLOBAL_CONF] & 0x10); |
1254 | cb_1_6->setChecked(ParameterSet[Set][P_GLOBAL_CONF] & 0x20); |
1265 | cb_1_6->setChecked(ParameterSet[Set][P_GLOBAL_CONF] & 0x20); |
1255 | cb_1_7->setChecked(ParameterSet[Set][P_GLOBAL_CONF] & 0x40); |
1266 | cb_1_7->setChecked(ParameterSet[Set][P_GLOBAL_CONF] & 0x40); |
1256 | cb_1_8->setChecked(ParameterSet[Set][P_GLOBAL_CONF] & 0x80); |
1267 | cb_1_8->setChecked(ParameterSet[Set][P_GLOBAL_CONF] & 0x80); |
1257 | } |
1268 | } |
1258 | // Seite 2 |
1269 | // Seite 2 |
1259 | { |
1270 | { |
1260 | sb_2_1->setValue(ParameterSet[Set][P_KANAL_NICK]); |
1271 | sb_2_1->setValue(ParameterSet[Set][P_KANAL_NICK]); |
1261 | sb_2_2->setValue(ParameterSet[Set][P_KANAL_ROLL]); |
1272 | sb_2_2->setValue(ParameterSet[Set][P_KANAL_ROLL]); |
1262 | sb_2_3->setValue(ParameterSet[Set][P_KANAL_GAS]); |
1273 | sb_2_3->setValue(ParameterSet[Set][P_KANAL_GAS]); |
1263 | sb_2_4->setValue(ParameterSet[Set][P_KANAL_GIER]); |
1274 | sb_2_4->setValue(ParameterSet[Set][P_KANAL_GIER]); |
1264 | sb_2_5->setValue(ParameterSet[Set][P_KANAL_POTI1]); |
1275 | sb_2_5->setValue(ParameterSet[Set][P_KANAL_POTI1]); |
1265 | sb_2_6->setValue(ParameterSet[Set][P_KANAL_POTI2]); |
1276 | sb_2_6->setValue(ParameterSet[Set][P_KANAL_POTI2]); |
1266 | sb_2_7->setValue(ParameterSet[Set][P_KANAL_POTI3]); |
1277 | sb_2_7->setValue(ParameterSet[Set][P_KANAL_POTI3]); |
1267 | sb_2_8->setValue(ParameterSet[Set][P_KANAL_POTI4]); |
1278 | sb_2_8->setValue(ParameterSet[Set][P_KANAL_POTI4]); |
1268 | } |
1279 | } |
1269 | // Seite 3 |
1280 | // Seite 3 |
1270 | { |
1281 | { |
1271 | sb_3_1->setValue(ParameterSet[Set][P_STICK_P]); |
1282 | sb_3_1->setValue(ParameterSet[Set][P_STICK_P]); |
1272 | sb_3_2->setValue(ParameterSet[Set][P_STICK_D]); |
1283 | sb_3_2->setValue(ParameterSet[Set][P_STICK_D]); |
1273 | cb_3_3 = setCombo(cb_3_3, Set, P_GIER_P); |
1284 | cb_3_3 = setCombo(cb_3_3, Set, P_GIER_P); |
1274 | cb_3_4 = setCombo(cb_3_4, Set, P_EXTERNAL); |
1285 | cb_3_4 = setCombo(cb_3_4, Set, P_EXTERNAL); |
1275 | } |
1286 | } |
1276 | // Seite 4 |
1287 | // Seite 4 |
1277 | { |
1288 | { |
1278 | cb_4_1 = setCombo(cb_4_1, Set, P_MAXHOEHE); |
1289 | cb_4_1 = setCombo(cb_4_1, Set, P_MAXHOEHE); |
1279 | sb_4_2->setValue(ParameterSet[Set][P_MIN_GAS]); |
1290 | sb_4_2->setValue(ParameterSet[Set][P_MIN_GAS]); |
1280 | cb_4_3 = setCombo(cb_4_3, Set, P_HOEHE_P); |
1291 | cb_4_3 = setCombo(cb_4_3, Set, P_HOEHE_P); |
1281 | cb_4_4 = setCombo(cb_4_4, Set, P_DRUCK_D); |
1292 | cb_4_4 = setCombo(cb_4_4, Set, P_DRUCK_D); |
1282 | cb_4_5 = setCombo(cb_4_5, Set, P_HOEHE_ACC); |
1293 | cb_4_5 = setCombo(cb_4_5, Set, P_HOEHE_ACC); |
1283 | sb_4_6->setValue(ParameterSet[Set][P_HOEHE_GAIN]); |
1294 | sb_4_6->setValue(ParameterSet[Set][P_HOEHE_GAIN]); |
1284 | cb_4_7->setChecked(ParameterSet[Set][P_LOOP_CONFIG] & 0x10); |
1295 | cb_4_7->setChecked(ParameterSet[Set][P_LOOP_CONFIG] & 0x10); |
1285 | } |
1296 | } |
1286 | // Seite 5 |
1297 | // Seite 5 |
1287 | { |
1298 | { |
1288 | cb_5_1 = setCombo(cb_5_1, Set, P_GYRO_P); |
1299 | cb_5_1 = setCombo(cb_5_1, Set, P_GYRO_P); |
1289 | cb_5_2 = setCombo(cb_5_2, Set, P_GYRO_I); |
1300 | cb_5_2 = setCombo(cb_5_2, Set, P_GYRO_I); |
1290 | cb_5_3 = setCombo(cb_5_3, Set, P_DYNAMIC_STAB); |
1301 | cb_5_3 = setCombo(cb_5_3, Set, P_DYNAMIC_STAB); |
1291 | sb_5_4->setValue(ParameterSet[Set][P_GYRO_ACC_FAKTOR]); |
1302 | sb_5_4->setValue(ParameterSet[Set][P_GYRO_ACC_FAKTOR]); |
1292 | sb_5_5->setValue(ParameterSet[Set][P_GYRO_ACC_ABGL]); |
1303 | sb_5_5->setValue(ParameterSet[Set][P_GYRO_ACC_ABGL]); |
1293 | cb_5_6 = setCombo(cb_5_6, Set, P_FAKTOR_I); |
1304 | cb_5_6 = setCombo(cb_5_6, Set, P_FAKTOR_I); |
1294 | sb_5_7->setValue(ParameterSet[Set][P_DRIFT_KOMP]); |
1305 | sb_5_7->setValue(ParameterSet[Set][P_DRIFT_KOMP]); |
1295 | } |
1306 | } |
1296 | // Seite 6 |
1307 | // Seite 6 |
1297 | { |
1308 | { |
1298 | cb_6_1 = setCombo(cb_6_1, Set, P_SERVO_NICK_CONT); |
1309 | cb_6_1 = setCombo(cb_6_1, Set, P_SERVO_NICK_CONT); |
1299 | sb_6_2->setValue(ParameterSet[Set][P_SERVO_NICK_COMP]); |
1310 | sb_6_2->setValue(ParameterSet[Set][P_SERVO_NICK_COMP]); |
1300 | sb_6_3->setValue(ParameterSet[Set][P_SERVO_NICK_MIN]); |
1311 | sb_6_3->setValue(ParameterSet[Set][P_SERVO_NICK_MIN]); |
1301 | sb_6_4->setValue(ParameterSet[Set][P_SERVO_NICK_MAX]); |
1312 | sb_6_4->setValue(ParameterSet[Set][P_SERVO_NICK_MAX]); |
1302 | sb_6_5->setValue(ParameterSet[Set][P_SERVO_NICK_REFR]); |
1313 | sb_6_5->setValue(ParameterSet[Set][P_SERVO_NICK_REFR]); |
1303 | cb_6_6->setChecked(ParameterSet[Set][P_SERVO_NICK_COMPI]); |
1314 | cb_6_6->setChecked(ParameterSet[Set][P_SERVO_NICK_COMPI]); |
1304 | } |
1315 | } |
1305 | // Seite 7 |
1316 | // Seite 7 |
1306 | { |
1317 | { |
1307 | sb_7_1->setValue(ParameterSet[Set][P_GAS_MIN]); |
1318 | sb_7_1->setValue(ParameterSet[Set][P_GAS_MIN]); |
1308 | sb_7_2->setValue(ParameterSet[Set][P_GAS_MAX]); |
1319 | sb_7_2->setValue(ParameterSet[Set][P_GAS_MAX]); |
1309 | cb_7_3 = setCombo(cb_7_3, Set, P_KOMPASS_WIRKUNG); |
1320 | cb_7_3 = setCombo(cb_7_3, Set, P_KOMPASS_WIRKUNG); |
1310 | sb_7_4->setValue(ParameterSet[Set][P_UNTERSPANNUNG]); |
1321 | sb_7_4->setValue(ParameterSet[Set][P_UNTERSPANNUNG]); |
1311 | sb_7_5->setValue(ParameterSet[Set][P_NOTGASZEIT]); |
1322 | sb_7_5->setValue(ParameterSet[Set][P_NOTGASZEIT]); |
1312 | sb_7_6->setValue(ParameterSet[Set][P_NOTGAS]); |
1323 | sb_7_6->setValue(ParameterSet[Set][P_NOTGAS]); |
1313 | } |
1324 | } |
1314 | // Seite 8 |
1325 | // Seite 8 |
1315 | { |
1326 | { |
1316 | cb_8_1 = setCombo(cb_8_1, Set, P_ACHS_KOPPLUNG); |
1327 | cb_8_1 = setCombo(cb_8_1, Set, P_ACHS_KOPPLUNG); |
1317 | cb_8_2 = setCombo(cb_8_2, Set, P_ACHS_GKOPPLUNG); |
1328 | cb_8_2 = setCombo(cb_8_2, Set, P_ACHS_GKOPPLUNG); |
1318 | } |
1329 | } |
1319 | // Seite 9 |
1330 | // Seite 9 |
1320 | { |
1331 | { |
1321 | if (ParameterSet[Set][P_LOOP_CONFIG] & 0x01) |
1332 | if (ParameterSet[Set][P_LOOP_CONFIG] & 0x01) |
1322 | { |
1333 | { |
1323 | tb_9_6->setIcon(Icons[20]); |
1334 | tb_9_6->setIcon(Icons[20]); |
1324 | tb_9_6->setText("1"); |
1335 | tb_9_6->setText("1"); |
1325 | } |
1336 | } |
1326 | else |
1337 | else |
1327 | { |
1338 | { |
1328 | tb_9_6->setIcon(Icons[21]); |
1339 | tb_9_6->setIcon(Icons[21]); |
1329 | tb_9_6->setText("0"); |
1340 | tb_9_6->setText("0"); |
1330 | } |
1341 | } |
1331 | 1342 | ||
1332 | if (ParameterSet[Set][P_LOOP_CONFIG] & 0x02) |
1343 | if (ParameterSet[Set][P_LOOP_CONFIG] & 0x02) |
1333 | { |
1344 | { |
1334 | tb_9_7->setIcon(Icons[22]); |
1345 | tb_9_7->setIcon(Icons[22]); |
1335 | tb_9_7->setText("1"); |
1346 | tb_9_7->setText("1"); |
1336 | } |
1347 | } |
1337 | else |
1348 | else |
1338 | { |
1349 | { |
1339 | tb_9_7->setIcon(Icons[23]); |
1350 | tb_9_7->setIcon(Icons[23]); |
1340 | tb_9_7->setText("0"); |
1351 | tb_9_7->setText("0"); |
1341 | } |
1352 | } |
1342 | 1353 | ||
1343 | if (ParameterSet[Set][P_LOOP_CONFIG] & 0x04) |
1354 | if (ParameterSet[Set][P_LOOP_CONFIG] & 0x04) |
1344 | { |
1355 | { |
1345 | tb_9_8->setIcon(Icons[24]); |
1356 | tb_9_8->setIcon(Icons[24]); |
1346 | tb_9_8->setText("1"); |
1357 | tb_9_8->setText("1"); |
1347 | } |
1358 | } |
1348 | else |
1359 | else |
1349 | { |
1360 | { |
1350 | tb_9_8->setIcon(Icons[25]); |
1361 | tb_9_8->setIcon(Icons[25]); |
1351 | tb_9_8->setText("0"); |
1362 | tb_9_8->setText("0"); |
1352 | } |
1363 | } |
1353 | 1364 | ||
1354 | if (ParameterSet[Set][P_LOOP_CONFIG] & 0x08) |
1365 | if (ParameterSet[Set][P_LOOP_CONFIG] & 0x08) |
1355 | { |
1366 | { |
1356 | tb_9_9->setIcon(Icons[26]); |
1367 | tb_9_9->setIcon(Icons[26]); |
1357 | tb_9_9->setText("1"); |
1368 | tb_9_9->setText("1"); |
1358 | } |
1369 | } |
1359 | else |
1370 | else |
1360 | { |
1371 | { |
1361 | tb_9_9->setIcon(Icons[27]); |
1372 | tb_9_9->setIcon(Icons[27]); |
1362 | tb_9_9->setText("0"); |
1373 | tb_9_9->setText("0"); |
1363 | } |
1374 | } |
1364 | 1375 | ||
1365 | cb_9_1 = setCombo(cb_9_1, Set, P_LOOP_GAS_LIMIT); |
1376 | cb_9_1 = setCombo(cb_9_1, Set, P_LOOP_GAS_LIMIT); |
1366 | sb_9_2->setValue(ParameterSet[Set][P_LOOP_THRESHOLD]); |
1377 | sb_9_2->setValue(ParameterSet[Set][P_LOOP_THRESHOLD]); |
1367 | sb_9_3->setValue(ParameterSet[Set][P_WINKEL_NICK]); |
1378 | sb_9_3->setValue(ParameterSet[Set][P_WINKEL_NICK]); |
1368 | sb_9_4->setValue(ParameterSet[Set][P_LOOP_HYSTERESE]); |
1379 | sb_9_4->setValue(ParameterSet[Set][P_LOOP_HYSTERESE]); |
1369 | sb_9_5->setValue(ParameterSet[Set][P_WINKEL_ROLL]); |
1380 | sb_9_5->setValue(ParameterSet[Set][P_WINKEL_ROLL]); |
1370 | } |
1381 | } |
1371 | // Seite 10 |
1382 | // Seite 10 |
1372 | { |
1383 | { |
1373 | cb_10_1 = setCombo(cb_10_1, Set, P_USER_1); |
1384 | cb_10_1 = setCombo(cb_10_1, Set, P_USER_1); |
1374 | cb_10_2 = setCombo(cb_10_2, Set, P_USER_2); |
1385 | cb_10_2 = setCombo(cb_10_2, Set, P_USER_2); |
1375 | cb_10_3 = setCombo(cb_10_3, Set, P_USER_3); |
1386 | cb_10_3 = setCombo(cb_10_3, Set, P_USER_3); |
1376 | cb_10_4 = setCombo(cb_10_4, Set, P_USER_4); |
1387 | cb_10_4 = setCombo(cb_10_4, Set, P_USER_4); |
1377 | cb_10_5 = setCombo(cb_10_5, Set, P_USER_5); |
1388 | cb_10_5 = setCombo(cb_10_5, Set, P_USER_5); |
1378 | cb_10_6 = setCombo(cb_10_6, Set, P_USER_6); |
1389 | cb_10_6 = setCombo(cb_10_6, Set, P_USER_6); |
1379 | cb_10_7 = setCombo(cb_10_7, Set, P_USER_7); |
1390 | cb_10_7 = setCombo(cb_10_7, Set, P_USER_7); |
1380 | cb_10_8 = setCombo(cb_10_8, Set, P_USER_8); |
1391 | cb_10_8 = setCombo(cb_10_8, Set, P_USER_8); |
1381 | } |
1392 | } |
1382 | // Seite 11 |
1393 | // Seite 11 |
1383 | { |
1394 | { |
1384 | sb_11_1->setValue(ParameterSet[Set][P_J16_BITMASK]); |
1395 | sb_11_1->setValue(ParameterSet[Set][P_J16_BITMASK]); |
1385 | cb_11_2 = setCombo(cb_11_2, Set, P_J16_TIMING); |
1396 | cb_11_2 = setCombo(cb_11_2, Set, P_J16_TIMING); |
1386 | sb_11_3->setValue(ParameterSet[Set][P_J17_BITMASK]); |
1397 | sb_11_3->setValue(ParameterSet[Set][P_J17_BITMASK]); |
1387 | cb_11_4 = setCombo(cb_11_4, Set, P_J17_TIMING); |
1398 | cb_11_4 = setCombo(cb_11_4, Set, P_J17_TIMING); |
1388 | } |
1399 | } |
1389 | // Seite 12 |
1400 | // Seite 12 |
1390 | { |
1401 | { |
1391 | cb_12_1 = setCombo(cb_12_1, Set, P_NAV_GPS_MODE); |
1402 | cb_12_1 = setCombo(cb_12_1, Set, P_NAV_GPS_MODE); |
1392 | cb_12_2 = setCombo(cb_12_2, Set, P_NAV_GPS_GAIN); |
1403 | cb_12_2 = setCombo(cb_12_2, Set, P_NAV_GPS_GAIN); |
1393 | sb_12_3->setValue(ParameterSet[Set][P_NAV_STICK_THRE]); |
1404 | sb_12_3->setValue(ParameterSet[Set][P_NAV_STICK_THRE]); |
1394 | sb_12_4->setValue(ParameterSet[Set][P_NAV_GPS_MIN]); |
1405 | sb_12_4->setValue(ParameterSet[Set][P_NAV_GPS_MIN]); |
1395 | cb_12_5 = setCombo(cb_12_5, Set, P_NAV_GPS_P); |
1406 | cb_12_5 = setCombo(cb_12_5, Set, P_NAV_GPS_P); |
1396 | cb_12_6 = setCombo(cb_12_6, Set, P_NAV_GPS_I); |
1407 | cb_12_6 = setCombo(cb_12_6, Set, P_NAV_GPS_I); |
1397 | cb_12_7 = setCombo(cb_12_7, Set, P_NAV_GPS_D); |
1408 | cb_12_7 = setCombo(cb_12_7, Set, P_NAV_GPS_D); |
1398 | cb_12_8 = setCombo(cb_12_8, Set, P_NAV_GPS_ACC); |
1409 | cb_12_8 = setCombo(cb_12_8, Set, P_NAV_GPS_ACC); |
1399 | } |
1410 | } |
1400 | 1411 | ||
1401 | // Seite 13 |
1412 | // Seite 13 |
1402 | { |
1413 | { |
1403 | cb_13_1 = setCombo(cb_13_1, Set, P_NAV_WIND_CORR); |
1414 | cb_13_1 = setCombo(cb_13_1, Set, P_NAV_WIND_CORR); |
1404 | cb_13_2 = setCombo(cb_13_2, Set, P_NAV_SPEED_COMP); |
1415 | cb_13_2 = setCombo(cb_13_2, Set, P_NAV_SPEED_COMP); |
1405 | cb_13_3 = setCombo(cb_13_3, Set, P_NAV_RADIUS); |
1416 | cb_13_3 = setCombo(cb_13_3, Set, P_NAV_RADIUS); |
1406 | } |
1417 | } |
1407 | 1418 | ||
1408 | 1419 | ||
1409 | } |
1420 | } |
1410 | 1421 | ||
1411 | void MKTool::slot_TabChanged(int Tab) // DONE 0.71g |
1422 | void MKTool::slot_TabChanged(int Tab) // DONE 0.71g |
1412 | { |
1423 | { |
1413 | Tab = Tab; |
1424 | Tab = Tab; |
1414 | - | ||
1415 | if ((tab_Main->currentWidget()->objectName() == QString("Tab_2")) && (tab_Par->currentIndex() == 1)) |
1425 | if (tab_Main->count() != 0) |
1416 | { |
1426 | { |
- | 1427 | if ((tab_Main->currentWidget()->objectName() == QString("Tab_2")) && (tab_Par->currentIndex() == 1)) |
|
- | 1428 | { |
|
1417 | TX_Data[0] = 0; |
1429 | TX_Data[0] = 0; |
1418 | send_Data('p', ADDRESS_FC, TX_Data, 0, true); |
1430 | send_Data('p', ADDRESS_FC, TX_Data, 0, true); |
1419 | 1431 | ||
1420 | Ticker->setInterval(500); |
1432 | Ticker->setInterval(500); |
1421 | TickerEvent[1] = true; |
1433 | TickerEvent[1] = true; |
1422 | } |
1434 | } |
1423 | else |
1435 | else |
1424 | { |
1436 | { |
1425 | Ticker->setInterval(2000); |
1437 | Ticker->setInterval(2000); |
1426 | TickerEvent[1] = false; |
1438 | TickerEvent[1] = false; |
1427 | } |
1439 | } |
1428 | 1440 | ||
1429 | if ((tab_Main->currentWidget()->objectName() == QString("Tab_4"))) |
1441 | if ((tab_Main->currentWidget()->objectName() == QString("Tab_4"))) |
1430 | { |
1442 | { |
1431 | TX_Data[0] = 0; |
1443 | TX_Data[0] = 0; |
1432 | TX_Data[1] = 0; |
1444 | TX_Data[1] = 0; |
1433 | send_Data('l', ADDRESS_ALL, TX_Data, 1, true); |
1445 | send_Data('l', ADDRESS_ALL, TX_Data, 1, true); |
1434 | 1446 | ||
1435 | Ticker->setInterval(500); |
1447 | Ticker->setInterval(500); |
1436 | TickerEvent[2] = true; |
1448 | TickerEvent[2] = true; |
1437 | } |
1449 | } |
1438 | else |
1450 | else |
- | 1451 | { |
|
1439 | { |
1452 | Ticker->setInterval(2000); |
1440 | Ticker->setInterval(2000); |
- | |
1441 | TickerEvent[2] = false; |
1453 | TickerEvent[2] = false; |
1442 | } |
1454 | } |
1443 | 1455 | } |
|
1444 | } |
1456 | } |
1445 | 1457 | ||
1446 | void MKTool::slot_LCD_UP() // DONE 0.71g |
1458 | void MKTool::slot_LCD_UP() // DONE 0.71g |
1447 | { |
1459 | { |
1448 | if (LCD_Page == LCD_MAX_Page) |
1460 | if (LCD_Page == LCD_MAX_Page) |
1449 | TX_Data[0] = 0; |
1461 | TX_Data[0] = 0; |
1450 | else |
1462 | else |
1451 | TX_Data[0] = LCD_Page + 1; |
1463 | TX_Data[0] = LCD_Page + 1; |
1452 | 1464 | ||
1453 | TX_Data[1] = 0; |
1465 | TX_Data[1] = 0; |
1454 | send_Data('l', ADDRESS_ALL, TX_Data, 1, true); |
1466 | send_Data('l', ADDRESS_ALL, TX_Data, 1, true); |
1455 | } |
1467 | } |
1456 | 1468 | ||
1457 | void MKTool::slot_LCD_DOWN() // DONE 0.71g |
1469 | void MKTool::slot_LCD_DOWN() // DONE 0.71g |
1458 | { |
1470 | { |
1459 | if (LCD_Page == 0) |
1471 | if (LCD_Page == 0) |
1460 | TX_Data[0] = LCD_MAX_Page; |
1472 | TX_Data[0] = LCD_MAX_Page; |
1461 | else |
1473 | else |
1462 | TX_Data[0] = LCD_Page - 1; |
1474 | TX_Data[0] = LCD_Page - 1; |
1463 | 1475 | ||
1464 | TX_Data[1] = 0; |
1476 | TX_Data[1] = 0; |
1465 | send_Data('l', ADDRESS_ALL, TX_Data, 1, true); |
1477 | send_Data('l', ADDRESS_ALL, TX_Data, 1, true); |
1466 | } |
1478 | } |
1467 | 1479 | ||
1468 | void MKTool::slot_GetParameter() // DONE 0.71g |
1480 | void MKTool::slot_GetParameter() // DONE 0.71g |
1469 | { |
1481 | { |
1470 | TX_Data[0] = sb_Set->value(); |
1482 | TX_Data[0] = sb_Set->value(); |
1471 | TX_Data[1] = 0; |
1483 | TX_Data[1] = 0; |
1472 | send_Data('q', ADDRESS_FC, TX_Data, 1); |
1484 | send_Data('q', ADDRESS_FC, TX_Data, 1); |
1473 | } |
1485 | } |
1474 | 1486 | ||
1475 | void MKTool::slot_SetParameter() // DONE 0.71g |
1487 | void MKTool::slot_SetParameter() // DONE 0.71g |
1476 | { |
1488 | { |
1477 | store_ParameterSet(sb_Set->value()); |
1489 | store_ParameterSet(sb_Set->value()); |
1478 | 1490 | ||
1479 | TX_Data[0] = sb_Set->value(); |
1491 | TX_Data[0] = sb_Set->value(); |
1480 | TX_Data[1] = VERSION_SETTINGS; |
1492 | TX_Data[1] = VERSION_SETTINGS; |
1481 | 1493 | ||
1482 | for (int a = 0; a < MaxParameter; a++) |
1494 | for (int a = 0; a < MaxParameter; a++) |
1483 | { |
1495 | { |
1484 | TX_Data[a + 2] = ParameterSet[sb_Set->value()][a]; |
1496 | TX_Data[a + 2] = ParameterSet[sb_Set->value()][a]; |
1485 | } |
1497 | } |
1486 | 1498 | ||
1487 | store_ParameterSet(sb_Set->value()); |
1499 | store_ParameterSet(sb_Set->value()); |
1488 | 1500 | ||
1489 | send_Data('s', ADDRESS_FC, TX_Data, MaxParameter + 2, false); |
1501 | send_Data('s', ADDRESS_FC, TX_Data, MaxParameter + 2, false); |
1490 | } |
1502 | } |
1491 | 1503 | ||
1492 | 1504 | ||
1493 | // Save GUI-Settings |
1505 | // Save GUI-Settings |
1494 | //////////////////// |
1506 | //////////////////// |
1495 | void MKTool::write_Settings() |
1507 | void MKTool::write_Settings() |
1496 | { |
1508 | { |
1497 | QBitArray TabViews(6); |
1509 | QBitArray TabViews(6); |
1498 | TabViews.setBit(0, ac_View0->isChecked()); |
1510 | TabViews.setBit(0, ac_View0->isChecked()); |
1499 | TabViews.setBit(1, ac_View1->isChecked()); |
1511 | TabViews.setBit(1, ac_View1->isChecked()); |
1500 | TabViews.setBit(2, ac_View2->isChecked()); |
1512 | TabViews.setBit(2, ac_View2->isChecked()); |
1501 | TabViews.setBit(3, ac_View3->isChecked()); |
1513 | TabViews.setBit(3, ac_View3->isChecked()); |
1502 | TabViews.setBit(4, ac_View4->isChecked()); |
1514 | TabViews.setBit(4, ac_View4->isChecked()); |
1503 | TabViews.setBit(5, ac_View5->isChecked()); |
1515 | TabViews.setBit(5, ac_View5->isChecked()); |
- | 1516 | ||
- | 1517 | Settings->GUI.Term_Info = cb_ShowMSG->isChecked(); |
|
- | 1518 | Settings->GUI.Term_Data = cb_ShowData->isChecked(); |
|
- | 1519 | Settings->GUI.Term_Always = cb_ShowAlways->isChecked(); |
|
1504 | 1520 | ||
1505 | QSettings Setting("KeyOz-Net", "QMK-Groundstation"); |
1521 | QSettings Setting("KeyOz-Net", "QMK-Groundstation"); |
1506 | 1522 | ||
1507 | Setting.beginGroup("Port"); |
1523 | Setting.beginGroup("Port"); |
1508 | Setting.setValue("TTY", le_Port->text()); |
1524 | Setting.setValue("TTY", le_Port->text()); |
1509 | Setting.endGroup(); |
1525 | Setting.endGroup(); |
1510 | 1526 | ||
1511 | Setting.beginGroup("GUI"); |
1527 | Setting.beginGroup("GUI"); |
1512 | Setting.setValue("IsMax", isMaximized()); |
1528 | Setting.setValue("IsMax", isMaximized()); |
1513 | Setting.setValue("Size", size()); |
1529 | Setting.setValue("Size", size()); |
1514 | Setting.setValue("Point", pos()); |
1530 | Setting.setValue("Point", pos()); |
1515 | Setting.setValue("TabViews", QBitArray(TabViews)); |
1531 | Setting.setValue("TabViews", QBitArray(TabViews)); |
1516 | Setting.endGroup(); |
1532 | Setting.endGroup(); |
1517 | } |
1533 | } |
1518 | 1534 | ||
1519 | 1535 | ||
1520 | // Debug-Daten anzeigen und Aufzeichnen |
1536 | // Debug-Daten anzeigen und Aufzeichnen |
1521 | /////////////////////////////////////// |
1537 | /////////////////////////////////////// |
1522 | void MKTool::write_CSV() |
1538 | void MKTool::write_CSV() |
1523 | { |
1539 | { |
1524 | QTextStream Out(CSVFile); |
1540 | QTextStream Out(CSVFile); |
1525 | for (int a=0; a<MaxAnalog; a++) |
1541 | for (int a=0; a<MaxAnalog; a++) |
1526 | { |
1542 | { |
1527 | if (Settings->Analog[a].Log) |
1543 | if (Settings->Analog1.LogView[a]) |
1528 | { |
1544 | { |
1529 | Out << AnalogData[a]; |
1545 | Out << AnalogData[a]; |
1530 | if (a < MaxAnalog - 1) |
1546 | if (a < MaxAnalog - 1) |
1531 | Out << ';'; |
1547 | Out << ';'; |
1532 | } |
1548 | } |
1533 | } |
1549 | } |
1534 | Out << "\n"; |
1550 | Out << "\n"; |
1535 | } |
1551 | } |
1536 | 1552 | ||
1537 | void MKTool::slot_RecordCSV() // DONE 0.71g |
1553 | void MKTool::slot_RecordCSV() // DONE 0.71g |
1538 | { |
1554 | { |
1539 | if (!CSVFile->isOpen()) |
1555 | if (!CSVFile->isOpen()) |
1540 | { |
1556 | { |
1541 | QString Filename = Settings->DIR.Logging + Mode.Hardware + " - " + QDate::currentDate().toString(("yyyy-MM-dd")) + " -- " + QTime::currentTime().toString("hh-mm") + ".csv"; |
1557 | QString Filename = Settings->DIR.Logging + Mode.Hardware + " - " + QDate::currentDate().toString(("yyyy-MM-dd")) + " -- " + QTime::currentTime().toString("hh-mm") + ".csv"; |
1542 | 1558 | ||
1543 | CSVFile = new QFile(Filename); |
1559 | CSVFile = new QFile(Filename); |
1544 | if (!CSVFile->exists()) |
1560 | if (!CSVFile->exists()) |
1545 | { |
1561 | { |
1546 | CSVFile->open(QIODevice::Append | QIODevice::Text); |
1562 | CSVFile->open(QIODevice::Append | QIODevice::Text); |
1547 | 1563 | ||
1548 | QTextStream Out(CSVFile); |
1564 | QTextStream Out(CSVFile); |
1549 | 1565 | ||
1550 | for (int a = 0; a < MaxAnalog; a++) |
1566 | for (int a = 0; a < MaxAnalog; a++) |
1551 | { |
1567 | { |
1552 | if (Settings->Analog[a].Log) |
1568 | if (Settings->Analog1.LogView[a]) |
1553 | { |
1569 | { |
1554 | Out << Settings->Analog[a].Name; |
1570 | Out << Settings->Analog1.Label[a]; |
1555 | 1571 | ||
1556 | if (a < MaxAnalog - 1) |
1572 | if (a < MaxAnalog - 1) |
1557 | Out << ';'; |
1573 | Out << ';'; |
1558 | } |
1574 | } |
1559 | } |
1575 | } |
1560 | Out << "\n"; |
1576 | Out << "\n"; |
1561 | } |
1577 | } |
1562 | else |
1578 | else |
1563 | { |
1579 | { |
1564 | CSVFile->open(QIODevice::Append | QIODevice::Text); |
1580 | CSVFile->open(QIODevice::Append | QIODevice::Text); |
1565 | } |
1581 | } |
1566 | - | ||
1567 | // QIcon icon; |
- | |
1568 | // icon.addPixmap(QPixmap(QString::fromUtf8(":/Actions/Images/media-playback-stop.png")), QIcon::Normal, QIcon::Off); |
1582 | |
1569 | pb_Record->setIcon(Icons[6]); |
1583 | pb_Record->setIcon(Icons[6]); |
1570 | pb_Record->setText("CSV Stop"); |
1584 | pb_Record->setText("CSV Stop"); |
1571 | ac_RecordCSV->setIcon(Icons[6]); |
1585 | ac_RecordCSV->setIcon(Icons[6]); |
1572 | ac_RecordCSV->setText("CSV Stop"); |
1586 | ac_RecordCSV->setText("CSV Stop"); |
1573 | } |
1587 | } |
1574 | else |
1588 | else |
1575 | { |
1589 | { |
1576 | CSVFile->close(); |
1590 | CSVFile->close(); |
1577 | // QIcon icon; |
- | |
1578 | // icon.addPixmap(QPixmap(QString::fromUtf8(":/Actions/Images/media-record.png")), QIcon::Normal, QIcon::Off); |
- | |
1579 | pb_Record->setIcon(Icons[7]); |
1591 | pb_Record->setIcon(Icons[7]); |
1580 | pb_Record->setText("CSV Aufzeichnen"); |
1592 | pb_Record->setText("CSV Aufzeichnen"); |
1581 | ac_RecordCSV->setIcon(Icons[7]); |
1593 | ac_RecordCSV->setIcon(Icons[7]); |
1582 | ac_RecordCSV->setText("CSV Aufzeichnen"); |
1594 | ac_RecordCSV->setText("CSV Aufzeichnen"); |
1583 | } |
1595 | } |
1584 | } |
1596 | } |
1585 | 1597 | ||
1586 | void MKTool::show_DebugData() |
1598 | void MKTool::show_DebugData() |
1587 | { |
1599 | { |
1588 | if (CSVFile->isOpen()) |
1600 | if (CSVFile->isOpen()) |
1589 | { |
1601 | { |
1590 | write_CSV(); |
1602 | write_CSV(); |
1591 | } |
1603 | } |
1592 | 1604 | ||
1593 | if (ac_StartPlotter->isChecked()) |
1605 | if (ac_StartPlotter->isChecked()) |
1594 | { |
1606 | { |
1595 | aID[NextPlot] = NextPlot; |
1607 | aID[NextPlot] = NextPlot; |
1596 | 1608 | ||
1597 | for (int a = 0; a < MaxAnalog; a++) |
1609 | for (int a = 0; a < MaxAnalog; a++) |
1598 | { |
1610 | { |
1599 | aData[a][NextPlot] = AnalogData[a]; |
1611 | aData[a][NextPlot] = AnalogData[a]; |
1600 | } |
1612 | } |
1601 | NextPlot++; |
1613 | NextPlot++; |
1602 | 1614 | ||
1603 | if ((tab_Main->currentWidget()->objectName() == QString("Tab_1"))) |
1615 | if ((tab_Main->currentWidget()->objectName() == QString("Tab_1"))) |
1604 | update_Plot(); |
1616 | update_Plot(); |
1605 | } |
1617 | } |
1606 | 1618 | ||
1607 | le_A_0->setText(QString("%1").arg(AnalogData[0])); |
1619 | le_A_0->setText(QString("%1").arg(AnalogData[0])); |
1608 | le_A_1->setText(QString("%1").arg(AnalogData[1])); |
1620 | le_A_1->setText(QString("%1").arg(AnalogData[1])); |
1609 | le_A_2->setText(QString("%1").arg(AnalogData[2])); |
1621 | le_A_2->setText(QString("%1").arg(AnalogData[2])); |
1610 | le_A_3->setText(QString("%1").arg(AnalogData[3])); |
1622 | le_A_3->setText(QString("%1").arg(AnalogData[3])); |
1611 | le_A_4->setText(QString("%1").arg(AnalogData[4])); |
1623 | le_A_4->setText(QString("%1").arg(AnalogData[4])); |
1612 | le_A_5->setText(QString("%1").arg(AnalogData[5])); |
1624 | le_A_5->setText(QString("%1").arg(AnalogData[5])); |
1613 | le_A_6->setText(QString("%1").arg(AnalogData[6])); |
1625 | le_A_6->setText(QString("%1").arg(AnalogData[6])); |
1614 | le_A_7->setText(QString("%1").arg(AnalogData[7])); |
1626 | le_A_7->setText(QString("%1").arg(AnalogData[7])); |
1615 | le_A_8->setText(QString("%1").arg(AnalogData[8])); |
1627 | le_A_8->setText(QString("%1").arg(AnalogData[8])); |
1616 | le_A_9->setText(QString("%1").arg(AnalogData[9])); |
1628 | le_A_9->setText(QString("%1").arg(AnalogData[9])); |
1617 | le_A_10->setText(QString("%1").arg(AnalogData[10])); |
1629 | le_A_10->setText(QString("%1").arg(AnalogData[10])); |
1618 | le_A_11->setText(QString("%1").arg(AnalogData[11])); |
1630 | le_A_11->setText(QString("%1").arg(AnalogData[11])); |
1619 | le_A_12->setText(QString("%1").arg(AnalogData[12])); |
1631 | le_A_12->setText(QString("%1").arg(AnalogData[12])); |
1620 | le_A_13->setText(QString("%1").arg(AnalogData[13])); |
1632 | le_A_13->setText(QString("%1").arg(AnalogData[13])); |
1621 | le_A_14->setText(QString("%1").arg(AnalogData[14])); |
1633 | le_A_14->setText(QString("%1").arg(AnalogData[14])); |
1622 | le_A_15->setText(QString("%1").arg(AnalogData[15])); |
1634 | le_A_15->setText(QString("%1").arg(AnalogData[15])); |
1623 | le_A_16->setText(QString("%1").arg(AnalogData[16])); |
1635 | le_A_16->setText(QString("%1").arg(AnalogData[16])); |
1624 | le_A_17->setText(QString("%1").arg(AnalogData[17])); |
1636 | le_A_17->setText(QString("%1").arg(AnalogData[17])); |
1625 | le_A_18->setText(QString("%1").arg(AnalogData[18])); |
1637 | le_A_18->setText(QString("%1").arg(AnalogData[18])); |
1626 | le_A_19->setText(QString("%1").arg(AnalogData[19])); |
1638 | le_A_19->setText(QString("%1").arg(AnalogData[19])); |
1627 | le_A_20->setText(QString("%1").arg(AnalogData[20])); |
1639 | le_A_20->setText(QString("%1").arg(AnalogData[20])); |
1628 | le_A_21->setText(QString("%1").arg(AnalogData[21])); |
1640 | le_A_21->setText(QString("%1").arg(AnalogData[21])); |
1629 | le_A_22->setText(QString("%1").arg(AnalogData[22])); |
1641 | le_A_22->setText(QString("%1").arg(AnalogData[22])); |
1630 | le_A_23->setText(QString("%1").arg(AnalogData[23])); |
1642 | le_A_23->setText(QString("%1").arg(AnalogData[23])); |
1631 | le_A_24->setText(QString("%1").arg(AnalogData[24])); |
1643 | le_A_24->setText(QString("%1").arg(AnalogData[24])); |
1632 | le_A_25->setText(QString("%1").arg(AnalogData[25])); |
1644 | le_A_25->setText(QString("%1").arg(AnalogData[25])); |
1633 | le_A_26->setText(QString("%1").arg(AnalogData[26])); |
1645 | le_A_26->setText(QString("%1").arg(AnalogData[26])); |
1634 | le_A_27->setText(QString("%1").arg(AnalogData[27])); |
1646 | le_A_27->setText(QString("%1").arg(AnalogData[27])); |
1635 | le_A_28->setText(QString("%1").arg(AnalogData[28])); |
1647 | le_A_28->setText(QString("%1").arg(AnalogData[28])); |
1636 | le_A_29->setText(QString("%1").arg(AnalogData[29])); |
1648 | le_A_29->setText(QString("%1").arg(AnalogData[29])); |
1637 | le_A_30->setText(QString("%1").arg(AnalogData[30])); |
1649 | le_A_30->setText(QString("%1").arg(AnalogData[30])); |
1638 | le_A_31->setText(QString("%1").arg(AnalogData[31])); |
1650 | le_A_31->setText(QString("%1").arg(AnalogData[31])); |
1639 | } |
1651 | } |
1640 | 1652 | ||
1641 | 1653 | ||
1642 | // Seriel-Port Bereich, Befehle senden und Daten empfangen |
1654 | // Seriel-Port Bereich, Befehle senden und Daten empfangen |
1643 | ////////////////////////////////////////////////////////// |
1655 | ////////////////////////////////////////////////////////// |
1644 | 1656 | ||
1645 | // Neues Datenpacket empfangen -> Verarbeiten |
1657 | // Neues Datenpacket empfangen -> Verarbeiten |
1646 | void MKTool::new_RXData(sRxData RX) // DONE 0.71g |
1658 | void MKTool::new_RXData(sRxData RX) // DONE 0.71g |
1647 | { |
1659 | { |
1648 | 1660 | ||
1649 | if (LastSend.length() > 2) |
1661 | if (LastSend.length() > 2) |
1650 | { |
1662 | { |
1651 | } |
1663 | } |
- | 1664 | ||
- | 1665 | int HardwareID = RX.Input[1] - 'a'; |
|
1652 | 1666 | ||
1653 | switch(RX.Input[2]) |
1667 | switch(RX.Input[2]) |
1654 | { |
1668 | { |
1655 | case 'L' : // DONE 0.71g |
1669 | case 'L' : // DONE 0.71g |
1656 | if (ToolBox::Decode64(RX, true)) |
1670 | if (ToolBox::Decode64(RX, true)) |
1657 | { |
1671 | { |
1658 | int LCD[150]; |
1672 | int LCD[150]; |
1659 | memcpy(LCD,RX.Decode, sizeof(RX.Decode)); |
1673 | memcpy(LCD,RX.Decode, sizeof(RX.Decode)); |
1660 | 1674 | ||
1661 | LCD_Page = RX.Decode[0]; |
1675 | LCD_Page = RX.Decode[0]; |
1662 | LCD_MAX_Page = RX.Decode[1]; |
1676 | LCD_MAX_Page = RX.Decode[1]; |
1663 | 1677 | ||
1664 | le_LCD0->setText(ToolBox::Data2QString(LCD,2,22)); |
1678 | le_LCD0->setText(ToolBox::Data2QString(LCD,2,22)); |
1665 | le_LCD1->setText(ToolBox::Data2QString(LCD,22,42)); |
1679 | le_LCD1->setText(ToolBox::Data2QString(LCD,22,42)); |
1666 | le_LCD2->setText(ToolBox::Data2QString(LCD,42,62)); |
1680 | le_LCD2->setText(ToolBox::Data2QString(LCD,42,62)); |
1667 | le_LCD3->setText(ToolBox::Data2QString(LCD,62,82)); |
1681 | le_LCD3->setText(ToolBox::Data2QString(LCD,62,82)); |
1668 | 1682 | ||
1669 | TickerEvent[0] = false; |
1683 | TickerEvent[0] = false; |
1670 | } |
1684 | } |
1671 | break; |
1685 | break; |
1672 | case 'P' : // DONE 0.71g |
1686 | case 'P' : // DONE 0.71g |
1673 | if (ToolBox::Decode64(RX, true)) |
1687 | if (ToolBox::Decode64(RX, true)) |
1674 | { |
1688 | { |
1675 | pb_K1->setValue(ToolBox::Data2Int(RX.Decode, 0,true)); |
1689 | pb_K1->setValue(ToolBox::Data2Int(RX.Decode, 0,true)); |
1676 | pb_K2->setValue(ToolBox::Data2Int(RX.Decode, 2,true)); |
1690 | pb_K2->setValue(ToolBox::Data2Int(RX.Decode, 2,true)); |
1677 | pb_K3->setValue(ToolBox::Data2Int(RX.Decode, 4,true)); |
1691 | pb_K3->setValue(ToolBox::Data2Int(RX.Decode, 4,true)); |
1678 | pb_K4->setValue(ToolBox::Data2Int(RX.Decode, 6,true)); |
1692 | pb_K4->setValue(ToolBox::Data2Int(RX.Decode, 6,true)); |
1679 | pb_K5->setValue(ToolBox::Data2Int(RX.Decode, 8,true)); |
1693 | pb_K5->setValue(ToolBox::Data2Int(RX.Decode, 8,true)); |
1680 | pb_K6->setValue(ToolBox::Data2Int(RX.Decode, 10,true)); |
1694 | pb_K6->setValue(ToolBox::Data2Int(RX.Decode, 10,true)); |
1681 | pb_K7->setValue(ToolBox::Data2Int(RX.Decode, 12,true)); |
1695 | pb_K7->setValue(ToolBox::Data2Int(RX.Decode, 12,true)); |
1682 | pb_K8->setValue(ToolBox::Data2Int(RX.Decode, 14,true)); |
1696 | pb_K8->setValue(ToolBox::Data2Int(RX.Decode, 14,true)); |
1683 | } |
1697 | } |
1684 | break; |
1698 | break; |
1685 | case 'A' : // DONE 0.71g |
1699 | case 'A' : // DONE 0.71g |
1686 | if (ToolBox::Decode64(RX, true)) |
1700 | if (ToolBox::Decode64(RX, true)) |
1687 | { |
1701 | { |
1688 | int Position = RX.Decode[0]; |
1702 | int Position = RX.Decode[0]; |
1689 | if (Position < 32) |
1703 | if (Position < 32) |
1690 | { |
1704 | { |
1691 | Settings->Analog[Position].Name = ToolBox::Data2QString(RX.Decode,1,17).trimmed(); |
1705 | Settings->Analog1.Label[Position] = ToolBox::Data2QString(RX.Decode,1,17).trimmed(); |
1692 | Position ++; |
1706 | Position ++; |
1693 | TX_Data[0] = Position; |
1707 | TX_Data[0] = Position; |
1694 | send_Data('a', ADDRESS_ALL, TX_Data, 1, false); |
1708 | send_Data('a', ADDRESS_ALL, TX_Data, 1, false); |
1695 | } |
1709 | } |
1696 | if (Position == 32) |
1710 | if (Position == 32) |
1697 | { |
1711 | { |
1698 | for (int a = 0; a < MaxAnalog; a++) |
1712 | for (int a = 0; a < MaxAnalog; a++) |
1699 | { |
1713 | { |
1700 | lb_Analog[a]->setText(Settings->Analog[a].Name); |
1714 | lb_Analog[a]->setText(Settings->Analog1.Label[a]); |
1701 | } |
1715 | } |
1702 | Settings->write_Settings_FC(); |
1716 | Settings->write_Settings_AnalogLabels(HardwareID); |
1703 | config_Plot(); |
1717 | config_Plot(); |
1704 | } |
1718 | } |
1705 | } |
1719 | } |
1706 | break; |
1720 | break; |
1707 | case 'D' : // DONE 0.71g |
1721 | case 'D' : // DONE 0.71g |
1708 | if (ToolBox::Decode64(RX, true)) |
1722 | if (ToolBox::Decode64(RX, true)) |
1709 | { |
1723 | { |
1710 | for (int i = 0; i < MaxAnalog; i++) |
1724 | for (int i = 0; i < MaxAnalog; i++) |
1711 | { |
1725 | { |
1712 | AnalogData[i] = ToolBox::Data2Int(RX.Decode, (i * 2) + 2); |
1726 | AnalogData[i] = ToolBox::Data2Int(RX.Decode, (i * 2) + 2); |
1713 | } |
1727 | } |
1714 | show_DebugData(); |
1728 | show_DebugData(); |
1715 | } |
1729 | } |
1716 | break; |
1730 | break; |
1717 | case 'Q' : // DONE 0.71g |
1731 | case 'Q' : // DONE 0.71g |
1718 | TickerEvent[0] = false; |
1732 | TickerEvent[0] = false; |
1719 | 1733 | ||
1720 | ToolBox::Decode64(RX, true); |
1734 | ToolBox::Decode64(RX, true); |
1721 | 1735 | ||
1722 | if (RX.Decode[1] == VERSION_SETTINGS) |
1736 | if (RX.Decode[1] == VERSION_SETTINGS) |
1723 | { |
1737 | { |
1724 | int Settings_ID = RX.Decode[0]; |
1738 | int Settings_ID = RX.Decode[0]; |
1725 | for (int a = 0; a < MaxParameter; a++) |
1739 | for (int a = 0; a < MaxParameter; a++) |
1726 | { |
1740 | { |
1727 | ParameterSet[Settings_ID][a] = RX.Decode[a + 2]; |
1741 | ParameterSet[Settings_ID][a] = RX.Decode[a + 2]; |
1728 | } |
1742 | } |
1729 | // memcpy(ParameterSet[Settings_ID],RX.Decode, sizeof(RX.Decode)); |
1743 | // memcpy(ParameterSet[Settings_ID],RX.Decode, sizeof(RX.Decode)); |
1730 | show_ParameterSet(Settings_ID); |
1744 | show_ParameterSet(Settings_ID); |
1731 | } |
1745 | } |
1732 | else |
1746 | else |
1733 | { |
1747 | { |
1734 | pb_Read->setDisabled(true); |
1748 | pb_Read->setDisabled(true); |
1735 | pb_Write->setDisabled(true); |
1749 | pb_Write->setDisabled(true); |
1736 | 1750 | ||
1737 | QMessageBox::warning(this, QA_NAME, |
1751 | QMessageBox::warning(this, QA_NAME, |
1738 | "Versionen inkompatibel. \nParameterbearbeitung nicht moeglich.", QMessageBox::Ok); |
1752 | "Versionen inkompatibel. \nParameterbearbeitung nicht moeglich.", QMessageBox::Ok); |
1739 | } |
1753 | } |
1740 | 1754 | ||
1741 | break; |
1755 | break; |
1742 | case 'S' : // DONE 0.71g |
1756 | case 'S' : // DONE 0.71g |
1743 | TickerEvent[0] = false; |
1757 | TickerEvent[0] = false; |
1744 | qDebug("Settings set...!!!"); |
1758 | qDebug("Settings set...!!!"); |
1745 | break; |
1759 | break; |
1746 | case 'V' : // DONE 0.71g |
1760 | case 'V' : // DONE 0.71g |
1747 | TickerEvent[0] = false; |
1761 | TickerEvent[0] = false; |
1748 | 1762 | ||
1749 | ToolBox::Decode64(RX, true); |
1763 | ToolBox::Decode64(RX, true); |
1750 | 1764 | ||
1751 | Mode.ID = RX.Input[1] - 'a'; |
1765 | Mode.ID = RX.Input[1] - 'a'; |
1752 | Mode.VERSION_MAJOR = RX.Decode[0]; |
1766 | Mode.VERSION_MAJOR = RX.Decode[0]; |
1753 | Mode.VERSION_MINOR = RX.Decode[1]; |
1767 | Mode.VERSION_MINOR = RX.Decode[1]; |
1754 | Mode.VERSION_PATCH = RX.Decode[4]; |
1768 | Mode.VERSION_PATCH = RX.Decode[4]; |
1755 | Mode.VERSION_SERIAL_MAJOR = RX.Decode[2]; |
1769 | Mode.VERSION_SERIAL_MAJOR = RX.Decode[2]; |
1756 | Mode.VERSION_SERIAL_MINOR = RX.Decode[3]; |
1770 | Mode.VERSION_SERIAL_MINOR = RX.Decode[3]; |
1757 | 1771 | ||
1758 | Mode.Hardware = HardwareType[Mode.ID]; |
1772 | Mode.Hardware = HardwareType[Mode.ID]; |
1759 | Mode.Version = QString("%1").arg(RX.Decode[0]) + "." + QString("%1").arg(RX.Decode[1]) + QString(RX.Decode[4] + 'a'); |
1773 | Mode.Version = QString("%1").arg(RX.Decode[0]) + "." + QString("%1").arg(RX.Decode[1]) + QString(RX.Decode[4] + 'a'); |
1760 | 1774 | ||
1761 | setWindowTitle(QA_NAME + " v" + QA_VERSION + " - " + Mode.Hardware + " " + Mode.Version); |
1775 | setWindowTitle(QA_NAME + " v" + QA_VERSION + " - " + Mode.Hardware + " " + Mode.Version); |
1762 | 1776 | ||
1763 | if (Mode.VERSION_SERIAL_MAJOR != VERSION_SERIAL_MAJOR) |
1777 | if (Mode.VERSION_SERIAL_MAJOR != VERSION_SERIAL_MAJOR) |
1764 | { |
1778 | { |
1765 | AllowSend = false; |
1779 | AllowSend = false; |
1766 | QMessageBox::warning(this, QA_NAME, |
1780 | QMessageBox::warning(this, QA_NAME, |
1767 | "Serielles Protokoll Inkompatibel. \nBitte neue Programmversion installieren,", QMessageBox::Ok); |
1781 | "Serielles Protokoll Inkompatibel. \nBitte neue Programmversion installieren,", QMessageBox::Ok); |
1768 | } |
1782 | } |
1769 | 1783 | ||
1770 | TX_Data[0] = 50; |
1784 | TX_Data[0] = 50; |
1771 | send_Data('d', ADDRESS_ALL, TX_Data, 1, false); |
1785 | send_Data('d', ADDRESS_ALL, TX_Data, 1, false); |
1772 | 1786 | ||
1773 | if (Mode.ID == ADDRESS_FC) |
1787 | if (Mode.ID == ADDRESS_FC) |
1774 | { |
1788 | { |
1775 | { |
1789 | { |
1776 | TX_Data[0] = 0xff; |
1790 | TX_Data[0] = 0xff; |
1777 | TX_Data[1] = 0; |
1791 | TX_Data[1] = 0; |
1778 | send_Data('q', ADDRESS_FC, TX_Data, 1); |
1792 | send_Data('q', ADDRESS_FC, TX_Data, 1); |
1779 | } |
1793 | } |
1780 | } |
1794 | } |
1781 | else |
1795 | else |
1782 | { |
1796 | { |
1783 | pb_Read->setDisabled(true); |
1797 | pb_Read->setDisabled(true); |
1784 | pb_Write->setDisabled(true); |
1798 | pb_Write->setDisabled(true); |
1785 | 1799 | ||
1786 | // QMessageBox::warning(this, QA_NAME, |
1800 | // QMessageBox::warning(this, QA_NAME, |
1787 | // "Keine Verbindung zur FlightCtrl. \nParameterbearbeitung nicht moeglich.", QMessageBox::Ok); |
1801 | // "Keine Verbindung zur FlightCtrl. \nParameterbearbeitung nicht moeglich.", QMessageBox::Ok); |
1788 | } |
1802 | } |
- | 1803 | ||
- | 1804 | Settings->read_Settings_AnalogLabels(HardwareID); |
|
- | 1805 | Settings->read_Settings_Analog(HardwareID); |
|
- | 1806 | for (int a = 0; a < MaxAnalog; a++) |
|
- | 1807 | { |
|
- | 1808 | lb_Analog[a]->setText(Settings->Analog1.Label[a]); |
|
- | 1809 | } |
|
- | 1810 | config_Plot(); |
|
- | 1811 | ||
1789 | break; |
1812 | break; |
1790 | } |
1813 | } |
1791 | } |
1814 | } |
1792 | 1815 | ||
1793 | // Neue Daten an der Schnittstelle |
1816 | // Neue Daten an der Schnittstelle |
1794 | void MKTool::slot_newDataReceived(const QByteArray &dataReceived) // DONE 0.71g |
1817 | void MKTool::slot_newDataReceived(const QByteArray &dataReceived) // DONE 0.71g |
1795 | { |
1818 | { |
1796 | const char *RXt; |
1819 | const char *RXt; |
1797 | RXt = dataReceived.data(); |
1820 | RXt = dataReceived.data(); |
1798 | int a = 0; |
1821 | int a = 0; |
1799 | 1822 | ||
1800 | while (RXt[a] != '\0') |
1823 | while (RXt[a] != '\0') |
1801 | { |
1824 | { |
1802 | if (RXt[a] == '\r') |
1825 | if (RXt[a] == '\r') |
1803 | { |
1826 | { |
1804 | while ((RxData.String.length() > 1) && (RxData.String.at(1) == '#')) |
1827 | while ((RxData.String.length() > 1) && (RxData.String.at(1) == '#')) |
1805 | { |
1828 | { |
1806 | RxData.String.remove(0,1); |
1829 | RxData.String.remove(0,1); |
1807 | } |
1830 | } |
1808 | 1831 | ||
1809 | if (ToolBox::check_CRC(RxData.String)) |
1832 | if (ToolBox::check_CRC(RxData.String)) |
1810 | { |
1833 | { |
1811 | RxData.Input = RxData.String.toLatin1().data(); |
1834 | RxData.Input = RxData.String.toLatin1().data(); |
1812 | new_RXData(RxData); |
1835 | new_RXData(RxData); |
1813 | 1836 | ||
1814 | if ((cb_ShowData->isChecked()) && (tab_Main->currentWidget()->objectName() == QString("Tab_3"))) |
1837 | if ((cb_ShowData->isChecked()) && ((tab_Main->currentWidget()->objectName() == QString("Tab_3")) || (cb_ShowAlways->isChecked()))) |
1815 | { |
1838 | { |
1816 | te_RX->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor); |
1839 | te_RX->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor); |
1817 | te_RX->insertPlainText(RxData.String + '\r'); |
1840 | te_RX->insertPlainText(RxData.String + '\r'); |
1818 | } |
1841 | } |
1819 | } |
1842 | } |
1820 | else |
1843 | else |
1821 | { |
1844 | { |
1822 | if ((cb_ShowMSG->isChecked()) && (tab_Main->currentWidget()->objectName() == QString("Tab_3"))) |
1845 | if ((cb_ShowMSG->isChecked()) && ((tab_Main->currentWidget()->objectName() == QString("Tab_3")) || (cb_ShowAlways->isChecked()))) |
1823 | { |
1846 | { |
1824 | te_RX->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor); |
1847 | te_RX->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor); |
1825 | te_RX->insertPlainText(RxData.String + '\r'); |
1848 | te_RX->insertPlainText(RxData.String + '\r'); |
1826 | } |
1849 | } |
1827 | } |
1850 | } |
1828 | RxData.String = QString(""); |
1851 | RxData.String = QString(""); |
1829 | } |
1852 | } |
1830 | else |
1853 | else |
1831 | { |
1854 | { |
1832 | { |
1855 | { |
1833 | RxData.String = RxData.String + QString(RXt[a]); |
1856 | RxData.String = RxData.String + QString(RXt[a]); |
1834 | } |
1857 | } |
1835 | } |
1858 | } |
1836 | a++; |
1859 | a++; |
1837 | } |
1860 | } |
1838 | } |
1861 | } |
1839 | 1862 | ||
1840 | // Seriellen Port öffnen |
1863 | // Seriellen Port öffnen |
1841 | void MKTool::slot_OpenPort() |
1864 | void MKTool::slot_OpenPort() |
1842 | { |
1865 | { |
1843 | if (serialPort->isOpen()) |
1866 | if (serialPort->isOpen()) |
1844 | { |
1867 | { |
1845 | TX_Data[0] = 0; |
1868 | TX_Data[0] = 0; |
1846 | TX_Data[1] = 0; |
1869 | TX_Data[1] = 0; |
1847 | TX_Data[2] = 0; |
1870 | TX_Data[2] = 0; |
1848 | TX_Data[3] = 0; |
1871 | TX_Data[3] = 0; |
1849 | send_Data('t', ADDRESS_FC, TX_Data, 4, false); |
1872 | send_Data('t', ADDRESS_FC, TX_Data, 4, false); |
1850 | 1873 | ||
1851 | serialPort->close(); |
1874 | serialPort->close(); |
1852 | pb_Open->setText("Verbinden"); |
1875 | pb_Open->setText("Verbinden"); |
1853 | ac_ConnectTTY->setText("Verbinden"); |
1876 | ac_ConnectTTY->setText("Verbinden"); |
1854 | pb_Open->setIcon(Icons[9]); |
1877 | pb_Open->setIcon(Icons[9]); |
1855 | ac_ConnectTTY->setIcon(Icons[9]); |
1878 | ac_ConnectTTY->setIcon(Icons[9]); |
1856 | } |
1879 | } |
1857 | else |
1880 | else |
1858 | { |
1881 | { |
1859 | serialPort->setPort(le_Port->text()); //Port |
1882 | serialPort->setPort(le_Port->text()); //Port |
1860 | 1883 | ||
1861 | serialPort->setBaudRate(BAUD57600); //BaudRate |
1884 | serialPort->setBaudRate(BAUD57600); //BaudRate |
1862 | serialPort->setDataBits(DATA_8); //DataBits |
1885 | serialPort->setDataBits(DATA_8); //DataBits |
1863 | serialPort->setParity(PAR_NONE); //Parity |
1886 | serialPort->setParity(PAR_NONE); //Parity |
1864 | serialPort->setStopBits(STOP_1); //StopBits |
1887 | serialPort->setStopBits(STOP_1); //StopBits |
1865 | serialPort->setFlowControl(FLOW_OFF); //FlowControl |
1888 | serialPort->setFlowControl(FLOW_OFF); //FlowControl |
1866 | 1889 | ||
1867 | serialPort->setTimeout(0, 10); |
1890 | serialPort->setTimeout(0, 10); |
1868 | serialPort->enableSending(); |
1891 | serialPort->enableSending(); |
1869 | serialPort->enableReceiving(); |
1892 | serialPort->enableReceiving(); |
1870 | 1893 | ||
1871 | serialPort->open(); |
1894 | serialPort->open(); |
1872 | if (serialPort->isOpen()) |
1895 | if (serialPort->isOpen()) |
1873 | { |
1896 | { |
1874 | serialPort->receiveData(); |
1897 | serialPort->receiveData(); |
1875 | 1898 | ||
1876 | send_Data('v', ADDRESS_ALL, TX_Data, 0, true); |
1899 | send_Data('v', ADDRESS_ALL, TX_Data, 0, true); |
1877 | 1900 | ||
1878 | pb_Open->setText("Trennen"); |
1901 | pb_Open->setText("Trennen"); |
1879 | ac_ConnectTTY->setText("Trennen"); |
1902 | ac_ConnectTTY->setText("Trennen"); |
1880 | pb_Open->setIcon(Icons[8]); |
1903 | pb_Open->setIcon(Icons[8]); |
1881 | ac_ConnectTTY->setIcon(Icons[8]); |
1904 | ac_ConnectTTY->setIcon(Icons[8]); |
1882 | } |
1905 | } |
1883 | } |
1906 | } |
1884 | } |
1907 | } |
1885 | 1908 | ||
1886 | // Daten senden |
1909 | // Daten senden |
1887 | void MKTool::send_Data(char CMD, int Address, char Data[150],unsigned int Length, bool Resend) // DONE 0.71g |
1910 | void MKTool::send_Data(char CMD, int Address, char Data[150],unsigned int Length, bool Resend) // DONE 0.71g |
1888 | { |
1911 | { |
1889 | if (serialPort->isOpen() && AllowSend) |
1912 | if (serialPort->isOpen() && AllowSend) |
1890 | { |
1913 | { |
1891 | QString TX_Data = ToolBox::Encode64(Data, Length); |
1914 | QString TX_Data = ToolBox::Encode64(Data, Length); |
1892 | 1915 | ||
1893 | TX_Data = QString("#") + (QString('a' + Address)) + QString(CMD) + TX_Data; |
1916 | TX_Data = QString("#") + (QString('a' + Address)) + QString(CMD) + TX_Data; |
1894 | 1917 | ||
1895 | // qDebug(TX_Data.toLatin1().data()); |
1918 | // qDebug(TX_Data.toLatin1().data()); |
1896 | 1919 | ||
1897 | TX_Data = ToolBox::add_CRC(TX_Data) + '\r'; |
1920 | TX_Data = ToolBox::add_CRC(TX_Data) + '\r'; |
1898 | 1921 | ||
1899 | // qDebug(TX_Data.toLatin1().data()); |
1922 | // qDebug(TX_Data.toLatin1().data()); |
1900 | 1923 | ||
1901 | if (Resend) |
1924 | if (Resend) |
1902 | { |
1925 | { |
1903 | LastSend = TX_Data; |
1926 | LastSend = TX_Data; |
1904 | TickerEvent[0] = true; |
1927 | TickerEvent[0] = true; |
1905 | } |
1928 | } |
1906 | 1929 | ||
1907 | QByteArray Temp(TX_Data.toUtf8()); |
1930 | QByteArray Temp(TX_Data.toUtf8()); |
1908 | serialPort->sendData(Temp); |
1931 | serialPort->sendData(Temp); |
1909 | } |
1932 | } |
1910 | } |
1933 | } |
1911 | 1934 | ||
1912 | 1935 | ||
1913 | // Programm beenden |
1936 | // Programm beenden |
1914 | /////////////////// |
1937 | /////////////////// |
- | 1938 | ||
1915 | void MKTool::slot_Quit() |
1939 | MKTool::~MKTool() |
1916 | { |
1940 | { |
- | 1941 | qDebug(" Programm Ende ..!! "); |
|
1917 | if (serialPort->isOpen()) |
1942 | if (serialPort->isOpen()) |
1918 | { |
1943 | { |
1919 | serialPort->close(); |
1944 | serialPort->close(); |
1920 | } |
1945 | } |
1921 | 1946 | ||
1922 | write_Settings(); |
1947 | write_Settings(); |
- | 1948 | Settings->write_Settings(); |
|
1923 | 1949 | ||
1924 | if (CSVFile->isOpen()) |
1950 | if (CSVFile->isOpen()) |
1925 | { |
1951 | { |
1926 | CSVFile->close(); |
1952 | CSVFile->close(); |
1927 | } |
1953 | } |
1928 | 1954 | ||
1929 | close(); |
- | |
1930 | } |
- | |
1931 | - | ||
1932 | MKTool::~MKTool() |
- | |
1933 | { |
- | |
1934 | write_Settings(); |
- | |
1935 | qDebug("Ende"); |
1955 | // close(); |
1936 | } |
1956 | } |
1937 | 1957 | ||
1938 | 1958 |