Rev 750 | 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 | { |
801 | - | 228 | if (ps_MK_Settings.Revision == 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()); |
||
801 | - | 381 | Setting.setValue("IniVersion", 4); |
674 | KeyOz | 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); |
||
801 | - | 431 | Setting.setValue("Stability", t_Set.Gyro_Stability); |
674 | KeyOz | 432 | Setting.setValue("Main-I", t_Set.I_Faktor); |
433 | Setting.endGroup(); |
||
434 | |||
435 | Setting.beginGroup("Camera"); |
||
436 | Setting.setValue("ServoNickControl", t_Set.ServoNickControl); |
||
437 | Setting.setValue("ServoNickCompensation", t_Set.ServoNickComp); |
||
438 | Setting.setValue("ServoNickMin", t_Set.ServoNickMin); |
||
439 | Setting.setValue("ServoNickMax", t_Set.ServoNickMax); |
||
440 | |||
441 | Setting.setValue("ServoRollControl", t_Set.ServoRollControl); |
||
442 | Setting.setValue("ServoRollCompensation", t_Set.ServoRollComp); |
||
443 | Setting.setValue("ServoRollMin", t_Set.ServoRollMin); |
||
444 | Setting.setValue("ServoRollMax", t_Set.ServoRollMax); |
||
445 | |||
446 | Setting.setValue("ServoInvert", t_Set.ServoCompInvert); |
||
447 | Setting.setValue("ServoNickRefreshRate", t_Set.ServoNickRefresh); |
||
750 | KeyOz | 448 | |
449 | Setting.setValue("Servo3", t_Set.Servo3); |
||
450 | Setting.setValue("Servo4", t_Set.Servo4); |
||
451 | Setting.setValue("Servo5", t_Set.Servo5); |
||
674 | KeyOz | 452 | Setting.endGroup(); |
453 | |||
454 | Setting.beginGroup("Others"); |
||
801 | - | 455 | Setting.setValue("MinGas", t_Set.Gas_Min); |
456 | Setting.setValue("MaxGas", t_Set.Gas_Max); |
||
457 | Setting.setValue("Compass-Effect", t_Set.KompassWirkung); |
||
458 | Setting.setValue("UnderVoltage", t_Set.UnterspannungsWarnung); |
||
459 | Setting.setValue("NotGas", t_Set.NotGas); |
||
460 | Setting.setValue("NotGasTime", t_Set.NotGasZeit); |
||
461 | Setting.setValue("Orientation", t_Set.OrientationAngle); |
||
462 | Setting.setValue("CarefreeControl", t_Set.OrientationModeControl); |
||
674 | KeyOz | 463 | Setting.endGroup(); |
464 | |||
465 | Setting.beginGroup("Coupling"); |
||
466 | Setting.setValue("YawPosFeedback", t_Set.AchsKopplung1); |
||
467 | Setting.setValue("NickRollFeedback", t_Set.AchsKopplung2); |
||
468 | Setting.setValue("YawCorrection", t_Set.CouplingYawCorrection); |
||
469 | Setting.endGroup(); |
||
470 | |||
471 | Setting.beginGroup("Loop"); |
||
472 | Setting.setValue("Config", t_Set.BitConfig); |
||
473 | Setting.setValue("GasLimit", t_Set.LoopGasLimit); |
||
474 | Setting.setValue("StickThreshold", t_Set.LoopThreshold); |
||
475 | Setting.setValue("LoopHysteresis", t_Set.LoopHysterese); |
||
476 | Setting.setValue("TurnOverNick", t_Set.WinkelUmschlagNick); |
||
477 | Setting.setValue("TurnOverRoll", t_Set.WinkelUmschlagRoll); |
||
711 | KeyOz | 478 | Setting.endGroup(); |
674 | KeyOz | 479 | |
480 | Setting.beginGroup("User"); |
||
481 | Setting.setValue("Parameter_1", t_Set.UserParam1); |
||
482 | Setting.setValue("Parameter_2", t_Set.UserParam2); |
||
483 | Setting.setValue("Parameter_3", t_Set.UserParam3); |
||
484 | Setting.setValue("Parameter_4", t_Set.UserParam4); |
||
485 | Setting.setValue("Parameter_5", t_Set.UserParam5); |
||
486 | Setting.setValue("Parameter_6", t_Set.UserParam6); |
||
487 | Setting.setValue("Parameter_7", t_Set.UserParam7); |
||
488 | Setting.setValue("Parameter_8", t_Set.UserParam8); |
||
489 | Setting.endGroup(); |
||
490 | |||
491 | Setting.beginGroup("Output"); |
||
492 | Setting.setValue("J16_Bitmask", t_Set.J16Bitmask); |
||
493 | Setting.setValue("J16_Timing", t_Set.J16Timing); |
||
494 | Setting.setValue("J17_Bitmask", t_Set.J17Bitmask); |
||
495 | Setting.setValue("J17_Timing", t_Set.J17Timing); |
||
496 | Setting.setValue("WARN_J16_Bitmask", t_Set.WARN_J16_Bitmask); |
||
497 | Setting.setValue("WARN_J17_Bitmask", t_Set.WARN_J17_Bitmask); |
||
498 | Setting.endGroup(); |
||
499 | |||
500 | Setting.beginGroup("NaviCtrl"); |
||
501 | Setting.setValue("GPS_ModeControl", t_Set.NaviGpsModeControl); |
||
502 | Setting.setValue("GPS_Gain", t_Set.NaviGpsGain); |
||
503 | Setting.setValue("GPS_P", t_Set.NaviGpsP); |
||
504 | Setting.setValue("GPS_I", t_Set.NaviGpsI); |
||
505 | Setting.setValue("GPS_D", t_Set.NaviGpsD); |
||
506 | Setting.setValue("GPS_P_Limit", t_Set.NaviGpsPLimit); |
||
507 | Setting.setValue("GPS_I_Limit", t_Set.NaviGpsILimit); |
||
508 | Setting.setValue("GPS_D_Limit", t_Set.NaviGpsDLimit); |
||
509 | Setting.setValue("GPS_Acc", t_Set.NaviGpsACC); |
||
510 | Setting.setValue("GPS_MinSat", t_Set.NaviGpsMinSat); |
||
511 | Setting.setValue("GPS_StickThreshold", t_Set.NaviStickThreshold); |
||
512 | Setting.setValue("GPS_WindCorrection", t_Set.NaviWindCorrection); |
||
513 | Setting.setValue("GPS_SpeedCompensation", t_Set.NaviSpeedCompensation); |
||
514 | Setting.setValue("GPS_MaxRadius", t_Set.NaviOperatingRadius); |
||
515 | Setting.setValue("GPS_AngleLimit", t_Set.NaviAngleLimitation); |
||
516 | Setting.setValue("GPS_PH_Login_Time", t_Set.NaviPH_LoginTime); |
||
517 | Setting.endGroup(); |
||
518 | } |
||
519 | } |
||
520 | |||
521 | void dlg_Main::slot_ac_Load() |
||
522 | { |
||
523 | QString Filename = QFileDialog::getOpenFileName(this, "Mikrokopter Parameter laden", s_Dir.Settings + "", "Mikrokopter Parameter(*.mkp);;Alle Dateien (*)"); |
||
524 | |||
525 | if (!Filename.isEmpty()) |
||
526 | { |
||
527 | s_MK_Settings t_Set = get_MK_Settings(); |
||
528 | |||
529 | t_Set.Index = sb_Set->value(); |
||
530 | |||
531 | QSettings Setting(Filename, QSettings::IniFormat); |
||
532 | |||
533 | Setting.beginGroup("Setup"); |
||
534 | QString Name = Setting.value("Name", QString("--noname--")).toString(); |
||
535 | |||
536 | memcpy(t_Set.Name, Name.toLatin1().data(), 12); |
||
537 | |||
538 | t_Set.GlobalConfig = Setting.value("GlobalConfig", 104).toInt(); |
||
539 | t_Set.ExtraConfig = Setting.value("GlobalConfig2", 1).toInt(); |
||
540 | Setting.endGroup(); |
||
541 | |||
542 | Setting.beginGroup("Channels"); |
||
543 | t_Set.Kanalbelegung[0] = Setting.value("Nick", 1).toInt(); |
||
544 | t_Set.Kanalbelegung[1] = Setting.value("Roll", 2).toInt(); |
||
545 | t_Set.Kanalbelegung[2] = Setting.value("Gas", 3).toInt(); |
||
546 | t_Set.Kanalbelegung[3] = Setting.value("Gier", 4).toInt(); |
||
547 | t_Set.Kanalbelegung[4] = Setting.value("Poti_1", 5).toInt(); |
||
548 | t_Set.Kanalbelegung[5] = Setting.value("Poti_2", 6).toInt(); |
||
549 | t_Set.Kanalbelegung[6] = Setting.value("Poti_3", 7).toInt(); |
||
550 | t_Set.Kanalbelegung[7] = Setting.value("Poti_4", 8).toInt(); |
||
750 | KeyOz | 551 | t_Set.Kanalbelegung[8] = Setting.value("Poti_5", 9).toInt(); |
552 | t_Set.Kanalbelegung[9] = Setting.value("Poti_6", 10).toInt(); |
||
553 | t_Set.Kanalbelegung[10] = Setting.value("Poti_7", 11).toInt(); |
||
554 | t_Set.Kanalbelegung[11] = Setting.value("Poti_8", 12).toInt(); |
||
555 | t_Set.Receiver = Setting.value("Receiver", 0).toInt(); |
||
674 | KeyOz | 556 | Setting.endGroup(); |
557 | |||
558 | Setting.beginGroup("Stick"); |
||
559 | t_Set.Stick_P = Setting.value("Nick_Roll-P", 10).toInt(); |
||
560 | t_Set.Stick_D = Setting.value("Nick_Roll-D", 16).toInt(); |
||
561 | t_Set.Gier_P = Setting.value("Gier-P", 6).toInt(); |
||
562 | t_Set.ExternalControl = Setting.value("ExternalControl", 0).toInt(); |
||
563 | Setting.endGroup(); |
||
564 | |||
565 | Setting.beginGroup("Altitude"); |
||
566 | t_Set.MaxHoehe = Setting.value("Setpoint", 251).toInt(); |
||
567 | t_Set.Hoehe_MinGas = Setting.value("MinGas", 30).toInt(); |
||
568 | t_Set.Hoehe_P = Setting.value("P", 10).toInt(); |
||
569 | t_Set.Luftdruck_D = Setting.value("Barometric-D", 30).toInt(); |
||
570 | t_Set.Hoehe_ACC_Wirkung = Setting.value("Z-ACC-Effect", 30).toInt(); |
||
571 | t_Set.Hoehe_Verstaerkung = Setting.value("Gain", 15).toInt(); |
||
572 | t_Set.Hoehe_HoverBand = Setting.value("HoverVariation", 5).toInt(); |
||
573 | t_Set.Hoehe_GPS_Z = Setting.value("GPS_Z", 64).toInt(); |
||
574 | t_Set.Hoehe_StickNeutralPoint = Setting.value("StickNeutralPoint", 0).toInt(); |
||
575 | Setting.endGroup(); |
||
576 | |||
577 | Setting.beginGroup("Gyro"); |
||
578 | t_Set.Gyro_P = Setting.value("P", 90).toInt(); |
||
579 | t_Set.Gyro_I = Setting.value("I", 120).toInt(); |
||
580 | t_Set.Gyro_D = Setting.value("D", 3).toInt(); |
||
581 | t_Set.Gyro_Gier_P = Setting.value("Gier_P", 100).toInt(); |
||
582 | t_Set.Gyro_Gier_I = Setting.value("Gier_I", 120).toInt(); |
||
583 | t_Set.DynamicStability = Setting.value("DynamicStability", 75).toInt(); |
||
584 | t_Set.GyroAccFaktor = Setting.value("ACC_Gyro-Factor", 30).toInt(); |
||
585 | t_Set.GyroAccAbgleich = Setting.value("ACC_Gyro-Compensation", 32).toInt(); |
||
586 | t_Set.Driftkomp = Setting.value("DriftCompensation", 32).toInt(); |
||
801 | - | 587 | t_Set.Gyro_Stability = Setting.value("Stability", 4).toInt(); |
674 | KeyOz | 588 | t_Set.I_Faktor = Setting.value("Main-I", 32).toInt(); |
589 | Setting.endGroup(); |
||
590 | |||
591 | Setting.beginGroup("Camera"); |
||
592 | t_Set.ServoNickControl = Setting.value("ServoNickControl", 100).toInt(); |
||
593 | t_Set.ServoNickComp = Setting.value("ServoNickCompensation", 40).toInt(); |
||
594 | t_Set.ServoNickMin = Setting.value("ServoNickMin", 0).toInt(); |
||
595 | t_Set.ServoNickMax = Setting.value("ServoNickMax", 250).toInt(); |
||
596 | |||
597 | t_Set.ServoRollControl = Setting.value("ServoRollControl", 100).toInt(); |
||
598 | t_Set.ServoRollComp = Setting.value("ServoRollCompensation", 40).toInt(); |
||
599 | t_Set.ServoRollMin = Setting.value("ServoRollMin", 0).toInt(); |
||
600 | t_Set.ServoRollMax = Setting.value("ServoRollMax", 250).toInt(); |
||
601 | |||
602 | t_Set.ServoCompInvert = Setting.value("ServoInvert", 0).toInt(); |
||
603 | t_Set.ServoNickRefresh = Setting.value("ServoNickRefreshRate", 3).toInt(); |
||
750 | KeyOz | 604 | |
605 | t_Set.Servo3 = Setting.value("Servo3", 0).toInt(); |
||
606 | t_Set.Servo4 = Setting.value("Servo4", 0).toInt(); |
||
607 | t_Set.Servo5 = Setting.value("Servo5", 0).toInt(); |
||
674 | KeyOz | 608 | Setting.endGroup(); |
609 | |||
610 | Setting.beginGroup("Others"); |
||
801 | - | 611 | t_Set.Gas_Min = Setting.value("MinGas", 8).toInt(); |
612 | t_Set.Gas_Max = Setting.value("MaxGas", 230).toInt(); |
||
613 | t_Set.KompassWirkung = Setting.value("Compass-Effect", 128).toInt(); |
||
614 | t_Set.UnterspannungsWarnung = Setting.value("UnderVoltage", 99).toInt(); |
||
615 | t_Set.NotGas = Setting.value("NotGas", 35).toInt(); |
||
616 | t_Set.NotGasZeit = Setting.value("NotGasTime", 30).toInt(); |
||
617 | |||
618 | t_Set.OrientationAngle = Setting.value("Orientation", 0).toInt(); |
||
619 | t_Set.OrientationModeControl = Setting.value("CarefreeControl", 252).toInt(); |
||
674 | KeyOz | 620 | Setting.endGroup(); |
621 | |||
622 | Setting.beginGroup("Coupling"); |
||
623 | t_Set.AchsKopplung1 = Setting.value("YawPosFeedback", 90).toInt(); |
||
624 | t_Set.AchsKopplung2 = Setting.value("NickRollFeedback", 80).toInt(); |
||
625 | t_Set.CouplingYawCorrection = Setting.value("YawCorrection", 60).toInt(); |
||
626 | Setting.endGroup(); |
||
627 | |||
628 | Setting.beginGroup("Loop"); |
||
629 | t_Set.BitConfig = Setting.value("Config", 0).toInt(); |
||
630 | t_Set.LoopGasLimit = Setting.value("GasLimit", 50).toInt(); |
||
631 | t_Set.LoopThreshold = Setting.value("StickThreshold", 90).toInt(); |
||
632 | t_Set.LoopHysterese = Setting.value("LoopHysteresis", 50).toInt(); |
||
633 | t_Set.WinkelUmschlagNick = Setting.value("TurnOverNick", 85).toInt(); |
||
634 | t_Set.WinkelUmschlagRoll = Setting.value("TurnOverRoll", 85).toInt(); |
||
635 | Setting.endGroup(); |
||
636 | |||
637 | Setting.beginGroup("User"); |
||
638 | t_Set.UserParam1 = Setting.value("Parameter_1", 0).toInt(); |
||
639 | t_Set.UserParam2 = Setting.value("Parameter_2", 0).toInt(); |
||
640 | t_Set.UserParam3 = Setting.value("Parameter_3", 0).toInt(); |
||
641 | t_Set.UserParam4 = Setting.value("Parameter_4", 0).toInt(); |
||
642 | t_Set.UserParam5 = Setting.value("Parameter_5", 0).toInt(); |
||
643 | t_Set.UserParam6 = Setting.value("Parameter_6", 0).toInt(); |
||
644 | t_Set.UserParam7 = Setting.value("Parameter_7", 0).toInt(); |
||
645 | t_Set.UserParam8 = Setting.value("Parameter_8", 0).toInt(); |
||
646 | Setting.endGroup(); |
||
647 | |||
648 | Setting.beginGroup("Output"); |
||
649 | t_Set.J16Bitmask = Setting.value("J16_Bitmask", 255).toInt(); |
||
650 | t_Set.J16Timing = Setting.value("J16_Timing", 15).toInt(); |
||
651 | t_Set.J17Bitmask = Setting.value("J17_Bitmask", 255).toInt(); |
||
652 | t_Set.J17Timing = Setting.value("J17_Timing", 15).toInt(); |
||
653 | t_Set.WARN_J16_Bitmask = Setting.value("WARN_J16_Bitmask", 0xaa).toInt(); |
||
654 | t_Set.WARN_J17_Bitmask = Setting.value("WARN_J17_Bitmask", 0xaa).toInt(); |
||
655 | Setting.endGroup(); |
||
656 | |||
657 | Setting.beginGroup("NaviCtrl"); |
||
658 | t_Set.NaviGpsModeControl = Setting.value("GPS_ModeControl", 253).toInt(); |
||
659 | t_Set.NaviGpsGain = Setting.value("GPS_Gain", 100).toInt(); |
||
660 | t_Set.NaviGpsP = Setting.value("GPS_P", 90).toInt(); |
||
661 | t_Set.NaviGpsI = Setting.value("GPS_I", 90).toInt(); |
||
662 | t_Set.NaviGpsD = Setting.value("GPS_D", 90).toInt(); |
||
663 | t_Set.NaviGpsPLimit = Setting.value("GPS_P_Limit", 75).toInt(); |
||
664 | t_Set.NaviGpsILimit = Setting.value("GPS_I_Limit", 75).toInt(); |
||
665 | t_Set.NaviGpsDLimit = Setting.value("GPS_D_Limit", 75).toInt(); |
||
666 | t_Set.NaviGpsACC = Setting.value("GPS_Acc", 0).toInt(); |
||
667 | t_Set.NaviGpsMinSat = Setting.value("GPS_MinSat", 6).toInt(); |
||
668 | t_Set.NaviStickThreshold = Setting.value("GPS_StickThreshold", 8).toInt(); |
||
669 | t_Set.NaviWindCorrection = Setting.value("GPS_WindCorrection", 90).toInt(); |
||
670 | t_Set.NaviSpeedCompensation = Setting.value("GPS_SpeedCompensation", 30).toInt(); |
||
671 | t_Set.NaviOperatingRadius = Setting.value("GPS_MaxRadius", 100).toInt(); |
||
672 | t_Set.NaviAngleLimitation = Setting.value("GPS_AngleLimit", 100).toInt(); |
||
673 | t_Set.NaviPH_LoginTime = Setting.value("GPS_PH_Login_Time", 4).toInt(); |
||
674 | Setting.endGroup(); |
||
675 | |||
676 | show_MK_Settings(t_Set); |
||
677 | } |
||
678 | } |
||
679 | |||
801 | - | 680 | void dlg_Main::show_MK_Settings(s_MK_Settings t_Set) // DONE 0.80g |
674 | KeyOz | 681 | { |
682 | sb_Set->setValue(int(t_Set.Index)); |
||
683 | |||
684 | le_SetName->setText(QString(t_Set.Name)); |
||
801 | - | 685 | |
686 | sb_0_1->setValue(t_Set.OrientationAngle); |
||
687 | |||
674 | KeyOz | 688 | // Seite 1 |
689 | { |
||
690 | s_1_1_cb->setChecked(t_Set.GlobalConfig & CFG_HOEHENREGELUNG); |
||
691 | s_1_2_cb->setChecked(t_Set.GlobalConfig & CFG_KOMPASS_AKTIV); |
||
692 | s_1_3_cb->setChecked(t_Set.GlobalConfig & CFG_KOMPASS_FIX); |
||
693 | s_1_4_cb->setChecked(t_Set.GlobalConfig & CFG_GPS_AKTIV); |
||
694 | s_1_5_cb->setChecked(t_Set.ExtraConfig & CFG_SENSITIVE_RC); |
||
695 | s_1_6_cb->setChecked(t_Set.GlobalConfig & CFG_ACHSENKOPPLUNG_AKTIV); |
||
696 | s_1_7_cb->setChecked(t_Set.GlobalConfig & CFG_DREHRATEN_BEGRENZER); |
||
697 | s_1_8_cb->setChecked(t_Set.GlobalConfig & CFG_HEADING_HOLD); |
||
698 | } |
||
699 | // Seite 2 |
||
700 | { |
||
750 | KeyOz | 701 | cb_2_1->setCurrentIndex(t_Set.Kanalbelegung[2] - 1); |
702 | cb_2_2->setCurrentIndex(t_Set.Kanalbelegung[3] - 1); |
||
703 | cb_2_3->setCurrentIndex(t_Set.Kanalbelegung[0] - 1); |
||
704 | cb_2_4->setCurrentIndex(t_Set.Kanalbelegung[1] - 1); |
||
705 | cb_2_5->setCurrentIndex(t_Set.Kanalbelegung[4] - 1); |
||
706 | cb_2_6->setCurrentIndex(t_Set.Kanalbelegung[5] - 1); |
||
707 | cb_2_7->setCurrentIndex(t_Set.Kanalbelegung[6] - 1); |
||
708 | cb_2_8->setCurrentIndex(t_Set.Kanalbelegung[7] - 1); |
||
709 | cb_2_9->setCurrentIndex(t_Set.Kanalbelegung[8] - 1); |
||
710 | cb_2_10->setCurrentIndex(t_Set.Kanalbelegung[9] - 1); |
||
711 | cb_2_11->setCurrentIndex(t_Set.Kanalbelegung[10] - 1); |
||
712 | cb_2_12->setCurrentIndex(t_Set.Kanalbelegung[11] - 1); |
||
713 | s_2_13_cb->setCurrentIndex(t_Set.Receiver); |
||
674 | KeyOz | 714 | } |
715 | // Seite 3 |
||
716 | { |
||
717 | sb_3_1->setValue(t_Set.Stick_P); |
||
718 | sb_3_2->setValue(t_Set.Stick_D); |
||
719 | cb_3_3 = setCombo(cb_3_3, t_Set.Gier_P); |
||
720 | cb_3_4 = setCombo(cb_3_4, t_Set.ExternalControl); |
||
721 | } |
||
722 | // Seite 4 |
||
723 | { |
||
750 | KeyOz | 724 | // s_4_2_rb->setChecked(t_Set.ExtraConfig & CFG2_HEIGHT_LIMIT); |
725 | |||
726 | if (t_Set.ExtraConfig & CFG2_HEIGHT_LIMIT) |
||
727 | { |
||
728 | s_4_2_rb->setChecked(true); |
||
722 | tempolo | 729 | } |
750 | KeyOz | 730 | else |
731 | { |
||
732 | s_4_3_rb->setChecked(true); |
||
733 | } |
||
734 | |||
674 | KeyOz | 735 | s_4_5_cb->setChecked(t_Set.ExtraConfig & CFG2_VARIO_BEEP); |
736 | s_4_4_cb->setChecked(t_Set.GlobalConfig & CFG_HOEHEN_SCHALTER); |
||
737 | |||
738 | cb_4_1 = setCombo(cb_4_1, t_Set.MaxHoehe); |
||
739 | sb_4_2->setValue(t_Set.Hoehe_MinGas); |
||
740 | cb_4_3 = setCombo(cb_4_3, t_Set.Hoehe_P); |
||
741 | cb_4_4 = setCombo(cb_4_4, t_Set.Luftdruck_D); |
||
742 | cb_4_5 = setCombo(cb_4_5, t_Set.Hoehe_ACC_Wirkung); |
||
743 | sb_4_6->setValue(t_Set.Hoehe_Verstaerkung); |
||
744 | sb_4_7->setValue(t_Set.Hoehe_HoverBand); |
||
745 | cb_4_8 = setCombo(cb_4_8, t_Set.Hoehe_GPS_Z); |
||
746 | sb_4_9->setValue(t_Set.Hoehe_StickNeutralPoint); |
||
747 | } |
||
748 | // Seite 5 |
||
749 | { |
||
750 | cb_5_1 = setCombo(cb_5_1, t_Set.Gyro_P); |
||
751 | cb_5_2 = setCombo(cb_5_2, t_Set.Gyro_I); |
||
752 | cb_5_8 = setCombo(cb_5_8, t_Set.Gyro_D); |
||
753 | cb_5_3 = setCombo(cb_5_3, t_Set.DynamicStability); |
||
754 | sb_5_4->setValue(t_Set.GyroAccFaktor); |
||
755 | sb_5_5->setValue(t_Set.GyroAccAbgleich); |
||
756 | cb_5_6 = setCombo(cb_5_6, t_Set.I_Faktor); |
||
757 | sb_5_7->setValue(t_Set.Driftkomp); |
||
758 | cb_5_9 = setCombo(cb_5_9, t_Set.Gyro_Gier_P); |
||
759 | cb_5_10 = setCombo(cb_5_10, t_Set.Gyro_Gier_I); |
||
801 | - | 760 | cb_5_11 = setCombo(cb_5_11, t_Set.Gyro_Stability); |
674 | KeyOz | 761 | } |
762 | // Seite 6 |
||
763 | { |
||
764 | cb_6_1 = setCombo(cb_6_1, t_Set.ServoNickControl); |
||
765 | sb_6_2->setValue(t_Set.ServoNickComp); |
||
766 | sb_6_3->setValue(t_Set.ServoNickMin); |
||
767 | sb_6_4->setValue(t_Set.ServoNickMax); |
||
768 | |||
769 | cb_6_7 = setCombo(cb_6_7, t_Set.ServoRollControl); |
||
770 | sb_6_8->setValue(t_Set.ServoRollComp); |
||
771 | sb_6_10->setValue(t_Set.ServoRollMin); |
||
772 | sb_6_11->setValue(t_Set.ServoRollMax); |
||
773 | |||
774 | cb_6_6->setChecked(t_Set.ServoCompInvert & 0x01); |
||
775 | cb_6_9->setChecked(t_Set.ServoCompInvert & 0x02); |
||
776 | |||
777 | sb_6_5->setValue(t_Set.ServoNickRefresh); |
||
750 | KeyOz | 778 | |
779 | cb_6_12 = setCombo(cb_6_12, t_Set.Servo3); |
||
780 | cb_6_13 = setCombo(cb_6_13, t_Set.Servo4); |
||
781 | cb_6_14 = setCombo(cb_6_14, t_Set.Servo5); |
||
782 | |||
674 | KeyOz | 783 | } |
784 | // Seite 7 |
||
785 | { |
||
786 | sb_7_1->setValue(t_Set.Gas_Min); |
||
787 | sb_7_2->setValue(t_Set.Gas_Max); |
||
788 | cb_7_3 = setCombo(cb_7_3, t_Set.KompassWirkung); |
||
789 | sb_7_4->setValue(t_Set.UnterspannungsWarnung); |
||
790 | sb_7_5->setValue(t_Set.NotGasZeit); |
||
791 | sb_7_6->setValue(t_Set.NotGas); |
||
801 | - | 792 | cb_7_7 = setCombo(cb_7_7, t_Set.OrientationModeControl); |
793 | |||
674 | KeyOz | 794 | } |
795 | // Seite 8 |
||
796 | { |
||
797 | cb_8_1 = setCombo(cb_8_1, t_Set.AchsKopplung1); |
||
798 | cb_8_2 = setCombo(cb_8_2, t_Set.AchsKopplung2); |
||
799 | cb_8_3 = setCombo(cb_8_3, t_Set.CouplingYawCorrection); |
||
800 | } |
||
801 | // Seite 9 - Looping |
||
802 | { |
||
803 | if (t_Set.BitConfig & 0x01) |
||
804 | { |
||
805 | tb_9_6->setText("1"); |
||
806 | tb_9_6->setChecked(true); |
||
807 | } |
||
808 | else |
||
809 | { |
||
810 | tb_9_6->setText("0"); |
||
811 | tb_9_6->setChecked(false); |
||
812 | } |
||
813 | |||
814 | if (t_Set.BitConfig & 0x02) |
||
815 | { |
||
816 | tb_9_7->setText("1"); |
||
817 | tb_9_7->setChecked(true); |
||
818 | } |
||
819 | else |
||
820 | { |
||
821 | tb_9_7->setText("0"); |
||
822 | tb_9_7->setChecked(false); |
||
823 | } |
||
824 | |||
825 | if (t_Set.BitConfig & 0x04) |
||
826 | { |
||
827 | tb_9_8->setText("1"); |
||
828 | tb_9_8->setChecked(true); |
||
829 | } |
||
830 | else |
||
831 | { |
||
832 | tb_9_8->setText("0"); |
||
833 | tb_9_8->setChecked(false); |
||
834 | } |
||
835 | |||
836 | if (t_Set.BitConfig & 0x08) |
||
837 | { |
||
838 | tb_9_9->setText("1"); |
||
839 | tb_9_9->setChecked(true); |
||
840 | } |
||
841 | else |
||
842 | { |
||
843 | tb_9_9->setText("0"); |
||
844 | tb_9_9->setChecked(false); |
||
845 | } |
||
846 | |||
847 | cb_9_1 = setCombo(cb_9_1, t_Set.LoopGasLimit); |
||
848 | sb_9_2->setValue(t_Set.LoopThreshold); |
||
849 | sb_9_3->setValue(t_Set.WinkelUmschlagNick); |
||
850 | sb_9_4->setValue(t_Set.LoopHysterese); |
||
851 | sb_9_5->setValue(t_Set.WinkelUmschlagRoll); |
||
852 | |||
853 | } |
||
854 | // Seite 10 - Userparameter |
||
855 | { |
||
856 | cb_10_1 = setCombo(cb_10_1, t_Set.UserParam1); |
||
857 | cb_10_2 = setCombo(cb_10_2, t_Set.UserParam2); |
||
858 | cb_10_3 = setCombo(cb_10_3, t_Set.UserParam3); |
||
859 | cb_10_4 = setCombo(cb_10_4, t_Set.UserParam4); |
||
860 | cb_10_5 = setCombo(cb_10_5, t_Set.UserParam5); |
||
861 | cb_10_6 = setCombo(cb_10_6, t_Set.UserParam6); |
||
862 | cb_10_7 = setCombo(cb_10_7, t_Set.UserParam7); |
||
863 | cb_10_8 = setCombo(cb_10_8, t_Set.UserParam8); |
||
864 | } |
||
865 | // Seite 11 - Output |
||
866 | { |
||
867 | sb_11_1->setValue(t_Set.J16Bitmask); |
||
868 | cb_11_2 = setCombo(cb_11_2, int(t_Set.J16Timing)); |
||
869 | sb_11_3->setValue(t_Set.J17Bitmask); |
||
870 | cb_11_4 = setCombo(cb_11_4, int(t_Set.J17Timing)); |
||
871 | sb_11_5->setValue(t_Set.WARN_J16_Bitmask); |
||
872 | sb_11_6->setValue(t_Set.WARN_J17_Bitmask); |
||
873 | cb_11_7->setChecked(t_Set.BitConfig & CFG_MOTOR_BLINK); |
||
750 | KeyOz | 874 | |
875 | if (t_Set.WARN_J16_Bitmask != 0) |
||
876 | s_11_7_cb->setChecked(true); |
||
877 | else |
||
878 | s_11_7_cb->setChecked(false); |
||
879 | |||
880 | if (t_Set.WARN_J17_Bitmask != 0) |
||
881 | s_11_8_cb->setChecked(true); |
||
882 | else |
||
883 | s_11_8_cb->setChecked(false); |
||
674 | KeyOz | 884 | } |
885 | // Seite 12 |
||
886 | { |
||
887 | cb_12_1 = setCombo(cb_12_1, t_Set.NaviGpsModeControl); |
||
888 | cb_12_2 = setCombo(cb_12_2, t_Set.NaviGpsGain); |
||
889 | sb_12_3->setValue(t_Set.NaviStickThreshold); |
||
890 | sb_12_4->setValue(t_Set.NaviGpsMinSat); |
||
891 | cb_12_5 = setCombo(cb_12_5, t_Set.NaviGpsP); |
||
892 | cb_12_6 = setCombo(cb_12_6, t_Set.NaviGpsI); |
||
893 | cb_12_7 = setCombo(cb_12_7, t_Set.NaviGpsD); |
||
894 | cb_12_8 = setCombo(cb_12_8, t_Set.NaviGpsACC); |
||
895 | cb_12_9 = setCombo(cb_12_9, t_Set.NaviGpsPLimit); |
||
896 | cb_12_10 = setCombo(cb_12_10, t_Set.NaviGpsILimit); |
||
897 | cb_12_11 = setCombo(cb_12_11, t_Set.NaviGpsDLimit); |
||
898 | } |
||
899 | // Seite 13 |
||
900 | { |
||
901 | cb_13_1 = setCombo(cb_13_1, t_Set.NaviWindCorrection); |
||
902 | cb_13_2 = setCombo(cb_13_2, t_Set.NaviSpeedCompensation); |
||
903 | cb_13_3 = setCombo(cb_13_3, t_Set.NaviOperatingRadius); |
||
904 | cb_13_4 = setCombo(cb_13_4, t_Set.NaviAngleLimitation); |
||
905 | sb_13_5->setValue(t_Set.NaviPH_LoginTime); |
||
906 | } |
||
907 | } |
||
908 | |||
909 | s_MK_Settings dlg_Main::get_MK_Settings() // DONE 0.75i |
||
910 | { |
||
911 | s_MK_Settings t_Set; |
||
912 | |||
913 | memcpy(t_Set.Name, le_SetName->text().toLatin1().data(), 12); |
||
914 | t_Set.Index = sb_Set->value(); |
||
801 | - | 915 | t_Set.Revision = MK_VERSION_SETTINGS; |
674 | KeyOz | 916 | |
801 | - | 917 | t_Set.OrientationAngle = sb_0_1->value(); |
918 | |||
674 | KeyOz | 919 | // Seite 1 |
920 | { |
||
921 | t_Set.GlobalConfig = 0; |
||
922 | t_Set.ExtraConfig = 0; |
||
923 | |||
924 | if (s_1_1_cb->isChecked()) |
||
925 | t_Set.GlobalConfig = t_Set.GlobalConfig | CFG_HOEHENREGELUNG; |
||
926 | if (s_1_2_cb->isChecked()) |
||
927 | t_Set.GlobalConfig = t_Set.GlobalConfig | CFG_KOMPASS_AKTIV; |
||
928 | if (s_1_3_cb->isChecked()) |
||
929 | t_Set.GlobalConfig = t_Set.GlobalConfig | CFG_KOMPASS_FIX; |
||
930 | if (s_1_4_cb->isChecked()) |
||
931 | t_Set.GlobalConfig = t_Set.GlobalConfig | CFG_GPS_AKTIV; |
||
932 | if (s_1_5_cb->isChecked()) |
||
933 | t_Set.ExtraConfig = t_Set.ExtraConfig | CFG_SENSITIVE_RC; |
||
934 | if (s_1_6_cb->isChecked()) |
||
935 | t_Set.GlobalConfig = t_Set.GlobalConfig | CFG_ACHSENKOPPLUNG_AKTIV; |
||
936 | if (s_1_7_cb->isChecked()) |
||
937 | t_Set.GlobalConfig = t_Set.GlobalConfig | CFG_DREHRATEN_BEGRENZER; |
||
938 | if (s_1_8_cb->isChecked()) |
||
939 | t_Set.GlobalConfig = t_Set.GlobalConfig | CFG_HEADING_HOLD; |
||
940 | } |
||
941 | // Seite 2 |
||
942 | { |
||
750 | KeyOz | 943 | t_Set.Kanalbelegung[2] = cb_2_1->currentIndex() + 1; |
944 | t_Set.Kanalbelegung[3] = cb_2_2->currentIndex() + 1; |
||
945 | t_Set.Kanalbelegung[0] = cb_2_3->currentIndex() + 1; |
||
946 | t_Set.Kanalbelegung[1] = cb_2_4->currentIndex() + 1; |
||
947 | t_Set.Kanalbelegung[4] = cb_2_5->currentIndex() + 1; |
||
948 | t_Set.Kanalbelegung[5] = cb_2_6->currentIndex() + 1; |
||
949 | t_Set.Kanalbelegung[6] = cb_2_7->currentIndex() + 1; |
||
950 | t_Set.Kanalbelegung[7] = cb_2_8->currentIndex() + 1; |
||
951 | t_Set.Kanalbelegung[8] = cb_2_9->currentIndex() + 1; |
||
952 | t_Set.Kanalbelegung[9] = cb_2_10->currentIndex() + 1; |
||
953 | t_Set.Kanalbelegung[10] = cb_2_11->currentIndex() + 1; |
||
954 | t_Set.Kanalbelegung[11] = cb_2_12->currentIndex() + 1; |
||
955 | t_Set.Receiver = s_2_13_cb->currentIndex(); |
||
674 | KeyOz | 956 | } |
957 | // Seite 3 |
||
958 | { |
||
959 | t_Set.Stick_P = sb_3_1->value(); |
||
960 | t_Set.Stick_D = sb_3_2->value(); |
||
961 | t_Set.Gier_P = get_Value(cb_3_3); |
||
962 | t_Set.ExternalControl = get_Value(cb_3_4); |
||
963 | } |
||
964 | // Seite 4 |
||
965 | { |
||
966 | t_Set.MaxHoehe = get_Value(cb_4_1); |
||
967 | t_Set.Hoehe_MinGas = sb_4_2->value(); |
||
968 | t_Set.Hoehe_P = get_Value(cb_4_3); |
||
969 | t_Set.Luftdruck_D = get_Value(cb_4_4); |
||
970 | t_Set.Hoehe_ACC_Wirkung = get_Value(cb_4_5); |
||
971 | t_Set.Hoehe_Verstaerkung = sb_4_6->value(); |
||
972 | t_Set.Hoehe_HoverBand = sb_4_7->value(); |
||
973 | t_Set.Hoehe_GPS_Z = get_Value(cb_4_8); |
||
974 | t_Set.Hoehe_StickNeutralPoint = sb_4_9->value(); |
||
975 | |||
976 | if (s_4_2_rb->isChecked()) |
||
977 | t_Set.ExtraConfig = t_Set.ExtraConfig | CFG2_HEIGHT_LIMIT; |
||
978 | if (s_4_4_cb->isChecked()) |
||
979 | t_Set.GlobalConfig = t_Set.GlobalConfig | CFG_HOEHEN_SCHALTER; |
||
980 | if (s_4_5_cb->isChecked()) |
||
981 | t_Set.ExtraConfig = t_Set.ExtraConfig | CFG2_VARIO_BEEP; |
||
982 | } |
||
983 | // Seite 5 |
||
984 | { |
||
985 | t_Set.Gyro_P = get_Value(cb_5_1); |
||
986 | t_Set.Gyro_I = get_Value(cb_5_2); |
||
987 | t_Set.Gyro_D = get_Value(cb_5_8); |
||
988 | t_Set.DynamicStability = get_Value(cb_5_3); |
||
989 | t_Set.GyroAccFaktor = sb_5_4->value(); |
||
990 | t_Set.GyroAccAbgleich = sb_5_5->value(); |
||
991 | t_Set.I_Faktor = get_Value(cb_5_6); |
||
992 | t_Set.Driftkomp = sb_5_7->value(); |
||
993 | t_Set.Gyro_Gier_P = get_Value(cb_5_9); |
||
994 | t_Set.Gyro_Gier_I = get_Value(cb_5_10); |
||
801 | - | 995 | t_Set.Gyro_Stability = get_Value(cb_5_11); |
674 | KeyOz | 996 | } |
997 | // Seite 6 |
||
998 | { |
||
999 | t_Set.ServoNickControl = get_Value(cb_6_1); |
||
1000 | t_Set.ServoNickComp = sb_6_2->value(); |
||
1001 | t_Set.ServoNickMin = sb_6_3->value(); |
||
1002 | t_Set.ServoNickMax = sb_6_4->value(); |
||
1003 | |||
1004 | t_Set.ServoRollControl = get_Value(cb_6_7); |
||
1005 | t_Set.ServoRollComp = sb_6_8->value(); |
||
1006 | t_Set.ServoRollMin = sb_6_10->value(); |
||
1007 | t_Set.ServoRollMax = sb_6_11->value(); |
||
1008 | |||
1009 | t_Set.ServoNickRefresh = sb_6_5->value(); |
||
1010 | |||
750 | KeyOz | 1011 | t_Set.Servo3 = get_Value(cb_6_12); |
1012 | t_Set.Servo4 = get_Value(cb_6_13); |
||
1013 | t_Set.Servo5 = get_Value(cb_6_14); |
||
1014 | |||
674 | KeyOz | 1015 | if (cb_6_6->isChecked()) |
1016 | t_Set.ServoCompInvert = t_Set.ServoCompInvert | 0x01; |
||
1017 | if (cb_6_9->isChecked()) |
||
1018 | t_Set.ServoCompInvert = t_Set.ServoCompInvert | 0x02; |
||
1019 | } |
||
1020 | // Seite 7 |
||
1021 | { |
||
801 | - | 1022 | t_Set.Gas_Min = sb_7_1->value(); |
1023 | t_Set.Gas_Max = sb_7_2->value(); |
||
1024 | t_Set.KompassWirkung = get_Value(cb_7_3); |
||
1025 | t_Set.UnterspannungsWarnung = sb_7_4->value(); |
||
1026 | t_Set.NotGasZeit = sb_7_5->value(); |
||
1027 | t_Set.NotGas = sb_7_6->value(); |
||
1028 | t_Set.OrientationModeControl = get_Value(cb_7_7); |
||
674 | KeyOz | 1029 | } |
1030 | // Seite 8 |
||
1031 | { |
||
1032 | t_Set.AchsKopplung1 = get_Value(cb_8_1); |
||
1033 | t_Set.AchsKopplung2 = get_Value(cb_8_2); |
||
1034 | t_Set.CouplingYawCorrection = get_Value(cb_8_3); |
||
1035 | } |
||
1036 | // Seite 9 |
||
1037 | { |
||
1038 | t_Set.BitConfig = 0; |
||
1039 | if (tb_9_6->text() == QString("1")) |
||
1040 | t_Set.BitConfig = t_Set.BitConfig | 0x01; |
||
1041 | if (tb_9_7->text() == QString("1")) |
||
1042 | t_Set.BitConfig = t_Set.BitConfig | 0x02; |
||
1043 | if (tb_9_8->text() == QString("1")) |
||
1044 | t_Set.BitConfig = t_Set.BitConfig | 0x04; |
||
1045 | if (tb_9_9->text() == QString("1")) |
||
1046 | t_Set.BitConfig = t_Set.BitConfig | 0x08; |
||
1047 | |||
1048 | |||
1049 | t_Set.LoopGasLimit = get_Value(cb_9_1); |
||
1050 | t_Set.LoopThreshold = sb_9_2->value(); |
||
1051 | t_Set.WinkelUmschlagNick = sb_9_3->value(); |
||
1052 | t_Set.LoopHysterese = sb_9_4->value(); |
||
1053 | t_Set.WinkelUmschlagRoll = sb_9_5->value(); |
||
1054 | } |
||
1055 | // Seite 10 |
||
1056 | { |
||
1057 | t_Set.UserParam1 = get_Value(cb_10_1); |
||
1058 | t_Set.UserParam2 = get_Value(cb_10_2); |
||
1059 | t_Set.UserParam3 = get_Value(cb_10_3); |
||
1060 | t_Set.UserParam4 = get_Value(cb_10_4); |
||
1061 | t_Set.UserParam5 = get_Value(cb_10_5); |
||
1062 | t_Set.UserParam6 = get_Value(cb_10_6); |
||
1063 | t_Set.UserParam7 = get_Value(cb_10_7); |
||
1064 | t_Set.UserParam8 = get_Value(cb_10_8); |
||
1065 | } |
||
1066 | // Seite 11 |
||
1067 | { |
||
1068 | t_Set.J16Bitmask = sb_11_1->value(); |
||
1069 | t_Set.J16Timing = get_Value(cb_11_2); |
||
1070 | t_Set.J17Bitmask = sb_11_3->value(); |
||
1071 | t_Set.J17Timing = get_Value(cb_11_4); |
||
1072 | t_Set.WARN_J16_Bitmask = sb_11_5->value(); |
||
1073 | t_Set.WARN_J17_Bitmask = sb_11_6->value(); |
||
1074 | |||
1075 | if (cb_11_7->isChecked()) |
||
1076 | t_Set.BitConfig = t_Set.BitConfig | CFG_MOTOR_BLINK; |
||
750 | KeyOz | 1077 | |
1078 | if (!s_11_7_cb->isChecked()) |
||
1079 | t_Set.WARN_J16_Bitmask = 0; |
||
1080 | if (!s_11_8_cb->isChecked()) |
||
1081 | t_Set.WARN_J17_Bitmask = 0; |
||
1082 | |||
674 | KeyOz | 1083 | } |
1084 | // Seite 12 |
||
1085 | { |
||
1086 | t_Set.NaviGpsModeControl = get_Value(cb_12_1); |
||
1087 | t_Set.NaviGpsGain = get_Value(cb_12_2); |
||
1088 | t_Set.NaviStickThreshold = sb_12_3->value(); |
||
1089 | t_Set.NaviGpsMinSat = sb_12_4->value(); |
||
1090 | t_Set.NaviGpsP = get_Value(cb_12_5); |
||
1091 | t_Set.NaviGpsI = get_Value(cb_12_6); |
||
1092 | t_Set.NaviGpsD = get_Value(cb_12_7); |
||
1093 | t_Set.NaviGpsACC = get_Value(cb_12_8); |
||
1094 | t_Set.NaviGpsPLimit = get_Value(cb_12_9); |
||
1095 | t_Set.NaviGpsILimit = get_Value(cb_12_10); |
||
1096 | t_Set.NaviGpsDLimit = get_Value(cb_12_11); |
||
1097 | } |
||
1098 | // Seite 13 |
||
1099 | { |
||
1100 | t_Set.NaviWindCorrection = get_Value(cb_13_1); |
||
1101 | t_Set.NaviSpeedCompensation = get_Value(cb_13_2); |
||
1102 | t_Set.NaviOperatingRadius = get_Value(cb_13_3); |
||
1103 | t_Set.NaviAngleLimitation = get_Value(cb_13_4); |
||
1104 | t_Set.NaviPH_LoginTime = sb_13_5->value(); |
||
1105 | } |
||
1106 | |||
1107 | return t_Set; |
||
1108 | } |
||
1109 | |||
1110 | int dlg_Main::get_Value(QComboBox *Combo) |
||
1111 | { |
||
1112 | if (Combo->currentText() == QString("Poti 1")) |
||
750 | KeyOz | 1113 | return 255; |
674 | KeyOz | 1114 | if (Combo->currentText() == QString("Poti 2")) |
750 | KeyOz | 1115 | return 254; |
674 | KeyOz | 1116 | if (Combo->currentText() == QString("Poti 3")) |
1117 | return 253; |
||
1118 | if (Combo->currentText() == QString("Poti 4")) |
||
750 | KeyOz | 1119 | return 252; |
1120 | if (Combo->currentText() == QString("Poti 5")) |
||
1121 | return 251; |
||
1122 | if (Combo->currentText() == QString("Poti 6")) |
||
1123 | return 250; |
||
1124 | if (Combo->currentText() == QString("Poti 7")) |
||
1125 | return 249; |
||
1126 | if (Combo->currentText() == QString("Poti 8")) |
||
1127 | return 248; |
||
674 | KeyOz | 1128 | return Combo->currentText().toInt(); |
1129 | } |
||
1130 | |||
1131 | QComboBox *dlg_Main::setCombo(QComboBox *Combo, int Wert) |
||
1132 | { |
||
750 | KeyOz | 1133 | if (Wert <= 245) |
674 | KeyOz | 1134 | { |
750 | KeyOz | 1135 | Combo->setItemText(8, QString("%1").arg(Wert)); |
1136 | Combo->setCurrentIndex(8); |
||
674 | KeyOz | 1137 | } |
1138 | else |
||
1139 | { |
||
750 | KeyOz | 1140 | Combo->setCurrentIndex(255 - Wert); |
674 | KeyOz | 1141 | } |
1142 | return Combo; |
||
1143 | } |
||
1144 | |||
1145 | void dlg_Main::set_LED(QToolButton *ToolButton, bool On) |
||
1146 | { |
||
1147 | QIcon Icons[2] ; |
||
1148 | Icons[0].addPixmap(QPixmap(QString::fromUtf8(":/Flags/Global/Images/Actions/LED_Off.png")), QIcon::Normal, QIcon::Off); |
||
1149 | Icons[1].addPixmap(QPixmap(QString::fromUtf8(":/Flags/Global/Images/Actions/LED_Red.png")), QIcon::Normal, QIcon::Off); |
||
1150 | |||
1151 | if (ToolButton->text() == QString("0") && On) |
||
1152 | { |
||
1153 | ToolButton->setIcon(Icons[1]); |
||
1154 | ToolButton->setText("1"); |
||
1155 | } |
||
1156 | else if (ToolButton->text() == QString("1") && !On) |
||
1157 | { |
||
1158 | ToolButton->setIcon(Icons[0]); |
||
1159 | ToolButton->setText("0"); |
||
1160 | } |
||
1161 | else if (ToolButton->text() == QString("00") && On) |
||
1162 | { |
||
1163 | ToolButton->setIcon(Icons[1]); |
||
1164 | ToolButton->setText("11"); |
||
1165 | } |
||
1166 | else if (ToolButton->text() == QString("11") && !On) |
||
1167 | { |
||
1168 | ToolButton->setIcon(Icons[0]); |
||
1169 | ToolButton->setText("00"); |
||
1170 | } |
||
1171 | else if (ToolButton->text() == QString("000") && On) |
||
1172 | { |
||
1173 | ToolButton->setIcon(Icons[1]); |
||
1174 | ToolButton->setText("111"); |
||
1175 | } |
||
1176 | else if (ToolButton->text() == QString("111") && !On) |
||
1177 | { |
||
1178 | ToolButton->setIcon(Icons[0]); |
||
1179 | ToolButton->setText("000"); |
||
1180 | } |
||
1181 | else if (ToolButton->text() == QString("0000") && On) |
||
1182 | { |
||
1183 | ToolButton->setIcon(Icons[1]); |
||
1184 | ToolButton->setText("1111"); |
||
1185 | } |
||
1186 | else if (ToolButton->text() == QString("1111") && !On) |
||
1187 | { |
||
1188 | ToolButton->setIcon(Icons[0]); |
||
1189 | ToolButton->setText("0000"); |
||
1190 | } |
||
1191 | } |
||
1192 | |||
1193 | void dlg_Main::slot_LEDtoValue() |
||
1194 | { |
||
1195 | QToolButton *ToolButton = (QToolButton*)sender(); |
||
1196 | |||
1197 | if (ToolButton->text() == QString("0")) |
||
1198 | { |
||
1199 | set_LED(ToolButton, true); |
||
1200 | sb_11_1->setValue(sb_11_1->value() + ToolButton->toolTip().toInt()); |
||
1201 | } |
||
1202 | else if (ToolButton->text() == QString("1")) |
||
1203 | { |
||
1204 | set_LED(ToolButton); |
||
1205 | sb_11_1->setValue(sb_11_1->value() - ToolButton->toolTip().toInt()); |
||
1206 | } |
||
1207 | |||
1208 | else if (ToolButton->text() == QString("00")) |
||
1209 | { |
||
1210 | set_LED(ToolButton, true); |
||
1211 | sb_11_3->setValue(sb_11_3->value() + ToolButton->toolTip().toInt()); |
||
1212 | } |
||
1213 | else if (ToolButton->text() == QString("11")) |
||
1214 | { |
||
1215 | set_LED(ToolButton); |
||
1216 | sb_11_3->setValue(sb_11_3->value() - ToolButton->toolTip().toInt()); |
||
1217 | } |
||
1218 | |||
1219 | else if (ToolButton->text() == QString("000")) |
||
1220 | { |
||
1221 | set_LED(ToolButton, true); |
||
1222 | sb_11_5->setValue(sb_11_5->value() + ToolButton->toolTip().toInt()); |
||
1223 | } |
||
1224 | else if (ToolButton->text() == QString("111")) |
||
1225 | { |
||
1226 | set_LED(ToolButton); |
||
1227 | sb_11_5->setValue(sb_11_5->value() - ToolButton->toolTip().toInt()); |
||
1228 | } |
||
1229 | |||
1230 | else if (ToolButton->text() == QString("0000")) |
||
1231 | { |
||
1232 | set_LED(ToolButton, true); |
||
1233 | sb_11_6->setValue(sb_11_6->value() + ToolButton->toolTip().toInt()); |
||
1234 | } |
||
1235 | else if (ToolButton->text() == QString("1111")) |
||
1236 | { |
||
1237 | set_LED(ToolButton); |
||
1238 | sb_11_6->setValue(sb_11_6->value() - ToolButton->toolTip().toInt()); |
||
1239 | } |
||
1240 | |||
1241 | |||
1242 | } |
||
1243 | |||
1244 | void dlg_Main::slot_ValuetoLED16(int Wert) |
||
1245 | { |
||
1246 | set_LED(J16_0, Wert & 0x80); |
||
1247 | set_LED(J16_1, Wert & 0x40); |
||
1248 | set_LED(J16_2, Wert & 0x20); |
||
1249 | set_LED(J16_3, Wert & 0x10); |
||
1250 | set_LED(J16_4, Wert & 0x08); |
||
1251 | set_LED(J16_5, Wert & 0x04); |
||
1252 | set_LED(J16_6, Wert & 0x02); |
||
1253 | set_LED(J16_7, Wert & 0x01); |
||
1254 | } |
||
1255 | |||
1256 | void dlg_Main::slot_ValuetoLED17(int Wert) |
||
1257 | { |
||
1258 | set_LED(J17_0, Wert & 0x80); |
||
1259 | set_LED(J17_1, Wert & 0x40); |
||
1260 | set_LED(J17_2, Wert & 0x20); |
||
1261 | set_LED(J17_3, Wert & 0x10); |
||
1262 | set_LED(J17_4, Wert & 0x08); |
||
1263 | set_LED(J17_5, Wert & 0x04); |
||
1264 | set_LED(J17_6, Wert & 0x02); |
||
1265 | set_LED(J17_7, Wert & 0x01); |
||
1266 | } |
||
1267 | |||
1268 | void dlg_Main::slot_ValuetoLED16A(int Wert) |
||
1269 | { |
||
1270 | set_LED(J16_A_0, Wert & 0x80); |
||
1271 | set_LED(J16_A_1, Wert & 0x40); |
||
1272 | set_LED(J16_A_2, Wert & 0x20); |
||
1273 | set_LED(J16_A_3, Wert & 0x10); |
||
1274 | set_LED(J16_A_4, Wert & 0x08); |
||
1275 | set_LED(J16_A_5, Wert & 0x04); |
||
1276 | set_LED(J16_A_6, Wert & 0x02); |
||
1277 | set_LED(J16_A_7, Wert & 0x01); |
||
1278 | } |
||
1279 | |||
1280 | void dlg_Main::slot_ValuetoLED17A(int Wert) |
||
1281 | { |
||
1282 | set_LED(J17_A_0, Wert & 0x80); |
||
1283 | set_LED(J17_A_1, Wert & 0x40); |
||
1284 | set_LED(J17_A_2, Wert & 0x20); |
||
1285 | set_LED(J17_A_3, Wert & 0x10); |
||
1286 | set_LED(J17_A_4, Wert & 0x08); |
||
1287 | set_LED(J17_A_5, Wert & 0x04); |
||
1288 | set_LED(J17_A_6, Wert & 0x02); |
||
1289 | set_LED(J17_A_7, Wert & 0x01); |
||
1290 | } |
||
1291 | |||
1292 | void dlg_Main::slot_tbUp() |
||
1293 | { |
||
1294 | if (tb_9_6->text() == QString("0")) |
||
1295 | { |
||
1296 | tb_9_6->setText("1"); |
||
1297 | } |
||
1298 | else |
||
1299 | { |
||
1300 | tb_9_6->setText("0"); |
||
1301 | } |
||
1302 | } |
||
1303 | |||
1304 | void dlg_Main::slot_tbDown() |
||
1305 | { |
||
1306 | if (tb_9_7->text() == QString("0")) |
||
1307 | { |
||
1308 | tb_9_7->setText("1"); |
||
1309 | } |
||
1310 | else |
||
1311 | { |
||
1312 | tb_9_7->setText("0"); |
||
1313 | } |
||
1314 | } |
||
1315 | |||
1316 | void dlg_Main::slot_tbLeft() |
||
1317 | { |
||
1318 | if (tb_9_8->text() == QString("0")) |
||
1319 | { |
||
1320 | tb_9_8->setText("1"); |
||
1321 | } |
||
1322 | else |
||
1323 | { |
||
1324 | tb_9_8->setText("0"); |
||
1325 | } |
||
1326 | } |
||
1327 | |||
1328 | void dlg_Main::slot_tbRight() |
||
1329 | { |
||
1330 | if (tb_9_9->text() == QString("0")) |
||
1331 | { |
||
1332 | tb_9_9->setText("1"); |
||
1333 | } |
||
1334 | else |
||
1335 | { |
||
1336 | tb_9_9->setText("0"); |
||
1337 | } |
||
1338 | } |
||
1339 | |||
1340 | // Programm Ende |
||
1341 | dlg_Main::~dlg_Main() |
||
1342 | { |
||
1343 | o_Settings->GUI.isMax = isMaximized(); |
||
1344 | o_Settings->GUI.Size = size(); |
||
1345 | o_Settings->GUI.Point = pos(); |
||
750 | KeyOz | 1346 | o_Settings->GUI.Toolbar = ac_Toolbar->isChecked(); |
674 | KeyOz | 1347 | |
1348 | o_Settings->write_Settings(); |
||
1349 | // qDebug("Ende."); |
||
1350 | } |