Rev 722 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
674 | KeyOz | 1 | /*************************************************************************** |
2 | * Copyright (C) 2009 by Manuel Schrape * |
||
3 | * manuel.schrape@gmx.de * |
||
4 | * * |
||
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 * |
||
7 | * the Free Software Foundation; either version 2 of the License. * |
||
8 | * * |
||
9 | * This program is distributed in the hope that it will be useful, * |
||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
||
12 | * GNU General Public License for more details. * |
||
13 | * * |
||
14 | * You should have received a copy of the GNU General Public License * |
||
15 | * along with this program; if not, write to the * |
||
16 | * Free Software Foundation, Inc., * |
||
17 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
||
18 | ***************************************************************************/ |
||
19 | |||
711 | KeyOz | 20 | #include <QCryptographicHash> |
674 | KeyOz | 21 | #include <QFileDialog> |
22 | #include <QMessageBox> |
||
23 | #include <QSettings> |
||
24 | |||
25 | #include "dlg_Main.h" |
||
26 | |||
27 | // Konstruktor Main-Form |
||
28 | dlg_Main::dlg_Main() |
||
29 | { |
||
30 | setupUi(this); |
||
31 | |||
32 | o_Settings = new cSettings(); |
||
33 | |||
750 | KeyOz | 34 | wg_Connection->set_Client(ID_SETTINGS, QA_NAME + " " + QA_VERSION, DataFields); |
674 | KeyOz | 35 | |
36 | o_Timer = new QTimer(); |
||
37 | o_Timer->setInterval(500); |
||
38 | |||
39 | f_MotorMixer = new dlg_MotorMixer(this); |
||
750 | KeyOz | 40 | f_MotorTest = new dlg_MotorTest(this); |
674 | KeyOz | 41 | |
42 | init_Directorys(); |
||
43 | init_GUI(); |
||
44 | init_Connections(); |
||
45 | } |
||
46 | |||
47 | // Grafische Oberfläche initialisieren |
||
48 | void dlg_Main::init_GUI() |
||
49 | { |
||
50 | setWindowTitle(QA_NAME + " " + QA_VERSION); |
||
51 | |||
52 | resize(o_Settings->GUI.Size); |
||
53 | move(o_Settings->GUI.Point); |
||
54 | |||
55 | if (o_Settings->GUI.isMax) |
||
56 | { |
||
57 | showMaximized(); |
||
58 | } |
||
59 | |||
750 | KeyOz | 60 | wg_Connection->set_SelectVisible(false); |
61 | wg_Connection->set_IntervalVisible(false); |
||
62 | |||
63 | ac_Toolbar->setChecked(o_Settings->GUI.Toolbar); |
||
64 | |||
65 | if (ac_Toolbar->isChecked()) |
||
674 | KeyOz | 66 | { |
750 | KeyOz | 67 | wg_Connection->set_ButtonVisible(false); |
674 | KeyOz | 68 | } |
750 | KeyOz | 69 | else |
70 | { |
||
71 | ToolBar->setVisible(false); |
||
72 | } |
||
674 | KeyOz | 73 | } |
74 | |||
75 | // Signale mit Slots verbinden |
||
76 | void dlg_Main::init_Connections() |
||
77 | { |
||
78 | connect(o_Timer, SIGNAL(timeout()), this, SLOT(slot_Timer())); |
||
79 | |||
750 | KeyOz | 80 | connect(ac_Connect, SIGNAL(triggered()), wg_Connection, SLOT(slot_btn_Connect())); |
81 | connect(ac_Toolbar, SIGNAL(triggered()), this, SLOT(slot_ac_Toolbar())); |
||
674 | KeyOz | 82 | |
83 | connect(ac_Write, SIGNAL(triggered()), this, SLOT(slot_ac_Write())); |
||
84 | connect(ac_Read, SIGNAL(triggered()), this, SLOT(slot_ac_Read())); |
||
85 | connect(ac_Save, SIGNAL(triggered()), this, SLOT(slot_ac_Save())); |
||
86 | connect(ac_Load, SIGNAL(triggered()), this, SLOT(slot_ac_Load())); |
||
87 | |||
88 | connect(ac_MotorMixer, SIGNAL(triggered()), this, SLOT(slot_ac_MotorMixer())); |
||
750 | KeyOz | 89 | connect(ac_MotorTest, SIGNAL(triggered()), this, SLOT(slot_ac_MotorTest())); |
674 | KeyOz | 90 | |
750 | KeyOz | 91 | connect(f_MotorMixer, SIGNAL(sig_SendData(QString,int)), wg_Connection, SLOT(slot_send_Data(QString,int))); |
92 | connect(f_MotorTest, SIGNAL(sig_SendData(QString,int)), wg_Connection, SLOT(slot_send_Data(QString,int))); |
||
93 | |||
674 | KeyOz | 94 | // About QMK-Settings & About-QT Dialog einfügen |
95 | connect(ac_About, SIGNAL(triggered()), this, SLOT(slot_ac_About())); |
||
96 | menu_Help->addAction(trUtf8("Über &Qt"), qApp, SLOT(aboutQt())); |
||
97 | |||
750 | KeyOz | 98 | connect(wg_Connection, SIGNAL(sig_Status(int)), this, SLOT(slot_ConnectionStatus(int))); |
99 | connect(wg_Connection, SIGNAL(sig_MK_Version(s_Hardware)), this, SLOT(slot_MK_Version(s_Hardware))); |
||
100 | connect(wg_Connection, SIGNAL(sig_MK_ReadSettings(s_MK_Settings)), this, SLOT(slot_MK_ReadSettings(s_MK_Settings))); |
||
101 | connect(wg_Connection, SIGNAL(sig_MK_WriteSettings(int)), this, SLOT(slot_MK_WriteSettings(int))); |
||
102 | connect(wg_Connection, SIGNAL(sig_MK_ReadMotorMixer(s_MK_Mixer)), this, SLOT(slot_MK_ReadMotorMixer(s_MK_Mixer))); |
||
103 | connect(wg_Connection, SIGNAL(sig_MK_WriteMotorMixer(int)), this, SLOT(slot_MK_WriteMotorMixer(int))); |
||
104 | connect(wg_Connection, SIGNAL(sig_MK_PPMData(s_MK_PPM_Data)), this, SLOT(slot_MK_PPMData(s_MK_PPM_Data))); |
||
105 | |||
674 | KeyOz | 106 | connect(listWidget, SIGNAL(currentRowChanged(int)), this, SLOT(slot_PageChange(int))); |
107 | |||
108 | // Settings - LED's J16 |
||
109 | connect(J16_0, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
110 | connect(J16_1, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
111 | connect(J16_2, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
112 | connect(J16_3, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
113 | connect(J16_4, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
114 | connect(J16_5, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
115 | connect(J16_6, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
116 | connect(J16_7, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
117 | |||
118 | // Settings - LED's J17 |
||
119 | connect(J17_0, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
120 | connect(J17_1, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
121 | connect(J17_2, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
122 | connect(J17_3, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
123 | connect(J17_4, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
124 | connect(J17_5, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
125 | connect(J17_6, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
126 | connect(J17_7, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
127 | |||
128 | // Settings - LED's J16 |
||
129 | connect(J16_A_0, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
130 | connect(J16_A_1, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
131 | connect(J16_A_2, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
132 | connect(J16_A_3, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
133 | connect(J16_A_4, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
134 | connect(J16_A_5, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
135 | connect(J16_A_6, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
136 | connect(J16_A_7, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
137 | |||
138 | // Settings - LED's J17 |
||
139 | connect(J17_A_0, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
140 | connect(J17_A_1, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
141 | connect(J17_A_2, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
142 | connect(J17_A_3, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
143 | connect(J17_A_4, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
144 | connect(J17_A_5, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
145 | connect(J17_A_6, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
146 | connect(J17_A_7, SIGNAL(clicked()), this, SLOT(slot_LEDtoValue())); |
||
147 | |||
148 | connect(sb_11_1, SIGNAL(valueChanged(int)), this, SLOT(slot_ValuetoLED16(int))); |
||
149 | connect(sb_11_3, SIGNAL(valueChanged(int)), this, SLOT(slot_ValuetoLED17(int))); |
||
150 | connect(sb_11_5, SIGNAL(valueChanged(int)), this, SLOT(slot_ValuetoLED16A(int))); |
||
151 | connect(sb_11_6, SIGNAL(valueChanged(int)), this, SLOT(slot_ValuetoLED17A(int))); |
||
152 | |||
153 | connect(tb_9_6, SIGNAL(clicked()), this, SLOT(slot_tbUp())); |
||
154 | connect(tb_9_7, SIGNAL(clicked()), this, SLOT(slot_tbDown())); |
||
155 | connect(tb_9_8, SIGNAL(clicked()), this, SLOT(slot_tbLeft())); |
||
156 | connect(tb_9_9, SIGNAL(clicked()), this, SLOT(slot_tbRight())); |
||
157 | } |
||
158 | |||
159 | void dlg_Main::init_Directorys() |
||
160 | { |
||
161 | QDir *t_Dir = new QDir(); |
||
162 | |||
163 | s_Dir.MainData = QDir::homePath() + "/QMK-Data"; |
||
164 | if (!t_Dir->exists(s_Dir.MainData)) |
||
165 | { |
||
166 | t_Dir->mkdir(s_Dir.MainData); |
||
167 | } |
||
168 | |||
169 | s_Dir.Settings = s_Dir.MainData + "/Settings"; |
||
170 | if (!t_Dir->exists(s_Dir.Settings)) |
||
171 | { |
||
172 | t_Dir->mkdir(s_Dir.Settings); |
||
173 | } |
||
174 | } |
||
175 | |||
750 | KeyOz | 176 | /////////// |
177 | // Slots // |
||
178 | /////////// |
||
179 | |||
180 | // About-Dialog |
||
181 | void dlg_Main::slot_ac_About() |
||
674 | KeyOz | 182 | { |
750 | KeyOz | 183 | QMessageBox::about(this, trUtf8(("Über ")) + QA_NAME, QA_ABOUT); |
184 | } |
||
674 | KeyOz | 185 | |
750 | KeyOz | 186 | void dlg_Main::slot_ac_Toolbar() |
187 | { |
||
188 | if (ac_Toolbar->isChecked()) |
||
674 | KeyOz | 189 | { |
750 | KeyOz | 190 | wg_Connection->set_ButtonVisible(false); |
191 | ToolBar->setVisible(true); |
||
674 | KeyOz | 192 | } |
750 | KeyOz | 193 | else |
194 | { |
||
195 | wg_Connection->set_ButtonVisible(true); |
||
196 | ToolBar->setVisible(false); |
||
197 | } |
||
674 | KeyOz | 198 | } |
199 | |||
750 | KeyOz | 200 | void dlg_Main::slot_ConnectionStatus(int li_Status) |
674 | KeyOz | 201 | { |
750 | KeyOz | 202 | if (li_Status) |
674 | KeyOz | 203 | { |
750 | KeyOz | 204 | ac_Connect->setChecked(true); |
205 | ac_Connect->setText(tr("Trennen")); |
||
674 | KeyOz | 206 | } |
750 | KeyOz | 207 | else |
208 | { |
||
209 | ac_Connect->setChecked(false); |
||
210 | ac_Connect->setText(tr("Verbinden")); |
||
211 | } |
||
674 | KeyOz | 212 | } |
213 | |||
750 | KeyOz | 214 | void dlg_Main::slot_MK_Version(s_Hardware ls_Version) |
215 | { |
||
216 | gs_Version = ls_Version; |
||
217 | setWindowTitle(QA_NAME + " " + QA_VERSION + " - " + ls_Version.Hardware + " " + ls_Version.Version); |
||
674 | KeyOz | 218 | |
750 | KeyOz | 219 | if (gs_Version.ID == ADDRESS_FC) |
220 | { |
||
221 | c_Data[0] = 0xff; |
||
222 | wg_Connection->send_Data(HandlerMK::make_Frame('q', ADDRESS_FC, c_Data, 1).toLatin1().data(), DATA_READ_SETTINGS); |
||
223 | } |
||
674 | KeyOz | 224 | } |
225 | |||
750 | KeyOz | 226 | void dlg_Main::slot_MK_ReadSettings(s_MK_Settings ps_MK_Settings) |
674 | KeyOz | 227 | { |
750 | KeyOz | 228 | if (ps_MK_Settings.Version == MK_VERSION_SETTINGS) |
674 | KeyOz | 229 | { |
750 | KeyOz | 230 | show_MK_Settings(ps_MK_Settings); |
674 | KeyOz | 231 | } |
232 | else |
||
233 | { |
||
750 | KeyOz | 234 | QMessageBox::warning(this, QA_NAME, tr("Versionen inkompatibel. \nParameterbearbeitung nicht moeglich."), QMessageBox::Ok); |
235 | ac_Read->setEnabled(false); |
||
236 | ac_Write->setEnabled(false); |
||
674 | KeyOz | 237 | } |
238 | } |
||
239 | |||
750 | KeyOz | 240 | void dlg_Main::slot_MK_WriteSettings(int pi_ID) |
674 | KeyOz | 241 | { |
750 | KeyOz | 242 | if (pi_ID == 0) |
674 | KeyOz | 243 | { |
750 | KeyOz | 244 | QMessageBox::warning(this, QA_NAME, tr("Fehler beim Settings-Schreiben."), QMessageBox::Ok); |
674 | KeyOz | 245 | } |
750 | KeyOz | 246 | else |
674 | KeyOz | 247 | { |
750 | KeyOz | 248 | QMessageBox::information(this, QA_NAME, tr("Setting geschrieben."), QMessageBox::Ok); |
674 | KeyOz | 249 | } |
750 | KeyOz | 250 | |
674 | KeyOz | 251 | } |
252 | |||
750 | KeyOz | 253 | void dlg_Main::slot_MK_ReadMotorMixer(s_MK_Mixer ps_MK_MotorMixer) |
674 | KeyOz | 254 | { |
750 | KeyOz | 255 | if (ps_MK_MotorMixer.Revision == MK_VERSION_MIXER) |
256 | { |
||
257 | f_MotorMixer->set_MotorConfig(ps_MK_MotorMixer); |
||
258 | } |
||
259 | } |
||
674 | KeyOz | 260 | |
750 | KeyOz | 261 | void dlg_Main::slot_MK_WriteMotorMixer(int pi_ID) |
262 | { |
||
263 | if (pi_ID == 0) |
||
674 | KeyOz | 264 | { |
750 | KeyOz | 265 | QMessageBox::warning(this, QA_NAME, tr("Fehler beim MotorMixer-Schreiben."), QMessageBox::Ok); |
674 | KeyOz | 266 | } |
750 | KeyOz | 267 | else |
268 | { |
||
269 | QMessageBox::information(this, QA_NAME, tr("MotorMixer geschrieben."), QMessageBox::Ok); |
||
270 | } |
||
674 | KeyOz | 271 | |
272 | } |
||
273 | |||
750 | KeyOz | 274 | void dlg_Main::slot_MK_PPMData(s_MK_PPM_Data ps_PPMData) |
674 | KeyOz | 275 | { |
750 | KeyOz | 276 | qDebug("PPM-Data"); |
674 | KeyOz | 277 | |
750 | KeyOz | 278 | // qDebug() << ps_PPMData.Data[1] << ", " << ps_PPMData.Data[2] << ", " << ps_PPMData.Data[3] << ", " << ps_PPMData.Data[4]; |
279 | |||
280 | pb_K1->setValue(ps_PPMData.Data[1]); |
||
281 | pb_K2->setValue(ps_PPMData.Data[2]); |
||
282 | pb_K3->setValue(ps_PPMData.Data[3]); |
||
283 | pb_K4->setValue(ps_PPMData.Data[4]); |
||
284 | pb_K5->setValue(ps_PPMData.Data[5]); |
||
285 | pb_K6->setValue(ps_PPMData.Data[6]); |
||
286 | pb_K7->setValue(ps_PPMData.Data[7]); |
||
287 | pb_K8->setValue(ps_PPMData.Data[8]); |
||
288 | pb_K9->setValue(ps_PPMData.Data[9]); |
||
289 | pb_K10->setValue(ps_PPMData.Data[10]); |
||
290 | pb_K11->setValue(ps_PPMData.Data[11]); |
||
291 | pb_K12->setValue(ps_PPMData.Data[12]); |
||
292 | pb_K1_2->setValue(ps_PPMData.Data[13]); |
||
293 | pb_K2_2->setValue(ps_PPMData.Data[14]); |
||
294 | pb_K3_2->setValue(ps_PPMData.Data[15]); |
||
295 | pb_K4_2->setValue(ps_PPMData.Data[16]); |
||
296 | pb_K5_2->setValue(ps_PPMData.Data[17]); |
||
297 | pb_K6_2->setValue(ps_PPMData.Data[18]); |
||
298 | pb_K7_2->setValue(ps_PPMData.Data[19]); |
||
299 | pb_K8_2->setValue(ps_PPMData.Data[20]); |
||
300 | pb_K9_2->setValue(ps_PPMData.Data[21]); |
||
301 | pb_K10_2->setValue(ps_PPMData.Data[22]); |
||
302 | pb_K11_2->setValue(ps_PPMData.Data[23]); |
||
303 | pb_K12_2->setValue(ps_PPMData.Data[24]); |
||
674 | KeyOz | 304 | } |
305 | |||
306 | /////////////////////////////////////////////////////////////////// |
||
307 | // QMK-Settings // |
||
308 | /////////////////////////////////////////////////////////////////// |
||
309 | |||
750 | KeyOz | 310 | |
674 | KeyOz | 311 | void dlg_Main::slot_PageChange(int Page) |
312 | { |
||
313 | if (Page == 1) |
||
314 | o_Timer->start(); |
||
315 | else |
||
316 | o_Timer->stop(); |
||
317 | } |
||
318 | |||
319 | void dlg_Main::slot_Timer() |
||
320 | { |
||
750 | KeyOz | 321 | wg_Connection->send_Data(HandlerMK::make_Frame('p', ADDRESS_FC, c_Data, 0).toLatin1().data(), 0); |
674 | KeyOz | 322 | } |
323 | |||
324 | void dlg_Main::slot_ac_MotorMixer() |
||
325 | { |
||
750 | KeyOz | 326 | f_MotorMixer->set_Objects(o_Settings, s_Dir); |
674 | KeyOz | 327 | f_MotorMixer->read_Mixer(); |
328 | |||
329 | if (f_MotorMixer->exec()==QDialog::Accepted) |
||
330 | { |
||
331 | } |
||
332 | } |
||
333 | |||
750 | KeyOz | 334 | void dlg_Main::slot_ac_MotorTest() |
335 | { |
||
336 | // f_MotorMixer->set_Objects(wg_Connection->o_Input, o_Settings, s_Dir); |
||
337 | // f_MotorMixer->read_Mixer(); |
||
338 | |||
339 | if (f_MotorTest->exec()==QDialog::Accepted) |
||
340 | { |
||
341 | } |
||
342 | |||
343 | f_MotorTest->Stop(); |
||
344 | } |
||
345 | |||
674 | KeyOz | 346 | // Settings-Funktionen |
347 | void dlg_Main::slot_ac_Write() |
||
348 | { |
||
349 | s_MK_Settings t_Set; |
||
350 | |||
351 | t_Set = get_MK_Settings(); |
||
352 | |||
353 | memcpy((unsigned char *)&c_Data, (unsigned char *)&t_Set, sizeof(t_Set)); |
||
354 | |||
750 | KeyOz | 355 | wg_Connection->send_Data(HandlerMK::make_Frame('s', ADDRESS_FC, c_Data, sizeof(t_Set)).toLatin1().data(), DATA_WRITE_SETTINGS); |
674 | KeyOz | 356 | } |
357 | |||
358 | void dlg_Main::slot_ac_Read() |
||
359 | { |
||
360 | c_Data[0] = sb_Set->value(); |
||
750 | KeyOz | 361 | wg_Connection->send_Data(HandlerMK::make_Frame('q', ADDRESS_FC, c_Data, 1).toLatin1().data(), DATA_READ_SETTINGS); |
674 | KeyOz | 362 | } |
363 | |||
364 | void dlg_Main::slot_ac_Save() |
||
365 | { |
||
750 | KeyOz | 366 | QString Filename = QFileDialog::getSaveFileName(this, "Mikrokopter Parameter speichern", s_Dir.Settings + "/" + gs_Version.VersionShort + "_" + le_SetName->text() + ".mkp", "Mikrokopter Parameter(*.mkp);;Alle Dateien (*)"); |
674 | KeyOz | 367 | |
368 | if (!Filename.isEmpty()) |
||
369 | { |
||
370 | if (!(Filename.endsWith(".mkp", Qt::CaseInsensitive))) |
||
371 | { |
||
372 | Filename = Filename + QString(".mkp"); |
||
373 | } |
||
374 | |||
375 | s_MK_Settings t_Set = get_MK_Settings(); |
||
376 | |||
377 | QSettings Setting(Filename, QSettings::IniFormat); |
||
378 | |||
379 | Setting.beginGroup("Setup"); |
||
380 | Setting.setValue("Name", le_SetName->text()); |
||
381 | Setting.setValue("IniVersion", 3); |
||
382 | Setting.setValue("GlobalConfig", t_Set.GlobalConfig); |
||
383 | Setting.setValue("GlobalConfig2", t_Set.ExtraConfig); |
||
384 | Setting.endGroup(); |
||
385 | |||
386 | Setting.beginGroup("Channels"); |
||
387 | Setting.setValue("Nick", t_Set.Kanalbelegung[0]); |
||
388 | Setting.setValue("Roll", t_Set.Kanalbelegung[1]); |
||
389 | Setting.setValue("Gas", t_Set.Kanalbelegung[2]); |
||
390 | Setting.setValue("Gier", t_Set.Kanalbelegung[3]); |
||
391 | Setting.setValue("Poti_1", t_Set.Kanalbelegung[4]); |
||
392 | Setting.setValue("Poti_2", t_Set.Kanalbelegung[5]); |
||
393 | Setting.setValue("Poti_3", t_Set.Kanalbelegung[6]); |
||
394 | Setting.setValue("Poti_4", t_Set.Kanalbelegung[7]); |
||
750 | KeyOz | 395 | Setting.setValue("Poti_5", t_Set.Kanalbelegung[8]); |
396 | Setting.setValue("Poti_6", t_Set.Kanalbelegung[9]); |
||
397 | Setting.setValue("Poti_7", t_Set.Kanalbelegung[10]); |
||
398 | Setting.setValue("Poti_8", t_Set.Kanalbelegung[11]); |
||
399 | Setting.setValue("Receiver", t_Set.Receiver); |
||
674 | KeyOz | 400 | Setting.endGroup(); |
401 | |||
402 | Setting.beginGroup("Stick"); |
||
403 | Setting.setValue("Nick_Roll-P", t_Set.Stick_P); |
||
404 | Setting.setValue("Nick_Roll-D", t_Set.Stick_D); |
||
405 | Setting.setValue("Gier-P", t_Set.Gier_P); |
||
406 | Setting.setValue("ExternalControl", t_Set.ExternalControl); |
||
407 | Setting.endGroup(); |
||
408 | |||
409 | Setting.beginGroup("Altitude"); |
||
410 | Setting.setValue("Setpoint", t_Set.MaxHoehe); |
||
411 | Setting.setValue("MinGas", t_Set.Hoehe_MinGas); |
||
412 | Setting.setValue("P", t_Set.Hoehe_P); |
||
413 | Setting.setValue("Barometric-D", t_Set.Luftdruck_D); |
||
414 | Setting.setValue("Z-ACC-Effect", t_Set.Hoehe_ACC_Wirkung); |
||
415 | Setting.setValue("Gain", t_Set.Hoehe_Verstaerkung); |
||
416 | Setting.setValue("HoverVariation", t_Set.Hoehe_HoverBand); |
||
417 | Setting.setValue("GPS_Z", t_Set.Hoehe_GPS_Z); |
||
418 | Setting.setValue("StickNeutralPoint", t_Set.Hoehe_StickNeutralPoint); |
||
419 | Setting.endGroup(); |
||
420 | |||
421 | Setting.beginGroup("Gyro"); |
||
422 | Setting.setValue("P", t_Set.Gyro_P); |
||
423 | Setting.setValue("I", t_Set.Gyro_I); |
||
424 | Setting.setValue("D", t_Set.Gyro_D); |
||
425 | Setting.setValue("Gier_P", t_Set.Gyro_Gier_P); |
||
426 | Setting.setValue("Gier_I", t_Set.Gyro_Gier_I); |
||
427 | Setting.setValue("DynamicStability", t_Set.DynamicStability); |
||
428 | Setting.setValue("ACC_Gyro-Factor", t_Set.GyroAccFaktor); |
||
429 | Setting.setValue("ACC_Gyro-Compensation", t_Set.GyroAccAbgleich); |
||
430 | Setting.setValue("DriftCompensation", t_Set.Driftkomp); |
||
431 | Setting.setValue("Main-I", t_Set.I_Faktor); |
||
432 | Setting.endGroup(); |
||
433 | |||
434 | Setting.beginGroup("Camera"); |
||
435 | Setting.setValue("ServoNickControl", t_Set.ServoNickControl); |
||
436 | Setting.setValue("ServoNickCompensation", t_Set.ServoNickComp); |
||
437 | Setting.setValue("ServoNickMin", t_Set.ServoNickMin); |
||
438 | Setting.setValue("ServoNickMax", t_Set.ServoNickMax); |
||
439 | |||
440 | Setting.setValue("ServoRollControl", t_Set.ServoRollControl); |
||
441 | Setting.setValue("ServoRollCompensation", t_Set.ServoRollComp); |
||
442 | Setting.setValue("ServoRollMin", t_Set.ServoRollMin); |
||
443 | Setting.setValue("ServoRollMax", t_Set.ServoRollMax); |
||
444 | |||
445 | Setting.setValue("ServoInvert", t_Set.ServoCompInvert); |
||
446 | Setting.setValue("ServoNickRefreshRate", t_Set.ServoNickRefresh); |
||
750 | KeyOz | 447 | |
448 | Setting.setValue("Servo3", t_Set.Servo3); |
||
449 | Setting.setValue("Servo4", t_Set.Servo4); |
||
450 | Setting.setValue("Servo5", t_Set.Servo5); |
||
674 | KeyOz | 451 | Setting.endGroup(); |
452 | |||
453 | Setting.beginGroup("Others"); |
||
454 | Setting.setValue("MinGas", t_Set.Gas_Min); |
||
455 | Setting.setValue("MaxGas", t_Set.Gas_Max); |
||
456 | Setting.setValue("Compass-Effect", t_Set.KompassWirkung); |
||
457 | Setting.setValue("UnderVoltage", t_Set.UnterspannungsWarnung); |
||
458 | Setting.setValue("NotGas", t_Set.NotGas); |
||
459 | Setting.setValue("NotGasTime", t_Set.NotGasZeit); |
||
460 | Setting.endGroup(); |
||
461 | |||
462 | Setting.beginGroup("Coupling"); |
||
463 | Setting.setValue("YawPosFeedback", t_Set.AchsKopplung1); |
||
464 | Setting.setValue("NickRollFeedback", t_Set.AchsKopplung2); |
||
465 | Setting.setValue("YawCorrection", t_Set.CouplingYawCorrection); |
||
466 | Setting.endGroup(); |
||
467 | |||
468 | Setting.beginGroup("Loop"); |
||
469 | Setting.setValue("Config", t_Set.BitConfig); |
||
470 | Setting.setValue("GasLimit", t_Set.LoopGasLimit); |
||
471 | Setting.setValue("StickThreshold", t_Set.LoopThreshold); |
||
472 | Setting.setValue("LoopHysteresis", t_Set.LoopHysterese); |
||
473 | Setting.setValue("TurnOverNick", t_Set.WinkelUmschlagNick); |
||
474 | Setting.setValue("TurnOverRoll", t_Set.WinkelUmschlagRoll); |
||
711 | KeyOz | 475 | Setting.endGroup(); |
674 | KeyOz | 476 | |
477 | Setting.beginGroup("User"); |
||
478 | Setting.setValue("Parameter_1", t_Set.UserParam1); |
||
479 | Setting.setValue("Parameter_2", t_Set.UserParam2); |
||
480 | Setting.setValue("Parameter_3", t_Set.UserParam3); |
||
481 | Setting.setValue("Parameter_4", t_Set.UserParam4); |
||
482 | Setting.setValue("Parameter_5", t_Set.UserParam5); |
||
483 | Setting.setValue("Parameter_6", t_Set.UserParam6); |
||
484 | Setting.setValue("Parameter_7", t_Set.UserParam7); |
||
485 | Setting.setValue("Parameter_8", t_Set.UserParam8); |
||
486 | Setting.endGroup(); |
||
487 | |||
488 | Setting.beginGroup("Output"); |
||
489 | Setting.setValue("J16_Bitmask", t_Set.J16Bitmask); |
||
490 | Setting.setValue("J16_Timing", t_Set.J16Timing); |
||
491 | Setting.setValue("J17_Bitmask", t_Set.J17Bitmask); |
||
492 | Setting.setValue("J17_Timing", t_Set.J17Timing); |
||
493 | Setting.setValue("WARN_J16_Bitmask", t_Set.WARN_J16_Bitmask); |
||
494 | Setting.setValue("WARN_J17_Bitmask", t_Set.WARN_J17_Bitmask); |
||
495 | Setting.endGroup(); |
||
496 | |||
497 | Setting.beginGroup("NaviCtrl"); |
||
498 | Setting.setValue("GPS_ModeControl", t_Set.NaviGpsModeControl); |
||
499 | Setting.setValue("GPS_Gain", t_Set.NaviGpsGain); |
||
500 | Setting.setValue("GPS_P", t_Set.NaviGpsP); |
||
501 | Setting.setValue("GPS_I", t_Set.NaviGpsI); |
||
502 | Setting.setValue("GPS_D", t_Set.NaviGpsD); |
||
503 | Setting.setValue("GPS_P_Limit", t_Set.NaviGpsPLimit); |
||
504 | Setting.setValue("GPS_I_Limit", t_Set.NaviGpsILimit); |
||
505 | Setting.setValue("GPS_D_Limit", t_Set.NaviGpsDLimit); |
||
506 | Setting.setValue("GPS_Acc", t_Set.NaviGpsACC); |
||
507 | Setting.setValue("GPS_MinSat", t_Set.NaviGpsMinSat); |
||
508 | Setting.setValue("GPS_StickThreshold", t_Set.NaviStickThreshold); |
||
509 | Setting.setValue("GPS_WindCorrection", t_Set.NaviWindCorrection); |
||
510 | Setting.setValue("GPS_SpeedCompensation", t_Set.NaviSpeedCompensation); |
||
511 | Setting.setValue("GPS_MaxRadius", t_Set.NaviOperatingRadius); |
||
512 | Setting.setValue("GPS_AngleLimit", t_Set.NaviAngleLimitation); |
||
513 | Setting.setValue("GPS_PH_Login_Time", t_Set.NaviPH_LoginTime); |
||
514 | Setting.endGroup(); |
||
515 | } |
||
516 | } |
||
517 | |||
518 | void dlg_Main::slot_ac_Load() |
||
519 | { |
||
520 | QString Filename = QFileDialog::getOpenFileName(this, "Mikrokopter Parameter laden", s_Dir.Settings + "", "Mikrokopter Parameter(*.mkp);;Alle Dateien (*)"); |
||
521 | |||
522 | if (!Filename.isEmpty()) |
||
523 | { |
||
524 | s_MK_Settings t_Set = get_MK_Settings(); |
||
525 | |||
526 | t_Set.Index = sb_Set->value(); |
||
527 | |||
528 | QSettings Setting(Filename, QSettings::IniFormat); |
||
529 | |||
530 | Setting.beginGroup("Setup"); |
||
531 | QString Name = Setting.value("Name", QString("--noname--")).toString(); |
||
532 | |||
533 | memcpy(t_Set.Name, Name.toLatin1().data(), 12); |
||
534 | |||
535 | t_Set.GlobalConfig = Setting.value("GlobalConfig", 104).toInt(); |
||
536 | t_Set.ExtraConfig = Setting.value("GlobalConfig2", 1).toInt(); |
||
537 | Setting.endGroup(); |
||
538 | |||
539 | Setting.beginGroup("Channels"); |
||
540 | t_Set.Kanalbelegung[0] = Setting.value("Nick", 1).toInt(); |
||
541 | t_Set.Kanalbelegung[1] = Setting.value("Roll", 2).toInt(); |
||
542 | t_Set.Kanalbelegung[2] = Setting.value("Gas", 3).toInt(); |
||
543 | t_Set.Kanalbelegung[3] = Setting.value("Gier", 4).toInt(); |
||
544 | t_Set.Kanalbelegung[4] = Setting.value("Poti_1", 5).toInt(); |
||
545 | t_Set.Kanalbelegung[5] = Setting.value("Poti_2", 6).toInt(); |
||
546 | t_Set.Kanalbelegung[6] = Setting.value("Poti_3", 7).toInt(); |
||
547 | t_Set.Kanalbelegung[7] = Setting.value("Poti_4", 8).toInt(); |
||
750 | KeyOz | 548 | t_Set.Kanalbelegung[8] = Setting.value("Poti_5", 9).toInt(); |
549 | t_Set.Kanalbelegung[9] = Setting.value("Poti_6", 10).toInt(); |
||
550 | t_Set.Kanalbelegung[10] = Setting.value("Poti_7", 11).toInt(); |
||
551 | t_Set.Kanalbelegung[11] = Setting.value("Poti_8", 12).toInt(); |
||
552 | t_Set.Receiver = Setting.value("Receiver", 0).toInt(); |
||
674 | KeyOz | 553 | Setting.endGroup(); |
554 | |||
555 | Setting.beginGroup("Stick"); |
||
556 | t_Set.Stick_P = Setting.value("Nick_Roll-P", 10).toInt(); |
||
557 | t_Set.Stick_D = Setting.value("Nick_Roll-D", 16).toInt(); |
||
558 | t_Set.Gier_P = Setting.value("Gier-P", 6).toInt(); |
||
559 | t_Set.ExternalControl = Setting.value("ExternalControl", 0).toInt(); |
||
560 | Setting.endGroup(); |
||
561 | |||
562 | Setting.beginGroup("Altitude"); |
||
563 | t_Set.MaxHoehe = Setting.value("Setpoint", 251).toInt(); |
||
564 | t_Set.Hoehe_MinGas = Setting.value("MinGas", 30).toInt(); |
||
565 | t_Set.Hoehe_P = Setting.value("P", 10).toInt(); |
||
566 | t_Set.Luftdruck_D = Setting.value("Barometric-D", 30).toInt(); |
||
567 | t_Set.Hoehe_ACC_Wirkung = Setting.value("Z-ACC-Effect", 30).toInt(); |
||
568 | t_Set.Hoehe_Verstaerkung = Setting.value("Gain", 15).toInt(); |
||
569 | t_Set.Hoehe_HoverBand = Setting.value("HoverVariation", 5).toInt(); |
||
570 | t_Set.Hoehe_GPS_Z = Setting.value("GPS_Z", 64).toInt(); |
||
571 | t_Set.Hoehe_StickNeutralPoint = Setting.value("StickNeutralPoint", 0).toInt(); |
||
572 | Setting.endGroup(); |
||
573 | |||
574 | Setting.beginGroup("Gyro"); |
||
575 | t_Set.Gyro_P = Setting.value("P", 90).toInt(); |
||
576 | t_Set.Gyro_I = Setting.value("I", 120).toInt(); |
||
577 | t_Set.Gyro_D = Setting.value("D", 3).toInt(); |
||
578 | t_Set.Gyro_Gier_P = Setting.value("Gier_P", 100).toInt(); |
||
579 | t_Set.Gyro_Gier_I = Setting.value("Gier_I", 120).toInt(); |
||
580 | t_Set.DynamicStability = Setting.value("DynamicStability", 75).toInt(); |
||
581 | t_Set.GyroAccFaktor = Setting.value("ACC_Gyro-Factor", 30).toInt(); |
||
582 | t_Set.GyroAccAbgleich = Setting.value("ACC_Gyro-Compensation", 32).toInt(); |
||
583 | t_Set.Driftkomp = Setting.value("DriftCompensation", 32).toInt(); |
||
584 | t_Set.I_Faktor = Setting.value("Main-I", 32).toInt(); |
||
585 | Setting.endGroup(); |
||
586 | |||
587 | Setting.beginGroup("Camera"); |
||
588 | t_Set.ServoNickControl = Setting.value("ServoNickControl", 100).toInt(); |
||
589 | t_Set.ServoNickComp = Setting.value("ServoNickCompensation", 40).toInt(); |
||
590 | t_Set.ServoNickMin = Setting.value("ServoNickMin", 0).toInt(); |
||
591 | t_Set.ServoNickMax = Setting.value("ServoNickMax", 250).toInt(); |
||
592 | |||
593 | t_Set.ServoRollControl = Setting.value("ServoRollControl", 100).toInt(); |
||
594 | t_Set.ServoRollComp = Setting.value("ServoRollCompensation", 40).toInt(); |
||
595 | t_Set.ServoRollMin = Setting.value("ServoRollMin", 0).toInt(); |
||
596 | t_Set.ServoRollMax = Setting.value("ServoRollMax", 250).toInt(); |
||
597 | |||
598 | t_Set.ServoCompInvert = Setting.value("ServoInvert", 0).toInt(); |
||
599 | t_Set.ServoNickRefresh = Setting.value("ServoNickRefreshRate", 3).toInt(); |
||
750 | KeyOz | 600 | |
601 | t_Set.Servo3 = Setting.value("Servo3", 0).toInt(); |
||
602 | t_Set.Servo4 = Setting.value("Servo4", 0).toInt(); |
||
603 | t_Set.Servo5 = Setting.value("Servo5", 0).toInt(); |
||
674 | KeyOz | 604 | Setting.endGroup(); |
605 | |||
606 | Setting.beginGroup("Others"); |
||
607 | t_Set.Gas_Min = Setting.value("MinGas", 8).toInt(); |
||
608 | t_Set.Gas_Max = Setting.value("MaxGas", 230).toInt(); |
||
609 | t_Set.KompassWirkung = Setting.value("Compass-Effect", 128).toInt(); |
||
610 | t_Set.UnterspannungsWarnung = Setting.value("UnderVoltage", 99).toInt(); |
||
611 | t_Set.NotGas = Setting.value("NotGas", 35).toInt(); |
||
612 | t_Set.NotGasZeit = Setting.value("NotGasTime", 30).toInt(); |
||
613 | Setting.endGroup(); |
||
614 | |||
615 | Setting.beginGroup("Coupling"); |
||
616 | t_Set.AchsKopplung1 = Setting.value("YawPosFeedback", 90).toInt(); |
||
617 | t_Set.AchsKopplung2 = Setting.value("NickRollFeedback", 80).toInt(); |
||
618 | t_Set.CouplingYawCorrection = Setting.value("YawCorrection", 60).toInt(); |
||
619 | Setting.endGroup(); |
||
620 | |||
621 | Setting.beginGroup("Loop"); |
||
622 | t_Set.BitConfig = Setting.value("Config", 0).toInt(); |
||
623 | t_Set.LoopGasLimit = Setting.value("GasLimit", 50).toInt(); |
||
624 | t_Set.LoopThreshold = Setting.value("StickThreshold", 90).toInt(); |
||
625 | t_Set.LoopHysterese = Setting.value("LoopHysteresis", 50).toInt(); |
||
626 | t_Set.WinkelUmschlagNick = Setting.value("TurnOverNick", 85).toInt(); |
||
627 | t_Set.WinkelUmschlagRoll = Setting.value("TurnOverRoll", 85).toInt(); |
||
628 | Setting.endGroup(); |
||
629 | |||
630 | Setting.beginGroup("User"); |
||
631 | t_Set.UserParam1 = Setting.value("Parameter_1", 0).toInt(); |
||
632 | t_Set.UserParam2 = Setting.value("Parameter_2", 0).toInt(); |
||
633 | t_Set.UserParam3 = Setting.value("Parameter_3", 0).toInt(); |
||
634 | t_Set.UserParam4 = Setting.value("Parameter_4", 0).toInt(); |
||
635 | t_Set.UserParam5 = Setting.value("Parameter_5", 0).toInt(); |
||
636 | t_Set.UserParam6 = Setting.value("Parameter_6", 0).toInt(); |
||
637 | t_Set.UserParam7 = Setting.value("Parameter_7", 0).toInt(); |
||
638 | t_Set.UserParam8 = Setting.value("Parameter_8", 0).toInt(); |
||
639 | Setting.endGroup(); |
||
640 | |||
641 | Setting.beginGroup("Output"); |
||
642 | t_Set.J16Bitmask = Setting.value("J16_Bitmask", 255).toInt(); |
||
643 | t_Set.J16Timing = Setting.value("J16_Timing", 15).toInt(); |
||
644 | t_Set.J17Bitmask = Setting.value("J17_Bitmask", 255).toInt(); |
||
645 | t_Set.J17Timing = Setting.value("J17_Timing", 15).toInt(); |
||
646 | t_Set.WARN_J16_Bitmask = Setting.value("WARN_J16_Bitmask", 0xaa).toInt(); |
||
647 | t_Set.WARN_J17_Bitmask = Setting.value("WARN_J17_Bitmask", 0xaa).toInt(); |
||
648 | Setting.endGroup(); |
||
649 | |||
650 | Setting.beginGroup("NaviCtrl"); |
||
651 | t_Set.NaviGpsModeControl = Setting.value("GPS_ModeControl", 253).toInt(); |
||
652 | t_Set.NaviGpsGain = Setting.value("GPS_Gain", 100).toInt(); |
||
653 | t_Set.NaviGpsP = Setting.value("GPS_P", 90).toInt(); |
||
654 | t_Set.NaviGpsI = Setting.value("GPS_I", 90).toInt(); |
||
655 | t_Set.NaviGpsD = Setting.value("GPS_D", 90).toInt(); |
||
656 | t_Set.NaviGpsPLimit = Setting.value("GPS_P_Limit", 75).toInt(); |
||
657 | t_Set.NaviGpsILimit = Setting.value("GPS_I_Limit", 75).toInt(); |
||
658 | t_Set.NaviGpsDLimit = Setting.value("GPS_D_Limit", 75).toInt(); |
||
659 | t_Set.NaviGpsACC = Setting.value("GPS_Acc", 0).toInt(); |
||
660 | t_Set.NaviGpsMinSat = Setting.value("GPS_MinSat", 6).toInt(); |
||
661 | t_Set.NaviStickThreshold = Setting.value("GPS_StickThreshold", 8).toInt(); |
||
662 | t_Set.NaviWindCorrection = Setting.value("GPS_WindCorrection", 90).toInt(); |
||
663 | t_Set.NaviSpeedCompensation = Setting.value("GPS_SpeedCompensation", 30).toInt(); |
||
664 | t_Set.NaviOperatingRadius = Setting.value("GPS_MaxRadius", 100).toInt(); |
||
665 | t_Set.NaviAngleLimitation = Setting.value("GPS_AngleLimit", 100).toInt(); |
||
666 | t_Set.NaviPH_LoginTime = Setting.value("GPS_PH_Login_Time", 4).toInt(); |
||
667 | Setting.endGroup(); |
||
668 | |||
669 | show_MK_Settings(t_Set); |
||
670 | } |
||
671 | } |
||
672 | |||
673 | void dlg_Main::show_MK_Settings(s_MK_Settings t_Set) // DONE 0.75i |
||
674 | { |
||
675 | sb_Set->setValue(int(t_Set.Index)); |
||
676 | |||
677 | le_SetName->setText(QString(t_Set.Name)); |
||
678 | // Seite 1 |
||
679 | { |
||
680 | s_1_1_cb->setChecked(t_Set.GlobalConfig & CFG_HOEHENREGELUNG); |
||
681 | s_1_2_cb->setChecked(t_Set.GlobalConfig & CFG_KOMPASS_AKTIV); |
||
682 | s_1_3_cb->setChecked(t_Set.GlobalConfig & CFG_KOMPASS_FIX); |
||
683 | s_1_4_cb->setChecked(t_Set.GlobalConfig & CFG_GPS_AKTIV); |
||
684 | s_1_5_cb->setChecked(t_Set.ExtraConfig & CFG_SENSITIVE_RC); |
||
685 | s_1_6_cb->setChecked(t_Set.GlobalConfig & CFG_ACHSENKOPPLUNG_AKTIV); |
||
686 | s_1_7_cb->setChecked(t_Set.GlobalConfig & CFG_DREHRATEN_BEGRENZER); |
||
687 | s_1_8_cb->setChecked(t_Set.GlobalConfig & CFG_HEADING_HOLD); |
||
688 | } |
||
689 | // Seite 2 |
||
690 | { |
||
750 | KeyOz | 691 | cb_2_1->setCurrentIndex(t_Set.Kanalbelegung[2] - 1); |
692 | cb_2_2->setCurrentIndex(t_Set.Kanalbelegung[3] - 1); |
||
693 | cb_2_3->setCurrentIndex(t_Set.Kanalbelegung[0] - 1); |
||
694 | cb_2_4->setCurrentIndex(t_Set.Kanalbelegung[1] - 1); |
||
695 | cb_2_5->setCurrentIndex(t_Set.Kanalbelegung[4] - 1); |
||
696 | cb_2_6->setCurrentIndex(t_Set.Kanalbelegung[5] - 1); |
||
697 | cb_2_7->setCurrentIndex(t_Set.Kanalbelegung[6] - 1); |
||
698 | cb_2_8->setCurrentIndex(t_Set.Kanalbelegung[7] - 1); |
||
699 | cb_2_9->setCurrentIndex(t_Set.Kanalbelegung[8] - 1); |
||
700 | cb_2_10->setCurrentIndex(t_Set.Kanalbelegung[9] - 1); |
||
701 | cb_2_11->setCurrentIndex(t_Set.Kanalbelegung[10] - 1); |
||
702 | cb_2_12->setCurrentIndex(t_Set.Kanalbelegung[11] - 1); |
||
703 | s_2_13_cb->setCurrentIndex(t_Set.Receiver); |
||
674 | KeyOz | 704 | } |
705 | // Seite 3 |
||
706 | { |
||
707 | sb_3_1->setValue(t_Set.Stick_P); |
||
708 | sb_3_2->setValue(t_Set.Stick_D); |
||
709 | cb_3_3 = setCombo(cb_3_3, t_Set.Gier_P); |
||
710 | cb_3_4 = setCombo(cb_3_4, t_Set.ExternalControl); |
||
711 | } |
||
712 | // Seite 4 |
||
713 | { |
||
750 | KeyOz | 714 | // s_4_2_rb->setChecked(t_Set.ExtraConfig & CFG2_HEIGHT_LIMIT); |
715 | |||
716 | if (t_Set.ExtraConfig & CFG2_HEIGHT_LIMIT) |
||
717 | { |
||
718 | s_4_2_rb->setChecked(true); |
||
722 | tempolo | 719 | } |
750 | KeyOz | 720 | else |
721 | { |
||
722 | s_4_3_rb->setChecked(true); |
||
723 | } |
||
724 | |||
674 | KeyOz | 725 | s_4_5_cb->setChecked(t_Set.ExtraConfig & CFG2_VARIO_BEEP); |
726 | s_4_4_cb->setChecked(t_Set.GlobalConfig & CFG_HOEHEN_SCHALTER); |
||
727 | |||
728 | cb_4_1 = setCombo(cb_4_1, t_Set.MaxHoehe); |
||
729 | sb_4_2->setValue(t_Set.Hoehe_MinGas); |
||
730 | cb_4_3 = setCombo(cb_4_3, t_Set.Hoehe_P); |
||
731 | cb_4_4 = setCombo(cb_4_4, t_Set.Luftdruck_D); |
||
732 | cb_4_5 = setCombo(cb_4_5, t_Set.Hoehe_ACC_Wirkung); |
||
733 | sb_4_6->setValue(t_Set.Hoehe_Verstaerkung); |
||
734 | sb_4_7->setValue(t_Set.Hoehe_HoverBand); |
||
735 | cb_4_8 = setCombo(cb_4_8, t_Set.Hoehe_GPS_Z); |
||
736 | sb_4_9->setValue(t_Set.Hoehe_StickNeutralPoint); |
||
737 | } |
||
738 | // Seite 5 |
||
739 | { |
||
740 | cb_5_1 = setCombo(cb_5_1, t_Set.Gyro_P); |
||
741 | cb_5_2 = setCombo(cb_5_2, t_Set.Gyro_I); |
||
742 | cb_5_8 = setCombo(cb_5_8, t_Set.Gyro_D); |
||
743 | cb_5_3 = setCombo(cb_5_3, t_Set.DynamicStability); |
||
744 | sb_5_4->setValue(t_Set.GyroAccFaktor); |
||
745 | sb_5_5->setValue(t_Set.GyroAccAbgleich); |
||
746 | cb_5_6 = setCombo(cb_5_6, t_Set.I_Faktor); |
||
747 | sb_5_7->setValue(t_Set.Driftkomp); |
||
748 | cb_5_9 = setCombo(cb_5_9, t_Set.Gyro_Gier_P); |
||
749 | cb_5_10 = setCombo(cb_5_10, t_Set.Gyro_Gier_I); |
||
750 | } |
||
751 | // Seite 6 |
||
752 | { |
||
753 | cb_6_1 = setCombo(cb_6_1, t_Set.ServoNickControl); |
||
754 | sb_6_2->setValue(t_Set.ServoNickComp); |
||
755 | sb_6_3->setValue(t_Set.ServoNickMin); |
||
756 | sb_6_4->setValue(t_Set.ServoNickMax); |
||
757 | |||
758 | cb_6_7 = setCombo(cb_6_7, t_Set.ServoRollControl); |
||
759 | sb_6_8->setValue(t_Set.ServoRollComp); |
||
760 | sb_6_10->setValue(t_Set.ServoRollMin); |
||
761 | sb_6_11->setValue(t_Set.ServoRollMax); |
||
762 | |||
763 | cb_6_6->setChecked(t_Set.ServoCompInvert & 0x01); |
||
764 | cb_6_9->setChecked(t_Set.ServoCompInvert & 0x02); |
||
765 | |||
766 | sb_6_5->setValue(t_Set.ServoNickRefresh); |
||
750 | KeyOz | 767 | |
768 | cb_6_12 = setCombo(cb_6_12, t_Set.Servo3); |
||
769 | cb_6_13 = setCombo(cb_6_13, t_Set.Servo4); |
||
770 | cb_6_14 = setCombo(cb_6_14, t_Set.Servo5); |
||
771 | |||
674 | KeyOz | 772 | } |
773 | // Seite 7 |
||
774 | { |
||
775 | sb_7_1->setValue(t_Set.Gas_Min); |
||
776 | sb_7_2->setValue(t_Set.Gas_Max); |
||
777 | cb_7_3 = setCombo(cb_7_3, t_Set.KompassWirkung); |
||
778 | sb_7_4->setValue(t_Set.UnterspannungsWarnung); |
||
779 | sb_7_5->setValue(t_Set.NotGasZeit); |
||
780 | sb_7_6->setValue(t_Set.NotGas); |
||
781 | } |
||
782 | // Seite 8 |
||
783 | { |
||
784 | cb_8_1 = setCombo(cb_8_1, t_Set.AchsKopplung1); |
||
785 | cb_8_2 = setCombo(cb_8_2, t_Set.AchsKopplung2); |
||
786 | cb_8_3 = setCombo(cb_8_3, t_Set.CouplingYawCorrection); |
||
787 | } |
||
788 | // Seite 9 - Looping |
||
789 | { |
||
790 | if (t_Set.BitConfig & 0x01) |
||
791 | { |
||
792 | tb_9_6->setText("1"); |
||
793 | tb_9_6->setChecked(true); |
||
794 | } |
||
795 | else |
||
796 | { |
||
797 | tb_9_6->setText("0"); |
||
798 | tb_9_6->setChecked(false); |
||
799 | } |
||
800 | |||
801 | if (t_Set.BitConfig & 0x02) |
||
802 | { |
||
803 | tb_9_7->setText("1"); |
||
804 | tb_9_7->setChecked(true); |
||
805 | } |
||
806 | else |
||
807 | { |
||
808 | tb_9_7->setText("0"); |
||
809 | tb_9_7->setChecked(false); |
||
810 | } |
||
811 | |||
812 | if (t_Set.BitConfig & 0x04) |
||
813 | { |
||
814 | tb_9_8->setText("1"); |
||
815 | tb_9_8->setChecked(true); |
||
816 | } |
||
817 | else |
||
818 | { |
||
819 | tb_9_8->setText("0"); |
||
820 | tb_9_8->setChecked(false); |
||
821 | } |
||
822 | |||
823 | if (t_Set.BitConfig & 0x08) |
||
824 | { |
||
825 | tb_9_9->setText("1"); |
||
826 | tb_9_9->setChecked(true); |
||
827 | } |
||
828 | else |
||
829 | { |
||
830 | tb_9_9->setText("0"); |
||
831 | tb_9_9->setChecked(false); |
||
832 | } |
||
833 | |||
834 | cb_9_1 = setCombo(cb_9_1, t_Set.LoopGasLimit); |
||
835 | sb_9_2->setValue(t_Set.LoopThreshold); |
||
836 | sb_9_3->setValue(t_Set.WinkelUmschlagNick); |
||
837 | sb_9_4->setValue(t_Set.LoopHysterese); |
||
838 | sb_9_5->setValue(t_Set.WinkelUmschlagRoll); |
||
839 | |||
840 | } |
||
841 | // Seite 10 - Userparameter |
||
842 | { |
||
843 | cb_10_1 = setCombo(cb_10_1, t_Set.UserParam1); |
||
844 | cb_10_2 = setCombo(cb_10_2, t_Set.UserParam2); |
||
845 | cb_10_3 = setCombo(cb_10_3, t_Set.UserParam3); |
||
846 | cb_10_4 = setCombo(cb_10_4, t_Set.UserParam4); |
||
847 | cb_10_5 = setCombo(cb_10_5, t_Set.UserParam5); |
||
848 | cb_10_6 = setCombo(cb_10_6, t_Set.UserParam6); |
||
849 | cb_10_7 = setCombo(cb_10_7, t_Set.UserParam7); |
||
850 | cb_10_8 = setCombo(cb_10_8, t_Set.UserParam8); |
||
851 | } |
||
852 | // Seite 11 - Output |
||
853 | { |
||
854 | sb_11_1->setValue(t_Set.J16Bitmask); |
||
855 | cb_11_2 = setCombo(cb_11_2, int(t_Set.J16Timing)); |
||
856 | sb_11_3->setValue(t_Set.J17Bitmask); |
||
857 | cb_11_4 = setCombo(cb_11_4, int(t_Set.J17Timing)); |
||
858 | sb_11_5->setValue(t_Set.WARN_J16_Bitmask); |
||
859 | sb_11_6->setValue(t_Set.WARN_J17_Bitmask); |
||
860 | cb_11_7->setChecked(t_Set.BitConfig & CFG_MOTOR_BLINK); |
||
750 | KeyOz | 861 | |
862 | if (t_Set.WARN_J16_Bitmask != 0) |
||
863 | s_11_7_cb->setChecked(true); |
||
864 | else |
||
865 | s_11_7_cb->setChecked(false); |
||
866 | |||
867 | if (t_Set.WARN_J17_Bitmask != 0) |
||
868 | s_11_8_cb->setChecked(true); |
||
869 | else |
||
870 | s_11_8_cb->setChecked(false); |
||
674 | KeyOz | 871 | } |
872 | // Seite 12 |
||
873 | { |
||
874 | cb_12_1 = setCombo(cb_12_1, t_Set.NaviGpsModeControl); |
||
875 | cb_12_2 = setCombo(cb_12_2, t_Set.NaviGpsGain); |
||
876 | sb_12_3->setValue(t_Set.NaviStickThreshold); |
||
877 | sb_12_4->setValue(t_Set.NaviGpsMinSat); |
||
878 | cb_12_5 = setCombo(cb_12_5, t_Set.NaviGpsP); |
||
879 | cb_12_6 = setCombo(cb_12_6, t_Set.NaviGpsI); |
||
880 | cb_12_7 = setCombo(cb_12_7, t_Set.NaviGpsD); |
||
881 | cb_12_8 = setCombo(cb_12_8, t_Set.NaviGpsACC); |
||
882 | cb_12_9 = setCombo(cb_12_9, t_Set.NaviGpsPLimit); |
||
883 | cb_12_10 = setCombo(cb_12_10, t_Set.NaviGpsILimit); |
||
884 | cb_12_11 = setCombo(cb_12_11, t_Set.NaviGpsDLimit); |
||
885 | } |
||
886 | // Seite 13 |
||
887 | { |
||
888 | cb_13_1 = setCombo(cb_13_1, t_Set.NaviWindCorrection); |
||
889 | cb_13_2 = setCombo(cb_13_2, t_Set.NaviSpeedCompensation); |
||
890 | cb_13_3 = setCombo(cb_13_3, t_Set.NaviOperatingRadius); |
||
891 | cb_13_4 = setCombo(cb_13_4, t_Set.NaviAngleLimitation); |
||
892 | sb_13_5->setValue(t_Set.NaviPH_LoginTime); |
||
893 | } |
||
894 | } |
||
895 | |||
896 | s_MK_Settings dlg_Main::get_MK_Settings() // DONE 0.75i |
||
897 | { |
||
898 | s_MK_Settings t_Set; |
||
899 | |||
900 | memcpy(t_Set.Name, le_SetName->text().toLatin1().data(), 12); |
||
901 | t_Set.Index = sb_Set->value(); |
||
902 | t_Set.Version = MK_VERSION_SETTINGS; |
||
903 | |||
904 | // Seite 1 |
||
905 | { |
||
906 | t_Set.GlobalConfig = 0; |
||
907 | t_Set.ExtraConfig = 0; |
||
908 | |||
909 | if (s_1_1_cb->isChecked()) |
||
910 | t_Set.GlobalConfig = t_Set.GlobalConfig | CFG_HOEHENREGELUNG; |
||
911 | if (s_1_2_cb->isChecked()) |
||
912 | t_Set.GlobalConfig = t_Set.GlobalConfig | CFG_KOMPASS_AKTIV; |
||
913 | if (s_1_3_cb->isChecked()) |
||
914 | t_Set.GlobalConfig = t_Set.GlobalConfig | CFG_KOMPASS_FIX; |
||
915 | if (s_1_4_cb->isChecked()) |
||
916 | t_Set.GlobalConfig = t_Set.GlobalConfig | CFG_GPS_AKTIV; |
||
917 | if (s_1_5_cb->isChecked()) |
||
918 | t_Set.ExtraConfig = t_Set.ExtraConfig | CFG_SENSITIVE_RC; |
||
919 | if (s_1_6_cb->isChecked()) |
||
920 | t_Set.GlobalConfig = t_Set.GlobalConfig | CFG_ACHSENKOPPLUNG_AKTIV; |
||
921 | if (s_1_7_cb->isChecked()) |
||
922 | t_Set.GlobalConfig = t_Set.GlobalConfig | CFG_DREHRATEN_BEGRENZER; |
||
923 | if (s_1_8_cb->isChecked()) |
||
924 | t_Set.GlobalConfig = t_Set.GlobalConfig | CFG_HEADING_HOLD; |
||
925 | } |
||
926 | // Seite 2 |
||
927 | { |
||
750 | KeyOz | 928 | t_Set.Kanalbelegung[2] = cb_2_1->currentIndex() + 1; |
929 | t_Set.Kanalbelegung[3] = cb_2_2->currentIndex() + 1; |
||
930 | t_Set.Kanalbelegung[0] = cb_2_3->currentIndex() + 1; |
||
931 | t_Set.Kanalbelegung[1] = cb_2_4->currentIndex() + 1; |
||
932 | t_Set.Kanalbelegung[4] = cb_2_5->currentIndex() + 1; |
||
933 | t_Set.Kanalbelegung[5] = cb_2_6->currentIndex() + 1; |
||
934 | t_Set.Kanalbelegung[6] = cb_2_7->currentIndex() + 1; |
||
935 | t_Set.Kanalbelegung[7] = cb_2_8->currentIndex() + 1; |
||
936 | t_Set.Kanalbelegung[8] = cb_2_9->currentIndex() + 1; |
||
937 | t_Set.Kanalbelegung[9] = cb_2_10->currentIndex() + 1; |
||
938 | t_Set.Kanalbelegung[10] = cb_2_11->currentIndex() + 1; |
||
939 | t_Set.Kanalbelegung[11] = cb_2_12->currentIndex() + 1; |
||
940 | t_Set.Receiver = s_2_13_cb->currentIndex(); |
||
674 | KeyOz | 941 | } |
942 | // Seite 3 |
||
943 | { |
||
944 | t_Set.Stick_P = sb_3_1->value(); |
||
945 | t_Set.Stick_D = sb_3_2->value(); |
||
946 | t_Set.Gier_P = get_Value(cb_3_3); |
||
947 | t_Set.ExternalControl = get_Value(cb_3_4); |
||
948 | } |
||
949 | // Seite 4 |
||
950 | { |
||
951 | t_Set.MaxHoehe = get_Value(cb_4_1); |
||
952 | t_Set.Hoehe_MinGas = sb_4_2->value(); |
||
953 | t_Set.Hoehe_P = get_Value(cb_4_3); |
||
954 | t_Set.Luftdruck_D = get_Value(cb_4_4); |
||
955 | t_Set.Hoehe_ACC_Wirkung = get_Value(cb_4_5); |
||
956 | t_Set.Hoehe_Verstaerkung = sb_4_6->value(); |
||
957 | t_Set.Hoehe_HoverBand = sb_4_7->value(); |
||
958 | t_Set.Hoehe_GPS_Z = get_Value(cb_4_8); |
||
959 | t_Set.Hoehe_StickNeutralPoint = sb_4_9->value(); |
||
960 | |||
961 | if (s_4_2_rb->isChecked()) |
||
962 | t_Set.ExtraConfig = t_Set.ExtraConfig | CFG2_HEIGHT_LIMIT; |
||
963 | if (s_4_4_cb->isChecked()) |
||
964 | t_Set.GlobalConfig = t_Set.GlobalConfig | CFG_HOEHEN_SCHALTER; |
||
965 | if (s_4_5_cb->isChecked()) |
||
966 | t_Set.ExtraConfig = t_Set.ExtraConfig | CFG2_VARIO_BEEP; |
||
967 | } |
||
968 | // Seite 5 |
||
969 | { |
||
970 | t_Set.Gyro_P = get_Value(cb_5_1); |
||
971 | t_Set.Gyro_I = get_Value(cb_5_2); |
||
972 | t_Set.Gyro_D = get_Value(cb_5_8); |
||
973 | t_Set.DynamicStability = get_Value(cb_5_3); |
||
974 | t_Set.GyroAccFaktor = sb_5_4->value(); |
||
975 | t_Set.GyroAccAbgleich = sb_5_5->value(); |
||
976 | t_Set.I_Faktor = get_Value(cb_5_6); |
||
977 | t_Set.Driftkomp = sb_5_7->value(); |
||
978 | t_Set.Gyro_Gier_P = get_Value(cb_5_9); |
||
979 | t_Set.Gyro_Gier_I = get_Value(cb_5_10); |
||
980 | } |
||
981 | // Seite 6 |
||
982 | { |
||
983 | t_Set.ServoNickControl = get_Value(cb_6_1); |
||
984 | t_Set.ServoNickComp = sb_6_2->value(); |
||
985 | t_Set.ServoNickMin = sb_6_3->value(); |
||
986 | t_Set.ServoNickMax = sb_6_4->value(); |
||
987 | |||
988 | t_Set.ServoRollControl = get_Value(cb_6_7); |
||
989 | t_Set.ServoRollComp = sb_6_8->value(); |
||
990 | t_Set.ServoRollMin = sb_6_10->value(); |
||
991 | t_Set.ServoRollMax = sb_6_11->value(); |
||
992 | |||
993 | t_Set.ServoNickRefresh = sb_6_5->value(); |
||
994 | |||
750 | KeyOz | 995 | t_Set.Servo3 = get_Value(cb_6_12); |
996 | t_Set.Servo4 = get_Value(cb_6_13); |
||
997 | t_Set.Servo5 = get_Value(cb_6_14); |
||
998 | |||
674 | KeyOz | 999 | if (cb_6_6->isChecked()) |
1000 | t_Set.ServoCompInvert = t_Set.ServoCompInvert | 0x01; |
||
1001 | if (cb_6_9->isChecked()) |
||
1002 | t_Set.ServoCompInvert = t_Set.ServoCompInvert | 0x02; |
||
1003 | } |
||
1004 | // Seite 7 |
||
1005 | { |
||
1006 | t_Set.Gas_Min = sb_7_1->value(); |
||
1007 | t_Set.Gas_Max = sb_7_2->value(); |
||
1008 | t_Set.KompassWirkung = get_Value(cb_7_3); |
||
1009 | t_Set.UnterspannungsWarnung = sb_7_4->value(); |
||
1010 | t_Set.NotGasZeit = sb_7_5->value(); |
||
1011 | t_Set.NotGas = sb_7_6->value(); |
||
1012 | } |
||
1013 | // Seite 8 |
||
1014 | { |
||
1015 | t_Set.AchsKopplung1 = get_Value(cb_8_1); |
||
1016 | t_Set.AchsKopplung2 = get_Value(cb_8_2); |
||
1017 | t_Set.CouplingYawCorrection = get_Value(cb_8_3); |
||
1018 | } |
||
1019 | // Seite 9 |
||
1020 | { |
||
1021 | t_Set.BitConfig = 0; |
||
1022 | if (tb_9_6->text() == QString("1")) |
||
1023 | t_Set.BitConfig = t_Set.BitConfig | 0x01; |
||
1024 | if (tb_9_7->text() == QString("1")) |
||
1025 | t_Set.BitConfig = t_Set.BitConfig | 0x02; |
||
1026 | if (tb_9_8->text() == QString("1")) |
||
1027 | t_Set.BitConfig = t_Set.BitConfig | 0x04; |
||
1028 | if (tb_9_9->text() == QString("1")) |
||
1029 | t_Set.BitConfig = t_Set.BitConfig | 0x08; |
||
1030 | |||
1031 | |||
1032 | t_Set.LoopGasLimit = get_Value(cb_9_1); |
||
1033 | t_Set.LoopThreshold = sb_9_2->value(); |
||
1034 | t_Set.WinkelUmschlagNick = sb_9_3->value(); |
||
1035 | t_Set.LoopHysterese = sb_9_4->value(); |
||
1036 | t_Set.WinkelUmschlagRoll = sb_9_5->value(); |
||
1037 | } |
||
1038 | // Seite 10 |
||
1039 | { |
||
1040 | t_Set.UserParam1 = get_Value(cb_10_1); |
||
1041 | t_Set.UserParam2 = get_Value(cb_10_2); |
||
1042 | t_Set.UserParam3 = get_Value(cb_10_3); |
||
1043 | t_Set.UserParam4 = get_Value(cb_10_4); |
||
1044 | t_Set.UserParam5 = get_Value(cb_10_5); |
||
1045 | t_Set.UserParam6 = get_Value(cb_10_6); |
||
1046 | t_Set.UserParam7 = get_Value(cb_10_7); |
||
1047 | t_Set.UserParam8 = get_Value(cb_10_8); |
||
1048 | } |
||
1049 | // Seite 11 |
||
1050 | { |
||
1051 | t_Set.J16Bitmask = sb_11_1->value(); |
||
1052 | t_Set.J16Timing = get_Value(cb_11_2); |
||
1053 | t_Set.J17Bitmask = sb_11_3->value(); |
||
1054 | t_Set.J17Timing = get_Value(cb_11_4); |
||
1055 | t_Set.WARN_J16_Bitmask = sb_11_5->value(); |
||
1056 | t_Set.WARN_J17_Bitmask = sb_11_6->value(); |
||
1057 | |||
1058 | if (cb_11_7->isChecked()) |
||
1059 | t_Set.BitConfig = t_Set.BitConfig | CFG_MOTOR_BLINK; |
||
750 | KeyOz | 1060 | |
1061 | if (!s_11_7_cb->isChecked()) |
||
1062 | t_Set.WARN_J16_Bitmask = 0; |
||
1063 | if (!s_11_8_cb->isChecked()) |
||
1064 | t_Set.WARN_J17_Bitmask = 0; |
||
1065 | |||
674 | KeyOz | 1066 | } |
1067 | // Seite 12 |
||
1068 | { |
||
1069 | t_Set.NaviGpsModeControl = get_Value(cb_12_1); |
||
1070 | t_Set.NaviGpsGain = get_Value(cb_12_2); |
||
1071 | t_Set.NaviStickThreshold = sb_12_3->value(); |
||
1072 | t_Set.NaviGpsMinSat = sb_12_4->value(); |
||
1073 | t_Set.NaviGpsP = get_Value(cb_12_5); |
||
1074 | t_Set.NaviGpsI = get_Value(cb_12_6); |
||
1075 | t_Set.NaviGpsD = get_Value(cb_12_7); |
||
1076 | t_Set.NaviGpsACC = get_Value(cb_12_8); |
||
1077 | t_Set.NaviGpsPLimit = get_Value(cb_12_9); |
||
1078 | t_Set.NaviGpsILimit = get_Value(cb_12_10); |
||
1079 | t_Set.NaviGpsDLimit = get_Value(cb_12_11); |
||
1080 | } |
||
1081 | // Seite 13 |
||
1082 | { |
||
1083 | t_Set.NaviWindCorrection = get_Value(cb_13_1); |
||
1084 | t_Set.NaviSpeedCompensation = get_Value(cb_13_2); |
||
1085 | t_Set.NaviOperatingRadius = get_Value(cb_13_3); |
||
1086 | t_Set.NaviAngleLimitation = get_Value(cb_13_4); |
||
1087 | t_Set.NaviPH_LoginTime = sb_13_5->value(); |
||
1088 | } |
||
1089 | |||
1090 | return t_Set; |
||
1091 | } |
||
1092 | |||
1093 | int dlg_Main::get_Value(QComboBox *Combo) |
||
1094 | { |
||
1095 | if (Combo->currentText() == QString("Poti 1")) |
||
750 | KeyOz | 1096 | return 255; |
674 | KeyOz | 1097 | if (Combo->currentText() == QString("Poti 2")) |
750 | KeyOz | 1098 | return 254; |
674 | KeyOz | 1099 | if (Combo->currentText() == QString("Poti 3")) |
1100 | return 253; |
||
1101 | if (Combo->currentText() == QString("Poti 4")) |
||
750 | KeyOz | 1102 | return 252; |
1103 | if (Combo->currentText() == QString("Poti 5")) |
||
1104 | return 251; |
||
1105 | if (Combo->currentText() == QString("Poti 6")) |
||
1106 | return 250; |
||
1107 | if (Combo->currentText() == QString("Poti 7")) |
||
1108 | return 249; |
||
1109 | if (Combo->currentText() == QString("Poti 8")) |
||
1110 | return 248; |
||
674 | KeyOz | 1111 | return Combo->currentText().toInt(); |
1112 | } |
||
1113 | |||
1114 | QComboBox *dlg_Main::setCombo(QComboBox *Combo, int Wert) |
||
1115 | { |
||
750 | KeyOz | 1116 | if (Wert <= 245) |
674 | KeyOz | 1117 | { |
750 | KeyOz | 1118 | Combo->setItemText(8, QString("%1").arg(Wert)); |
1119 | Combo->setCurrentIndex(8); |
||
674 | KeyOz | 1120 | } |
1121 | else |
||
1122 | { |
||
750 | KeyOz | 1123 | Combo->setCurrentIndex(255 - Wert); |
674 | KeyOz | 1124 | } |
1125 | return Combo; |
||
1126 | } |
||
1127 | |||
1128 | void dlg_Main::set_LED(QToolButton *ToolButton, bool On) |
||
1129 | { |
||
1130 | QIcon Icons[2] ; |
||
1131 | Icons[0].addPixmap(QPixmap(QString::fromUtf8(":/Flags/Global/Images/Actions/LED_Off.png")), QIcon::Normal, QIcon::Off); |
||
1132 | Icons[1].addPixmap(QPixmap(QString::fromUtf8(":/Flags/Global/Images/Actions/LED_Red.png")), QIcon::Normal, QIcon::Off); |
||
1133 | |||
1134 | if (ToolButton->text() == QString("0") && On) |
||
1135 | { |
||
1136 | ToolButton->setIcon(Icons[1]); |
||
1137 | ToolButton->setText("1"); |
||
1138 | } |
||
1139 | else if (ToolButton->text() == QString("1") && !On) |
||
1140 | { |
||
1141 | ToolButton->setIcon(Icons[0]); |
||
1142 | ToolButton->setText("0"); |
||
1143 | } |
||
1144 | else if (ToolButton->text() == QString("00") && On) |
||
1145 | { |
||
1146 | ToolButton->setIcon(Icons[1]); |
||
1147 | ToolButton->setText("11"); |
||
1148 | } |
||
1149 | else if (ToolButton->text() == QString("11") && !On) |
||
1150 | { |
||
1151 | ToolButton->setIcon(Icons[0]); |
||
1152 | ToolButton->setText("00"); |
||
1153 | } |
||
1154 | else if (ToolButton->text() == QString("000") && On) |
||
1155 | { |
||
1156 | ToolButton->setIcon(Icons[1]); |
||
1157 | ToolButton->setText("111"); |
||
1158 | } |
||
1159 | else if (ToolButton->text() == QString("111") && !On) |
||
1160 | { |
||
1161 | ToolButton->setIcon(Icons[0]); |
||
1162 | ToolButton->setText("000"); |
||
1163 | } |
||
1164 | else if (ToolButton->text() == QString("0000") && On) |
||
1165 | { |
||
1166 | ToolButton->setIcon(Icons[1]); |
||
1167 | ToolButton->setText("1111"); |
||
1168 | } |
||
1169 | else if (ToolButton->text() == QString("1111") && !On) |
||
1170 | { |
||
1171 | ToolButton->setIcon(Icons[0]); |
||
1172 | ToolButton->setText("0000"); |
||
1173 | } |
||
1174 | } |
||
1175 | |||
1176 | void dlg_Main::slot_LEDtoValue() |
||
1177 | { |
||
1178 | QToolButton *ToolButton = (QToolButton*)sender(); |
||
1179 | |||
1180 | if (ToolButton->text() == QString("0")) |
||
1181 | { |
||
1182 | set_LED(ToolButton, true); |
||
1183 | sb_11_1->setValue(sb_11_1->value() + ToolButton->toolTip().toInt()); |
||
1184 | } |
||
1185 | else if (ToolButton->text() == QString("1")) |
||
1186 | { |
||
1187 | set_LED(ToolButton); |
||
1188 | sb_11_1->setValue(sb_11_1->value() - ToolButton->toolTip().toInt()); |
||
1189 | } |
||
1190 | |||
1191 | else if (ToolButton->text() == QString("00")) |
||
1192 | { |
||
1193 | set_LED(ToolButton, true); |
||
1194 | sb_11_3->setValue(sb_11_3->value() + ToolButton->toolTip().toInt()); |
||
1195 | } |
||
1196 | else if (ToolButton->text() == QString("11")) |
||
1197 | { |
||
1198 | set_LED(ToolButton); |
||
1199 | sb_11_3->setValue(sb_11_3->value() - ToolButton->toolTip().toInt()); |
||
1200 | } |
||
1201 | |||
1202 | else if (ToolButton->text() == QString("000")) |
||
1203 | { |
||
1204 | set_LED(ToolButton, true); |
||
1205 | sb_11_5->setValue(sb_11_5->value() + ToolButton->toolTip().toInt()); |
||
1206 | } |
||
1207 | else if (ToolButton->text() == QString("111")) |
||
1208 | { |
||
1209 | set_LED(ToolButton); |
||
1210 | sb_11_5->setValue(sb_11_5->value() - ToolButton->toolTip().toInt()); |
||
1211 | } |
||
1212 | |||
1213 | else if (ToolButton->text() == QString("0000")) |
||
1214 | { |
||
1215 | set_LED(ToolButton, true); |
||
1216 | sb_11_6->setValue(sb_11_6->value() + ToolButton->toolTip().toInt()); |
||
1217 | } |
||
1218 | else if (ToolButton->text() == QString("1111")) |
||
1219 | { |
||
1220 | set_LED(ToolButton); |
||
1221 | sb_11_6->setValue(sb_11_6->value() - ToolButton->toolTip().toInt()); |
||
1222 | } |
||
1223 | |||
1224 | |||
1225 | } |
||
1226 | |||
1227 | void dlg_Main::slot_ValuetoLED16(int Wert) |
||
1228 | { |
||
1229 | set_LED(J16_0, Wert & 0x80); |
||
1230 | set_LED(J16_1, Wert & 0x40); |
||
1231 | set_LED(J16_2, Wert & 0x20); |
||
1232 | set_LED(J16_3, Wert & 0x10); |
||
1233 | set_LED(J16_4, Wert & 0x08); |
||
1234 | set_LED(J16_5, Wert & 0x04); |
||
1235 | set_LED(J16_6, Wert & 0x02); |
||
1236 | set_LED(J16_7, Wert & 0x01); |
||
1237 | } |
||
1238 | |||
1239 | void dlg_Main::slot_ValuetoLED17(int Wert) |
||
1240 | { |
||
1241 | set_LED(J17_0, Wert & 0x80); |
||
1242 | set_LED(J17_1, Wert & 0x40); |
||
1243 | set_LED(J17_2, Wert & 0x20); |
||
1244 | set_LED(J17_3, Wert & 0x10); |
||
1245 | set_LED(J17_4, Wert & 0x08); |
||
1246 | set_LED(J17_5, Wert & 0x04); |
||
1247 | set_LED(J17_6, Wert & 0x02); |
||
1248 | set_LED(J17_7, Wert & 0x01); |
||
1249 | } |
||
1250 | |||
1251 | void dlg_Main::slot_ValuetoLED16A(int Wert) |
||
1252 | { |
||
1253 | set_LED(J16_A_0, Wert & 0x80); |
||
1254 | set_LED(J16_A_1, Wert & 0x40); |
||
1255 | set_LED(J16_A_2, Wert & 0x20); |
||
1256 | set_LED(J16_A_3, Wert & 0x10); |
||
1257 | set_LED(J16_A_4, Wert & 0x08); |
||
1258 | set_LED(J16_A_5, Wert & 0x04); |
||
1259 | set_LED(J16_A_6, Wert & 0x02); |
||
1260 | set_LED(J16_A_7, Wert & 0x01); |
||
1261 | } |
||
1262 | |||
1263 | void dlg_Main::slot_ValuetoLED17A(int Wert) |
||
1264 | { |
||
1265 | set_LED(J17_A_0, Wert & 0x80); |
||
1266 | set_LED(J17_A_1, Wert & 0x40); |
||
1267 | set_LED(J17_A_2, Wert & 0x20); |
||
1268 | set_LED(J17_A_3, Wert & 0x10); |
||
1269 | set_LED(J17_A_4, Wert & 0x08); |
||
1270 | set_LED(J17_A_5, Wert & 0x04); |
||
1271 | set_LED(J17_A_6, Wert & 0x02); |
||
1272 | set_LED(J17_A_7, Wert & 0x01); |
||
1273 | } |
||
1274 | |||
1275 | void dlg_Main::slot_tbUp() |
||
1276 | { |
||
1277 | if (tb_9_6->text() == QString("0")) |
||
1278 | { |
||
1279 | tb_9_6->setText("1"); |
||
1280 | } |
||
1281 | else |
||
1282 | { |
||
1283 | tb_9_6->setText("0"); |
||
1284 | } |
||
1285 | } |
||
1286 | |||
1287 | void dlg_Main::slot_tbDown() |
||
1288 | { |
||
1289 | if (tb_9_7->text() == QString("0")) |
||
1290 | { |
||
1291 | tb_9_7->setText("1"); |
||
1292 | } |
||
1293 | else |
||
1294 | { |
||
1295 | tb_9_7->setText("0"); |
||
1296 | } |
||
1297 | } |
||
1298 | |||
1299 | void dlg_Main::slot_tbLeft() |
||
1300 | { |
||
1301 | if (tb_9_8->text() == QString("0")) |
||
1302 | { |
||
1303 | tb_9_8->setText("1"); |
||
1304 | } |
||
1305 | else |
||
1306 | { |
||
1307 | tb_9_8->setText("0"); |
||
1308 | } |
||
1309 | } |
||
1310 | |||
1311 | void dlg_Main::slot_tbRight() |
||
1312 | { |
||
1313 | if (tb_9_9->text() == QString("0")) |
||
1314 | { |
||
1315 | tb_9_9->setText("1"); |
||
1316 | } |
||
1317 | else |
||
1318 | { |
||
1319 | tb_9_9->setText("0"); |
||
1320 | } |
||
1321 | } |
||
1322 | |||
1323 | // Programm Ende |
||
1324 | dlg_Main::~dlg_Main() |
||
1325 | { |
||
1326 | o_Settings->GUI.isMax = isMaximized(); |
||
1327 | o_Settings->GUI.Size = size(); |
||
1328 | o_Settings->GUI.Point = pos(); |
||
750 | KeyOz | 1329 | o_Settings->GUI.Toolbar = ac_Toolbar->isChecked(); |
674 | KeyOz | 1330 | |
1331 | o_Settings->write_Settings(); |
||
1332 | // qDebug("Ende."); |
||
1333 | } |