Subversion Repositories Projects

Rev

Rev 674 | Rev 722 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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