Subversion Repositories Projects

Rev

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

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