Subversion Repositories Projects

Rev

Rev 750 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

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