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