Subversion Repositories Projects

Rev

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

Rev 313 Rev 314
1
/***************************************************************************
1
/***************************************************************************
2
 *   Copyright (C) 2008 by Manuel Schrape                                  *
2
 *   Copyright (C) 2008 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
// TODO: Wiederholungssenden wieder einbauen
20
// TODO: Wiederholungssenden wieder einbauen
21
 
21
 
22
#include <QtGui>
22
#include <QtGui>
23
 
23
 
24
#include <QLineEdit>
24
#include <QLineEdit>
25
#include <QString>
25
#include <QString>
26
#include <QTimer>
26
#include <QTimer>
27
#include <QIcon>
27
#include <QIcon>
28
#include <QToolButton>
28
#include <QToolButton>
29
#include <QSpinBox>
29
#include <QSpinBox>
30
#include <QAction>
30
#include <QAction>
31
#include <QPalette>
31
#include <QPalette>
32
 
32
 
33
#include "mktool.h"
33
#include "mktool.h"
34
#include "dlg_Config.h"
34
#include "dlg_Config.h"
35
#include "dlg_Motortest.h"
35
#include "dlg_Motortest.h"
36
#include "dlg_Preferences.h"
36
#include "dlg_Preferences.h"
37
#include "../global.h"
37
#include "../global.h"
38
#include "../Classes/ToolBox.h"
38
#include "../Classes/ToolBox.h"
39
 
39
 
40
#include <stdlib.h>
40
#include <stdlib.h>
41
 
41
 
42
MKTool::MKTool()
42
MKTool::MKTool()
43
{
43
{
44
    setupUi(this);
44
    setupUi(this);
45
 
45
 
46
    Settings = new cSettings;
46
    Settings = new cSettings;
47
 
47
 
48
    init_Arrays();
48
    init_Arrays();
49
    init_GUI();
49
    init_GUI();
50
    init_Cockpit();
50
    init_Cockpit();
51
 
51
 
52
    init_Objects();
52
    init_Objects();
53
    init_Connections();
53
    init_Connections();
54
 
54
 
55
    init_Plot();
55
    init_Plot();
56
}
56
}
57
 
57
 
58
void MKTool::init_GUI()
58
void MKTool::init_GUI()
59
{
59
{
60
    setWindowTitle(QA_NAME + " v" + QA_VERSION);
60
    setWindowTitle(QA_NAME + " v" + QA_VERSION);
61
 
61
 
62
    // Tab mit Debug-Elementen verbergen
62
    // Tab mit Debug-Elementen verbergen
63
    //tab_Main->removeTab(6);
63
    tab_Main->removeTab(6);
64
    // Develop - Nicht gebrauchte sachen abschalten.
64
    // Develop - Nicht gebrauchte sachen abschalten.
65
    pb_SettingsReset->hide();
65
    pb_SettingsReset->hide();
66
    pb_Flash->hide();
66
    pb_Flash->hide();
67
    rb_NC->hide();
67
    rb_NC->hide();
68
 
68
 
69
    // Beta-Sachen einschalten.
69
    // Beta-Sachen einschalten.
70
#ifdef _BETA_
70
#ifdef _BETA_
71
    ac_QMKServer->setEnabled(true);
71
    ac_QMKServer->setEnabled(true);
72
#else
72
#else
73
    ac_MotorMixer->setVisible(false);
73
    ac_MotorMixer->setVisible(false);
74
#endif
74
#endif
75
    // Settings-Tab hinzufügen.
75
    // Settings-Tab hinzufügen.
76
    f_Settings = new wdg_Settings( this );
76
    f_Settings = new wdg_Settings( this );
77
    f_Settings->set_Config(Settings);
77
    f_Settings->set_Config(Settings);
78
    tab_Main->insertTab ( 2, f_Settings, ac_View2->icon(), "FC-Settings");
78
    tab_Main->insertTab ( 2, f_Settings, ac_View2->icon(), "FC-Settings");
79
    tab_Main->widget(2)->setObjectName("Tab_2");
79
    tab_Main->widget(2)->setObjectName("Tab_2");
80
 
80
 
81
    // Zusätzliche Widgets in die Toolbar.
81
    // Zusätzliche Widgets in die Toolbar.
82
    tb_TTY->addWidget(lb_Port);
82
    tb_TTY->addWidget(lb_Port);
83
    tb_TTY->addWidget(le_Port);
83
    tb_TTY->addWidget(le_Port);
84
 
84
 
85
    tb_Hardware->addWidget(rb_SelFC);
85
    tb_Hardware->addWidget(rb_SelFC);
86
    tb_Hardware->addWidget(rb_SelNC);
86
    tb_Hardware->addWidget(rb_SelNC);
87
    tb_Hardware->addWidget(rb_SelMag);
87
    tb_Hardware->addWidget(rb_SelMag);
88
 
88
 
89
    tb_Allgemein->setVisible(Settings->GUI.ToolViews[0]);
89
    tb_Allgemein->setVisible(Settings->GUI.ToolViews[0]);
90
    tb_Werkzeuge->setVisible(Settings->GUI.ToolViews[1]);
90
    tb_Werkzeuge->setVisible(Settings->GUI.ToolViews[1]);
91
    tb_Debug->setVisible(Settings->GUI.ToolViews[2]);
91
    tb_Debug->setVisible(Settings->GUI.ToolViews[2]);
92
    tb_TTY->setVisible(Settings->GUI.ToolViews[3]);
92
    tb_TTY->setVisible(Settings->GUI.ToolViews[3]);
93
    tb_Hardware->setVisible(Settings->GUI.ToolViews[4]);
93
    tb_Hardware->setVisible(Settings->GUI.ToolViews[4]);
94
 
94
 
95
#ifdef _EEEPC_
95
#ifdef _EEEPC_
96
    lb_Status->hide();
96
    lb_Status->hide();
97
#endif
97
#endif
98
 
98
 
99
    lb_Status->setText(tr("Hallo bei QMK-Groundstation...!!!"));
99
    lb_Status->setText(tr("Hallo bei QMK-Groundstation...!!!"));
100
 
100
 
101
    resize(Settings->GUI.Size);
101
    resize(Settings->GUI.Size);
102
    move(Settings->GUI.Point);
102
    move(Settings->GUI.Point);
103
 
103
 
104
    if (Settings->GUI.isMax)
104
    if (Settings->GUI.isMax)
105
    {
105
    {
106
        showMaximized();
106
        showMaximized();
107
    }
107
    }
108
 
108
 
109
    // Analoglabels anzeigen
109
    // Analoglabels anzeigen
110
    for (int a = 0; a < MaxAnalog; a++)
110
    for (int a = 0; a < MaxAnalog; a++)
111
    {
111
    {
112
        lb_Analog[a]->setText(Settings->Analog1.Label[a]);
112
        lb_Analog[a]->setText(Settings->Analog1.Label[a]);
113
    }
113
    }
114
 
114
 
115
    // Kopie der Tabs anlegen
115
    // Kopie der Tabs anlegen
116
    for (int b = 0; b < 7; b++)
116
    for (int b = 0; b < 7; b++)
117
    {
117
    {
118
        TabWidgets[b] = tab_Main->widget(b);
118
        TabWidgets[b] = tab_Main->widget(b);
119
    }
119
    }
120
 
120
 
121
    // Ausgeblendete Tabs ausblenden
121
    // Ausgeblendete Tabs ausblenden
122
    for (int c = 0; c < 7; c++)
122
    for (int c = 0; c < 7; c++)
123
    {
123
    {
124
        if (Settings->GUI.TabViews[c] == false)
124
        if (Settings->GUI.TabViews[c] == false)
125
        {
125
        {
126
            QString TabName = QString("Tab_%1").arg(c);
126
            QString TabName = QString("Tab_%1").arg(c);
127
 
127
 
128
            for (int d = 0; d < tab_Main->count(); d++)
128
            for (int d = 0; d < tab_Main->count(); d++)
129
            {
129
            {
130
                if (tab_Main->widget(d)->objectName() == TabName)
130
                if (tab_Main->widget(d)->objectName() == TabName)
131
                {
131
                {
132
                    tab_Main->removeTab(d);
132
                    tab_Main->removeTab(d);
133
                }
133
                }
134
            }
134
            }
135
        }
135
        }
136
    }
136
    }
137
 
137
 
138
    ac_View0->setChecked(Settings->GUI.TabViews[0]);
138
    ac_View0->setChecked(Settings->GUI.TabViews[0]);
139
    ac_View1->setChecked(Settings->GUI.TabViews[1]);
139
    ac_View1->setChecked(Settings->GUI.TabViews[1]);
140
    ac_View2->setChecked(Settings->GUI.TabViews[2]);
140
    ac_View2->setChecked(Settings->GUI.TabViews[2]);
141
    ac_View3->setChecked(Settings->GUI.TabViews[3]);
141
    ac_View3->setChecked(Settings->GUI.TabViews[3]);
142
    ac_View4->setChecked(Settings->GUI.TabViews[4]);
142
    ac_View4->setChecked(Settings->GUI.TabViews[4]);
143
    ac_View5->setChecked(Settings->GUI.TabViews[5]);
143
    ac_View5->setChecked(Settings->GUI.TabViews[5]);
144
    ac_View6->setChecked(Settings->GUI.TabViews[6]);
144
    ac_View6->setChecked(Settings->GUI.TabViews[6]);
145
 
145
 
146
    le_Port->setText(Settings->TTY.Port);
146
    le_Port->setText(Settings->TTY.Port);
147
 
147
 
148
    cb_ShowMSG->setChecked(Settings->GUI.Term_Info);
148
    cb_ShowMSG->setChecked(Settings->GUI.Term_Info);
149
    cb_ShowData->setChecked(Settings->GUI.Term_Data);
149
    cb_ShowData->setChecked(Settings->GUI.Term_Data);
150
    cb_ShowAlways->setChecked(Settings->GUI.Term_Always);
150
    cb_ShowAlways->setChecked(Settings->GUI.Term_Always);
151
}
151
}
152
 
152
 
153
void MKTool::init_Cockpit()
153
void MKTool::init_Cockpit()
154
{
154
{
155
    // Cockpit-Elemente
155
    // Cockpit-Elemente
156
    QPalette newPalette;
156
    QPalette newPalette;
157
 
157
 
158
    newPalette.setColor(QPalette::Base, Qt::darkBlue);
158
    newPalette.setColor(QPalette::Base, Qt::darkBlue);
159
    newPalette.setColor(QPalette::Foreground, QColor(Qt::darkBlue).dark(120));
159
    newPalette.setColor(QPalette::Foreground, QColor(Qt::darkBlue).dark(120));
160
    newPalette.setColor(QPalette::Text, Qt::white);
160
    newPalette.setColor(QPalette::Text, Qt::white);
161
 
161
 
162
    Compass->setScaleOptions(QwtDial::ScaleTicks | QwtDial::ScaleLabel);
162
    Compass->setScaleOptions(QwtDial::ScaleTicks | QwtDial::ScaleLabel);
163
    Compass->setScaleTicks(0, 0, 3);
163
    Compass->setScaleTicks(0, 0, 3);
164
    Compass->setScale(36, 5, 0);
164
    Compass->setScale(36, 5, 0);
165
 
165
 
166
    Compass->setNeedle(new QwtDialSimpleNeedle(QwtDialSimpleNeedle::Arrow, true, Qt::red, QColor(Qt::gray).light(130)));
166
    Compass->setNeedle(new QwtDialSimpleNeedle(QwtDialSimpleNeedle::Arrow, true, Qt::red, QColor(Qt::gray).light(130)));
167
    Compass->setPalette(newPalette);
167
    Compass->setPalette(newPalette);
168
    Compass->setMaximumSize(QSize(MeterSize, MeterSize));
168
    Compass->setMaximumSize(QSize(MeterSize, MeterSize));
169
    Compass->setMinimumSize(QSize(MeterSize, MeterSize));
169
    Compass->setMinimumSize(QSize(MeterSize, MeterSize));
170
 
170
 
171
    QPalette newPalette1;
171
    QPalette newPalette1;
172
 
172
 
173
    newPalette1.setColor(QPalette::Base, Qt::darkBlue);
173
    newPalette1.setColor(QPalette::Base, Qt::darkBlue);
174
    newPalette1.setColor(QPalette::Foreground, QColor(255,128,0).dark(120));
174
    newPalette1.setColor(QPalette::Foreground, QColor(255,128,0).dark(120));
175
    newPalette1.setColor(QPalette::Text, Qt::white);
175
    newPalette1.setColor(QPalette::Text, Qt::white);
176
 
176
 
177
    Attitude = new AttitudeIndicator(this);
177
    Attitude = new AttitudeIndicator(this);
178
    Attitude->setMaximumSize(QSize(MeterSize, MeterSize));
178
    Attitude->setMaximumSize(QSize(MeterSize, MeterSize));
179
    Attitude->setMinimumSize(QSize(MeterSize, MeterSize));
179
    Attitude->setMinimumSize(QSize(MeterSize, MeterSize));
180
    Attitude->setPalette(newPalette1);
180
    Attitude->setPalette(newPalette1);
181
 
181
 
182
    verticalLayout->addWidget(Attitude);
182
    verticalLayout->addWidget(Attitude);
183
 
183
 
184
    qwt_Rate->setRange(-10.0, 10.0, 0.1, 0);
184
    qwt_Rate->setRange(-10.0, 10.0, 0.1, 0);
185
 
185
 
186
    newPalette1.setColor(QPalette::Foreground, QColor(Qt::darkBlue).dark(120));
186
    newPalette1.setColor(QPalette::Foreground, QColor(Qt::darkBlue).dark(120));
187
 
187
 
188
    SpeedMeter = new cSpeedMeter(this);
188
    SpeedMeter = new cSpeedMeter(this);
189
    SpeedMeter->setMaximumSize(QSize(MeterSize, MeterSize));
189
    SpeedMeter->setMaximumSize(QSize(MeterSize, MeterSize));
190
    SpeedMeter->setMinimumSize(QSize(MeterSize, MeterSize));
190
    SpeedMeter->setMinimumSize(QSize(MeterSize, MeterSize));
191
    SpeedMeter->setPalette(newPalette1);
191
    SpeedMeter->setPalette(newPalette1);
192
    SpeedMeter->setRange(0.0, 5.0);
192
    SpeedMeter->setRange(0.0, 5.0);
193
    SpeedMeter->setScale(1, 2, 0.5);
193
    SpeedMeter->setScale(1, 2, 0.5);
194
    SpeedMeter->setProperty("END", 5);
194
    SpeedMeter->setProperty("END", 5);
195
 
195
 
196
    LayOut_Speed->addWidget(SpeedMeter);
196
    LayOut_Speed->addWidget(SpeedMeter);
197
}
197
}
198
 
198
 
199
void MKTool::init_Objects()
199
void MKTool::init_Objects()
200
{
200
{
201
    // QTimer-Instanzen
201
    // QTimer-Instanzen
202
    Ticker = new QTimer(this);
202
    Ticker = new QTimer(this);
203
 
203
 
204
    // Verbindungsobject
204
    // Verbindungsobject
205
    o_Connection = new cConnection();
205
    o_Connection = new cConnection();
206
 
206
 
207
    // neuer Logger
207
    // neuer Logger
208
    logger = new Logger(Settings, &Mode);
208
    logger = new Logger(Settings, &Mode);
209
 
209
 
210
    // LCD-Dialog
210
    // LCD-Dialog
211
    f_LCD = new dlg_LCD(this);
211
    f_LCD = new dlg_LCD(this);
212
 
212
 
213
    // LCD-Dialog
213
    // LCD-Dialog
214
    f_MotorMixer = new dlg_MotorMixer(this);
214
    f_MotorMixer = new dlg_MotorMixer(this);
215
 
215
 
216
    // LCD-Dialog
216
    // LCD-Dialog
217
    f_Map = new dlg_Map(this);
217
    f_Map = new dlg_Map(this);
218
    f_Map->create_Map(Settings);
218
    f_Map->create_Map(Settings);
219
 
219
 
220
    KML_Server = new cKML_Server();
220
    KML_Server = new cKML_Server();
221
 
221
 
222
    QMK_Server = new cQMK_Server();
222
    QMK_Server = new cQMK_Server();
223
    QMK_Server->setProperty("Connect", false);
223
    QMK_Server->setProperty("Connect", false);
224
 
224
 
225
    if (Settings->Server.StartServer)
225
    if (Settings->Server.StartServer)
226
    {
226
    {
227
        ac_StartServer->setChecked(true);
227
        ac_StartServer->setChecked(true);
228
        KML_Server->start_Server(Settings->Server.Port.toInt(), Settings);
228
        KML_Server->start_Server(Settings->Server.Port.toInt(), Settings);
229
    }
229
    }
230
}
230
}
231
 
231
 
232
void MKTool::init_Connections()
232
void MKTool::init_Connections()
233
{
233
{
234
    connect(Dec, SIGNAL(clicked()), this, SLOT(slot_Test()));
234
    connect(Dec, SIGNAL(clicked()), this, SLOT(slot_Test()));
235
 
235
 
236
    // Waypoints übergeben
236
    // Waypoints übergeben
237
    connect(f_Map, SIGNAL(set_Target(sWayPoint)), this , SLOT(slot_MAP_SetTarget(sWayPoint)));
237
    connect(f_Map, SIGNAL(set_Target(sWayPoint)), this , SLOT(slot_MAP_SetTarget(sWayPoint)));
238
 
238
 
239
    // Daten Senden / Empfangen
239
    // Daten Senden / Empfangen
240
    connect(o_Connection, SIGNAL(newData(sRxData)), this, SLOT(slot_newData(sRxData)));
240
    connect(o_Connection, SIGNAL(newData(sRxData)), this, SLOT(slot_newData(sRxData)));
241
    connect(o_Connection, SIGNAL(showTerminal(int, QString)), this, SLOT(slot_showTerminal(int, QString)));
241
    connect(o_Connection, SIGNAL(showTerminal(int, QString)), this, SLOT(slot_showTerminal(int, QString)));
242
 
242
 
243
    // Serielle Verbundung öffnen / schließen
243
    // Serielle Verbundung öffnen / schließen
244
    connect(ac_ConnectTTY, SIGNAL(triggered()), this, SLOT(slot_OpenPort()));
244
    connect(ac_ConnectTTY, SIGNAL(triggered()), this, SLOT(slot_OpenPort()));
245
 
245
 
246
    // TCP-Connection verbinden / trennen
246
    // TCP-Connection verbinden / trennen
247
    connect(ac_QMKServer, SIGNAL(triggered()), this, SLOT(slot_QMKS_Connect()));
247
    connect(ac_QMKServer, SIGNAL(triggered()), this, SLOT(slot_QMKS_Connect()));
248
 
248
 
249
    // Buttons Settings lesen / schreiben
249
    // Buttons Settings lesen / schreiben
250
    connect(f_Settings->pb_Read,   SIGNAL(clicked()), this, SLOT(slot_GetFCSettings()));
250
    connect(f_Settings->pb_Read,   SIGNAL(clicked()), this, SLOT(slot_GetFCSettings()));
251
    connect(f_Settings->pb_Write,  SIGNAL(clicked()), this, SLOT(slot_SetFCSettings()));
251
    connect(f_Settings->pb_Write,  SIGNAL(clicked()), this, SLOT(slot_SetFCSettings()));
252
 
252
 
253
    // Actions
253
    // Actions
254
    connect(ac_Config,       SIGNAL(triggered()), this, SLOT(slot_ac_Config()));
254
    connect(ac_Config,       SIGNAL(triggered()), this, SLOT(slot_ac_Config()));
255
    connect(ac_Preferences,  SIGNAL(triggered()), this, SLOT(slot_ac_Preferences()));
255
    connect(ac_Preferences,  SIGNAL(triggered()), this, SLOT(slot_ac_Preferences()));
256
    connect(ac_Motortest,    SIGNAL(triggered()), this, SLOT(slot_ac_Motortest()));
256
    connect(ac_Motortest,    SIGNAL(triggered()), this, SLOT(slot_ac_Motortest()));
257
    connect(ac_MotorMixer,   SIGNAL(triggered()), this, SLOT(slot_ac_MotorMixer()));
257
    connect(ac_MotorMixer,   SIGNAL(triggered()), this, SLOT(slot_ac_MotorMixer()));
258
    connect(ac_LCD,          SIGNAL(triggered()), this, SLOT(slot_ac_LCD()));
258
    connect(ac_LCD,          SIGNAL(triggered()), this, SLOT(slot_ac_LCD()));
259
    connect(ac_Map,          SIGNAL(triggered()), this, SLOT(slot_ac_Map()));
259
    connect(ac_Map,          SIGNAL(triggered()), this, SLOT(slot_ac_Map()));
260
    connect(ac_FastDebug,    SIGNAL(triggered()), this, SLOT(slot_ac_FastDebug()));
260
    connect(ac_FastDebug,    SIGNAL(triggered()), this, SLOT(slot_ac_FastDebug()));
261
    connect(ac_NoDebug,      SIGNAL(triggered()), this, SLOT(slot_ac_NoDebug()));
261
    connect(ac_NoDebug,      SIGNAL(triggered()), this, SLOT(slot_ac_NoDebug()));
262
    connect(ac_FastNavi,     SIGNAL(triggered()), this, SLOT(slot_ac_FastNavi()));
262
    connect(ac_FastNavi,     SIGNAL(triggered()), this, SLOT(slot_ac_FastNavi()));
263
    connect(ac_NoNavi,       SIGNAL(triggered()), this, SLOT(slot_ac_NoNavi()));
263
    connect(ac_NoNavi,       SIGNAL(triggered()), this, SLOT(slot_ac_NoNavi()));
264
    connect(ac_GetLabels,    SIGNAL(triggered()), this, SLOT(slot_ac_GetLabels()));
264
    connect(ac_GetLabels,    SIGNAL(triggered()), this, SLOT(slot_ac_GetLabels()));
265
 
265
 
266
    // Plotter starten / scrollen
266
    // Plotter starten / scrollen
267
    connect(scroll_plot,     SIGNAL(valueChanged(int)), this, SLOT(slot_ScrollPlot(int)));
267
    connect(scroll_plot,     SIGNAL(valueChanged(int)), this, SLOT(slot_ScrollPlot(int)));
268
    connect(ac_StartPlotter, SIGNAL(triggered()), this, SLOT(slot_ac_StartPlotter()));
268
    connect(ac_StartPlotter, SIGNAL(triggered()), this, SLOT(slot_ac_StartPlotter()));
269
    connect(ac_StartServer,  SIGNAL(triggered()), this, SLOT(slot_ac_StartServer()));
269
    connect(ac_StartServer,  SIGNAL(triggered()), this, SLOT(slot_ac_StartServer()));
270
 
270
 
271
    // Tabs ein & ausblenden
271
    // Tabs ein & ausblenden
272
    connect(ac_View0,        SIGNAL(triggered()), this, SLOT(slot_ac_View()));
272
    connect(ac_View0,        SIGNAL(triggered()), this, SLOT(slot_ac_View()));
273
    connect(ac_View1,        SIGNAL(triggered()), this, SLOT(slot_ac_View()));
273
    connect(ac_View1,        SIGNAL(triggered()), this, SLOT(slot_ac_View()));
274
    connect(ac_View2,        SIGNAL(triggered()), this, SLOT(slot_ac_View()));
274
    connect(ac_View2,        SIGNAL(triggered()), this, SLOT(slot_ac_View()));
275
    connect(ac_View3,        SIGNAL(triggered()), this, SLOT(slot_ac_View()));
275
    connect(ac_View3,        SIGNAL(triggered()), this, SLOT(slot_ac_View()));
276
    connect(ac_View4,        SIGNAL(triggered()), this, SLOT(slot_ac_View()));
276
    connect(ac_View4,        SIGNAL(triggered()), this, SLOT(slot_ac_View()));
277
    connect(ac_View5,        SIGNAL(triggered()), this, SLOT(slot_ac_View()));
277
    connect(ac_View5,        SIGNAL(triggered()), this, SLOT(slot_ac_View()));
278
    connect(ac_View6,        SIGNAL(triggered()), this, SLOT(slot_ac_View()));
278
    connect(ac_View6,        SIGNAL(triggered()), this, SLOT(slot_ac_View()));
279
 
279
 
280
    connect(ac_SelNC,        SIGNAL(triggered()), this, SLOT(slot_ac_Hardware()));
280
    connect(ac_SelNC,        SIGNAL(triggered()), this, SLOT(slot_ac_Hardware()));
281
    connect(ac_SelFC,        SIGNAL(triggered()), this, SLOT(slot_ac_Hardware()));
281
    connect(ac_SelFC,        SIGNAL(triggered()), this, SLOT(slot_ac_Hardware()));
282
    connect(ac_SelMag,       SIGNAL(triggered()), this, SLOT(slot_ac_Hardware()));
282
    connect(ac_SelMag,       SIGNAL(triggered()), this, SLOT(slot_ac_Hardware()));
283
 
283
 
284
    connect(rb_SelNC,        SIGNAL(clicked()), this, SLOT(slot_rb_Hardware()));
284
    connect(rb_SelNC,        SIGNAL(clicked()), this, SLOT(slot_rb_Hardware()));
285
    connect(rb_SelFC,        SIGNAL(clicked()), this, SLOT(slot_rb_Hardware()));
285
    connect(rb_SelFC,        SIGNAL(clicked()), this, SLOT(slot_rb_Hardware()));
286
    connect(rb_SelMag,       SIGNAL(clicked()), this, SLOT(slot_rb_Hardware()));
286
    connect(rb_SelMag,       SIGNAL(clicked()), this, SLOT(slot_rb_Hardware()));
287
 
287
 
288
    // firmeware Updateen / flashen
288
    // firmeware Updateen / flashen
289
    connect(pb_Update,   SIGNAL(clicked()), this, SLOT(slot_pb_Update()));
289
    connect(pb_Update,   SIGNAL(clicked()), this, SLOT(slot_pb_Update()));
290
    connect(pb_HexFile,  SIGNAL(clicked()), this, SLOT(slot_pb_HexFile()));
290
    connect(pb_HexFile,  SIGNAL(clicked()), this, SLOT(slot_pb_HexFile()));
291
 
291
 
292
    // Wegpunkt-Befehl
292
    // Wegpunkt-Befehl
293
    connect(pb_FlyTo,        SIGNAL(clicked()), this, SLOT(slot_pb_SendWaypoint()));
293
    connect(pb_FlyTo,        SIGNAL(clicked()), this, SLOT(slot_pb_SendWaypoint()));
294
 
294
 
295
    // CVS-Record starten / stoppen
295
    // CVS-Record starten / stoppen
296
    connect(ac_RecordCSV,  SIGNAL(triggered()), this, SLOT(slot_RecordLog()));
296
    connect(ac_RecordCSV,  SIGNAL(triggered()), this, SLOT(slot_RecordLog()));
297
 
297
 
298
    // Timer-Events
298
    // Timer-Events
299
    connect(Ticker,   SIGNAL(timeout()),       SLOT(slot_Ticker()));
299
    connect(Ticker,   SIGNAL(timeout()),       SLOT(slot_Ticker()));
300
 
300
 
301
    // Seitenwechsel
301
    // Seitenwechsel
302
    connect(tab_Main,             SIGNAL(currentChanged(int)), this, SLOT(slot_TabChanged(int)));
302
    connect(tab_Main,             SIGNAL(currentChanged(int)), this, SLOT(slot_TabChanged(int)));
303
//    connect(f_Settings->tab_Par,  SIGNAL(currentChanged(int)), this, SLOT(slot_TabChanged(int)));
303
//    connect(f_Settings->tab_Par,  SIGNAL(currentChanged(int)), this, SLOT(slot_TabChanged(int)));
304
    connect(f_Settings->listWidget,  SIGNAL(currentRowChanged(int)), this, SLOT(slot_TabChanged(int)));
304
    connect(f_Settings->listWidget,  SIGNAL(currentRowChanged(int)), this, SLOT(slot_TabChanged(int)));
305
 
305
 
306
    // About QMK & About-QT Dialog einfügen
306
    // About QMK & About-QT Dialog einfügen
307
    connect(ac_About, SIGNAL(triggered()), this, SLOT(slot_ac_About()));
307
    connect(ac_About, SIGNAL(triggered()), this, SLOT(slot_ac_About()));
308
    menu_Help->addAction(trUtf8("Über &Qt"), qApp, SLOT(aboutQt()));
308
    menu_Help->addAction(trUtf8("Über &Qt"), qApp, SLOT(aboutQt()));
309
}
309
}
310
 
310
 
311
void MKTool::init_Arrays()
311
void MKTool::init_Arrays()
312
{
312
{
313
    lb_Analog[0]  = lb_A_0;
313
    lb_Analog[0]  = lb_A_0;
314
    lb_Analog[1]  = lb_A_1;
314
    lb_Analog[1]  = lb_A_1;
315
    lb_Analog[2]  = lb_A_2;
315
    lb_Analog[2]  = lb_A_2;
316
    lb_Analog[3]  = lb_A_3;
316
    lb_Analog[3]  = lb_A_3;
317
    lb_Analog[4]  = lb_A_4;
317
    lb_Analog[4]  = lb_A_4;
318
    lb_Analog[5]  = lb_A_5;
318
    lb_Analog[5]  = lb_A_5;
319
    lb_Analog[6]  = lb_A_6;
319
    lb_Analog[6]  = lb_A_6;
320
    lb_Analog[7]  = lb_A_7;
320
    lb_Analog[7]  = lb_A_7;
321
    lb_Analog[8]  = lb_A_8;
321
    lb_Analog[8]  = lb_A_8;
322
    lb_Analog[9]  = lb_A_9;
322
    lb_Analog[9]  = lb_A_9;
323
    lb_Analog[10] = lb_A_10;
323
    lb_Analog[10] = lb_A_10;
324
    lb_Analog[11] = lb_A_11;
324
    lb_Analog[11] = lb_A_11;
325
    lb_Analog[12] = lb_A_12;
325
    lb_Analog[12] = lb_A_12;
326
    lb_Analog[13] = lb_A_13;
326
    lb_Analog[13] = lb_A_13;
327
    lb_Analog[14] = lb_A_14;
327
    lb_Analog[14] = lb_A_14;
328
    lb_Analog[15] = lb_A_15;
328
    lb_Analog[15] = lb_A_15;
329
    lb_Analog[16] = lb_A_16;
329
    lb_Analog[16] = lb_A_16;
330
    lb_Analog[17] = lb_A_17;
330
    lb_Analog[17] = lb_A_17;
331
    lb_Analog[18] = lb_A_18;
331
    lb_Analog[18] = lb_A_18;
332
    lb_Analog[19] = lb_A_19;
332
    lb_Analog[19] = lb_A_19;
333
    lb_Analog[20] = lb_A_20;
333
    lb_Analog[20] = lb_A_20;
334
    lb_Analog[21] = lb_A_21;
334
    lb_Analog[21] = lb_A_21;
335
    lb_Analog[22] = lb_A_22;
335
    lb_Analog[22] = lb_A_22;
336
    lb_Analog[23] = lb_A_23;
336
    lb_Analog[23] = lb_A_23;
337
    lb_Analog[24] = lb_A_24;
337
    lb_Analog[24] = lb_A_24;
338
    lb_Analog[25] = lb_A_25;
338
    lb_Analog[25] = lb_A_25;
339
    lb_Analog[26] = lb_A_26;
339
    lb_Analog[26] = lb_A_26;
340
    lb_Analog[27] = lb_A_27;
340
    lb_Analog[27] = lb_A_27;
341
    lb_Analog[28] = lb_A_28;
341
    lb_Analog[28] = lb_A_28;
342
    lb_Analog[29] = lb_A_29;
342
    lb_Analog[29] = lb_A_29;
343
    lb_Analog[30] = lb_A_30;
343
    lb_Analog[30] = lb_A_30;
344
    lb_Analog[31] = lb_A_31;
344
    lb_Analog[31] = lb_A_31;
345
}
345
}
346
 
346
 
347
void MKTool::init_Plot()
347
void MKTool::init_Plot()
348
{
348
{
349
    NextPlot = 0;
349
    NextPlot = 0;
350
 
350
 
351
    qwtPlot->setCanvasBackground(QColor(QRgb(0x00000000)));
351
    qwtPlot->setCanvasBackground(QColor(QRgb(0x00000000)));
352
 
352
 
353
    qwtPlot->insertLegend(new QwtLegend(), QwtPlot::RightLegend);
353
    qwtPlot->insertLegend(new QwtLegend(), QwtPlot::RightLegend);
354
 
354
 
355
    QwtPlotGrid *Grid = new QwtPlotGrid();
355
    QwtPlotGrid *Grid = new QwtPlotGrid();
356
    Grid->setMajPen(QPen(Qt::gray, 0, Qt::DotLine));
356
    Grid->setMajPen(QPen(Qt::gray, 0, Qt::DotLine));
357
 
357
 
358
    Grid->attach(qwtPlot);
358
    Grid->attach(qwtPlot);
359
 
359
 
360
    qwtPlot->setAxisScale(QwtPlot::xBottom,0,Settings->Data.Plotter_Count,0);
360
    qwtPlot->setAxisScale(QwtPlot::xBottom,0,Settings->Data.Plotter_Count,0);
361
 
361
 
362
    for (int a = 0; a < MaxAnalog; a++)
362
    for (int a = 0; a < MaxAnalog; a++)
363
    {
363
    {
364
        Plot[a] = new QwtPlotCurve(Settings->Analog1.Label[a]);
364
        Plot[a] = new QwtPlotCurve(Settings->Analog1.Label[a]);
365
        Plot[a]->setPen(QPen(QColor(Def_Colors[a])));
365
        Plot[a]->setPen(QPen(QColor(Def_Colors[a])));
366
//        Plot[a]->setRenderHint(QwtPlotItem::RenderAntialiased);
366
//        Plot[a]->setRenderHint(QwtPlotItem::RenderAntialiased);
367
 
367
 
368
        if (Settings->Analog1.PlotView[a])
368
        if (Settings->Analog1.PlotView[a])
369
            Plot[a]->attach(qwtPlot);
369
            Plot[a]->attach(qwtPlot);
370
    }
370
    }
371
    qwtPlot->replot();
371
    qwtPlot->replot();
372
}
372
}
373
 
373
 
374
void MKTool::slot_set_Settings(cSettings *t_Settings)
374
void MKTool::slot_set_Settings(cSettings *t_Settings)
375
{
375
{
376
    Settings = t_Settings;
376
    Settings = t_Settings;
377
}
377
}
378
 
378
 
379
void MKTool::slot_Test()
379
void MKTool::slot_Test()
380
{
380
{
381
//    qDebug("Decode Data");
381
//    qDebug("Decode Data");
382
    sRxData RX;
382
    sRxData RX;
383
 
383
 
384
    RX.String = IN->text();
384
    RX.String = IN->text();
385
 
385
 
386
//    qDebug(RX.String.toLatin1().data());
386
//    qDebug(RX.String.toLatin1().data());
387
 
387
 
388
//    if (ToolBox::check_CRC(RX.String))
388
//    if (ToolBox::check_CRC(RX.String))
389
    {
389
    {
390
        qDebug("Decode Data CRC OK");
390
        qDebug("Decode Data CRC OK");
391
        RX.Input = RX.String.toLatin1().data();
391
        RX.Input = RX.String.toLatin1().data();
392
 
392
 
393
//        qDebug(RX.Input);
393
//        qDebug(RX.Input);
394
 
394
 
395
        slot_newData(RX);
395
        slot_newData(RX);
396
    }
396
    }
397
}
397
}
398
 
398
 
399
// KML-Datei nach Wegpunkt parsen
399
// KML-Datei nach Wegpunkt parsen
400
// TODO: Richtigen KML-Parser bauen
400
// TODO: Richtigen KML-Parser bauen
401
void MKTool::parse_TargetKML()
401
void MKTool::parse_TargetKML()
402
{
402
{
403
    QString Tmp = te_KML->toPlainText().simplified();
403
    QString Tmp = te_KML->toPlainText().simplified();
404
    QStringList List;
404
    QStringList List;
405
 
405
 
406
    if ((Tmp.contains("<kml xmlns=\"http://earth.google.com/kml/2.2\">"))  && (Tmp.contains("<coordinates>")))
406
    if ((Tmp.contains("<kml xmlns=\"http://earth.google.com/kml/2.2\">"))  && (Tmp.contains("<coordinates>")))
407
    {
407
    {
408
        List = Tmp.split("<coordinates>");
408
        List = Tmp.split("<coordinates>");
409
        List = List[1].split(",");
409
        List = List[1].split(",");
410
 
410
 
411
        le_TarLong->setText(ToolBox::get_Float((List[0].toDouble() * 10000000), 10000000));
411
        le_TarLong->setText(ToolBox::get_Float((List[0].toDouble() * 10000000), 7));
412
        le_TarLat->setText(ToolBox::get_Float((List[1].toDouble() * 10000000), 10000000));
412
        le_TarLat->setText(ToolBox::get_Float((List[1].toDouble() * 10000000), 7));
413
    }
413
    }
414
}
414
}
415
 
415
 
416
// Waypoint zur NC Senden.
416
// Waypoint zur NC Senden.
417
void MKTool::slot_pb_SendWaypoint()
417
void MKTool::slot_pb_SendWaypoint()
418
{
418
{
419
    if ((Navi.Current.Longitude == 0) && (Navi.Current.Latitude == 0))
419
    if ((Navi.Current.Longitude == 0) && (Navi.Current.Latitude == 0))
420
    {
420
    {
421
        QMessageBox msgB;
421
        QMessageBox msgB;
422
        QString msg;
422
        QString msg;
423
        msgB.setText("Fehler: Es konnten keine GPS-Daten vom Mikrokopter empfangen werden");
423
        msgB.setText("Fehler: Es konnten keine GPS-Daten vom Mikrokopter empfangen werden");
424
        msgB.exec();
424
        msgB.exec();
425
        return;
425
        return;
426
    }
426
    }
427
 
427
 
428
    //erstelle einen Wegpunkt, den die NaviCtrl auswerten kann
428
    //erstelle einen Wegpunkt, den die NaviCtrl auswerten kann
429
    Waypoint_t desired_pos;
429
    Waypoint_t desired_pos;
430
    bool ok_lat, ok_lon;
430
    bool ok_lat, ok_lon;
431
 
431
 
432
    //eingegebene Daten holen
432
    //eingegebene Daten holen
433
    double desired_long, desired_lat;
433
    double desired_long, desired_lat;
434
 
434
 
435
    desired_long = le_TarLong->text().toDouble(&ok_lon);
435
    desired_long = le_TarLong->text().toDouble(&ok_lon);
436
    desired_lat  = le_TarLat->text().toDouble(&ok_lat);
436
    desired_lat  = le_TarLat->text().toDouble(&ok_lat);
437
 
437
 
438
    if (ok_lon && desired_long < 100)
438
    if (ok_lon && desired_long < 100)
439
        desired_long *= 10000000+0.5;
439
        desired_long *= 10000000+0.5;
440
 
440
 
441
    if (ok_lat && desired_lat < 100)
441
    if (ok_lat && desired_lat < 100)
442
        desired_lat *= 10000000+0.5;
442
        desired_lat *= 10000000+0.5;
443
 
443
 
444
    //fülle Wegpunkt-Daten
444
    //fülle Wegpunkt-Daten
445
    desired_pos.Position.Altitude = 0;
445
    desired_pos.Position.Altitude = 0;
446
    desired_pos.Position.Longitude = int32_t(desired_long);
446
    desired_pos.Position.Longitude = int32_t(desired_long);
447
    desired_pos.Position.Latitude =  int32_t(desired_lat);
447
    desired_pos.Position.Latitude =  int32_t(desired_lat);
448
    desired_pos.Position.Status = NEWDATA;
448
    desired_pos.Position.Status = NEWDATA;
449
    desired_pos.Heading = -1;
449
    desired_pos.Heading = -1;
450
    desired_pos.ToleranceRadius = 1;
450
    desired_pos.ToleranceRadius = 1;
451
    desired_pos.HoldTime = 60;
451
    desired_pos.HoldTime = 60;
452
    desired_pos.Event_Flag = 0;
452
    desired_pos.Event_Flag = 0;
453
    desired_pos.reserve[0] = 0; // reserve
453
    desired_pos.reserve[0] = 0; // reserve
454
    desired_pos.reserve[1] = 0; // reserve
454
    desired_pos.reserve[1] = 0; // reserve
455
    desired_pos.reserve[2] = 0; // reserve
455
    desired_pos.reserve[2] = 0; // reserve
456
    desired_pos.reserve[3] = 0; // reserve
456
    desired_pos.reserve[3] = 0; // reserve
457
 
457
 
458
    //...und sende ihn an die NaviCtrl
458
    //...und sende ihn an die NaviCtrl
459
    int max_radius = 10000;
459
    int max_radius = 10000;
460
    if (ok_lat && ok_lon &&
460
    if (ok_lat && ok_lon &&
461
        abs(Navi.Current.Longitude - desired_pos.Position.Longitude) < max_radius &&
461
        abs(Navi.Current.Longitude - desired_pos.Position.Longitude) < max_radius &&
462
        abs(Navi.Current.Latitude  - desired_pos.Position.Latitude) < max_radius)
462
        abs(Navi.Current.Latitude  - desired_pos.Position.Latitude) < max_radius)
463
    {
463
    {
464
            o_Connection->send_Cmd('s', ADDRESS_NC, (char *)&desired_pos, sizeof(desired_pos), false);
464
            o_Connection->send_Cmd('s', ADDRESS_NC, (char *)&desired_pos, sizeof(desired_pos), false);
465
    }
465
    }
466
    else
466
    else
467
    {
467
    {
468
        QMessageBox msgB;
468
        QMessageBox msgB;
469
        QString msg;
469
        QString msg;
470
        msg += "Bitte die Eingabe ueberpruefen!\n";
470
        msg += "Bitte die Eingabe ueberpruefen!\n";
471
        msg += "Die Werte muessen sich in der Naehe der aktuellen Koordinaten befinden\n";
471
        msg += "Die Werte muessen sich in der Naehe der aktuellen Koordinaten befinden\n";
472
        msg += "(Lon: ";
472
        msg += "(Lon: ";
473
        msg += ToolBox::get_Float(Navi.Current.Longitude,10000000);
473
        msg += ToolBox::get_Float(Navi.Current.Longitude,7);
474
        msg += ", ";
474
        msg += ", ";
475
        msg += "Lat: ";
475
        msg += "Lat: ";
476
        msg += ToolBox::get_Float(Navi.Current.Latitude,10000000);
476
        msg += ToolBox::get_Float(Navi.Current.Latitude,7);
477
        msg += ")";
477
        msg += ")";
478
        msgB.setText(msg);
478
        msgB.setText(msg);
479
        msgB.exec();
479
        msgB.exec();
480
    }
480
    }
481
}
481
}
482
 
482
 
483
void MKTool::slot_ac_Hardware()
483
void MKTool::slot_ac_Hardware()
484
{
484
{
485
    QAction *Action = (QAction*)sender();
485
    QAction *Action = (QAction*)sender();
486
 
486
 
487
    if (Action->isChecked() == false)
487
    if (Action->isChecked() == false)
488
    {
488
    {
489
        Action->setChecked(true);
489
        Action->setChecked(true);
490
    }
490
    }
491
 
491
 
492
    slot_rb_Hardware();
492
    slot_rb_Hardware();
493
}
493
}
494
 
494
 
495
void MKTool::slot_rb_Hardware()
495
void MKTool::slot_rb_Hardware()
496
{
496
{
497
    if ((rb_SelNC->isChecked() == false) && (Mode.ID != ADDRESS_NC))
497
    if ((rb_SelNC->isChecked() == false) && (Mode.ID != ADDRESS_NC))
498
    {
498
    {
499
        lb_Status->setText(tr("Schalte um auf NaviCtrl."));
499
        lb_Status->setText(tr("Schalte um auf NaviCtrl."));
500
        TX_Data[0] = 0x1B;
500
        TX_Data[0] = 0x1B;
501
        TX_Data[1] = 0x1B;
501
        TX_Data[1] = 0x1B;
502
        TX_Data[2] = 0x55;
502
        TX_Data[2] = 0x55;
503
        TX_Data[3] = 0xAA;
503
        TX_Data[3] = 0xAA;
504
        TX_Data[4] = 0x00;
504
        TX_Data[4] = 0x00;
505
        TX_Data[5] = '\r';
505
        TX_Data[5] = '\r';
506
        o_Connection->send_Cmd('#', ADDRESS_NC, TX_Data, 6, false);
506
        o_Connection->send_Cmd('#', ADDRESS_NC, TX_Data, 6, false);
507
        ToolBox::Wait(SLEEP);
507
        ToolBox::Wait(SLEEP);
508
    }
508
    }
509
 
509
 
510
    if (rb_SelFC->isChecked())
510
    if (rb_SelFC->isChecked())
511
    {
511
    {
512
        lb_Status->setText(tr("Schalte um auf FlightCtrl."));
512
        lb_Status->setText(tr("Schalte um auf FlightCtrl."));
513
        TX_Data[0] = 0;
513
        TX_Data[0] = 0;
514
        o_Connection->send_Cmd('u', ADDRESS_NC, TX_Data, 1, false);
514
        o_Connection->send_Cmd('u', ADDRESS_NC, TX_Data, 1, false);
515
    }
515
    }
516
    else
516
    else
517
    if (rb_SelMag->isChecked())
517
    if (rb_SelMag->isChecked())
518
    {
518
    {
519
        lb_Status->setText(tr("Schalte um auf MK3MAG."));
519
        lb_Status->setText(tr("Schalte um auf MK3MAG."));
520
        TX_Data[0] = 1;
520
        TX_Data[0] = 1;
521
        o_Connection->send_Cmd('u', ADDRESS_NC, TX_Data, 1, false);
521
        o_Connection->send_Cmd('u', ADDRESS_NC, TX_Data, 1, false);
522
    }
522
    }
523
    else
523
    else
524
    if (rb_SelNC->isChecked())
524
    if (rb_SelNC->isChecked())
525
    {
525
    {
526
        lb_Status->setText(tr("Schalte um auf NaviCtrl."));
526
        lb_Status->setText(tr("Schalte um auf NaviCtrl."));
527
        TX_Data[0] = 0x1B;
527
        TX_Data[0] = 0x1B;
528
        TX_Data[1] = 0x1B;
528
        TX_Data[1] = 0x1B;
529
        TX_Data[2] = 0x55;
529
        TX_Data[2] = 0x55;
530
        TX_Data[3] = 0xAA;
530
        TX_Data[3] = 0xAA;
531
        TX_Data[4] = 0x00;
531
        TX_Data[4] = 0x00;
532
        TX_Data[5] = '\r';
532
        TX_Data[5] = '\r';
533
        o_Connection->send_Cmd('#', ADDRESS_NC, TX_Data, 6, false);
533
        o_Connection->send_Cmd('#', ADDRESS_NC, TX_Data, 6, false);
534
    }
534
    }
535
    ToolBox::Wait(SLEEP);
535
    ToolBox::Wait(SLEEP);
536
 
536
 
537
//    qDebug("Select RB Hardware");
537
//    qDebug("Select RB Hardware");
538
    o_Connection->send_Cmd('v', ADDRESS_ALL, TX_Data, 0, true);
538
    o_Connection->send_Cmd('v', ADDRESS_ALL, TX_Data, 0, true);
539
}
539
}
540
 
540
 
541
// Ticker-Event
541
// Ticker-Event
542
///////////////
542
///////////////
543
void MKTool::slot_Ticker()
543
void MKTool::slot_Ticker()
544
{
544
{
545
    if (TickerDiv)
545
    if (TickerDiv)
546
        TickerDiv = false;
546
        TickerDiv = false;
547
    else
547
    else
548
        TickerDiv = true;
548
        TickerDiv = true;
549
 
549
 
550
    if (cb_ClipBoard->isChecked())
550
    if (cb_ClipBoard->isChecked())
551
    {
551
    {
552
        QString s_OLD = te_KML->toPlainText();
552
        QString s_OLD = te_KML->toPlainText();
553
        te_KML->clear();
553
        te_KML->clear();
554
        te_KML->paste();
554
        te_KML->paste();
555
        if (s_OLD != te_KML->toPlainText())
555
        if (s_OLD != te_KML->toPlainText())
556
        {
556
        {
557
            parse_TargetKML();
557
            parse_TargetKML();
558
        }
558
        }
559
    }
559
    }
560
 
560
 
561
    for (int a = 0; a < MaxTickerEvents; a++)
561
    for (int a = 0; a < MaxTickerEvents; a++)
562
    {
562
    {
563
        if (TickerEvent[a] == true)
563
        if (TickerEvent[a] == true)
564
        {
564
        {
565
            switch(a)
565
            switch(a)
566
            {
566
            {
567
                case 0 :
567
                case 0 :
568
                    if (TickerDiv)
568
                    if (TickerDiv)
569
                    {
569
                    {
570
                        QByteArray Temp(LastSend.toUtf8());
570
                        QByteArray Temp(LastSend.toUtf8());
571
//                        serialPort->sendData(Temp);
571
//                        serialPort->sendData(Temp);
572
                    }
572
                    }
573
                break;
573
                break;
574
                case 1 :
574
                case 1 :
575
                    TX_Data[0] = 0;
575
                    TX_Data[0] = 0;
576
                    o_Connection->send_Cmd('p', ADDRESS_FC, TX_Data, 0, false);
576
                    o_Connection->send_Cmd('p', ADDRESS_FC, TX_Data, 0, false);
577
                break;
577
                break;
578
                case 2 :
578
                case 2 :
579
                    if (f_LCD->cb_LCD->isChecked())
579
                    if (f_LCD->cb_LCD->isChecked())
580
                    {
580
                    {
581
                        if (!f_LCD->isVisible())
581
                        if (!f_LCD->isVisible())
582
                        {
582
                        {
583
                            Ticker->setInterval(2000);
583
                            Ticker->setInterval(2000);
584
                            TickerEvent[2] = false;
584
                            TickerEvent[2] = false;
585
                        }
585
                        }
586
                        TX_Data[0] = LCD_Page;
586
                        TX_Data[0] = LCD_Page;
587
                        TX_Data[1] = 0;
587
                        TX_Data[1] = 0;
588
                        o_Connection->send_Cmd('l', ADDRESS_ALL, TX_Data, 1, true);
588
                        o_Connection->send_Cmd('l', ADDRESS_ALL, TX_Data, 1, true);
589
                    }
589
                    }
590
                break;
590
                break;
591
                case 3 :
591
                case 3 :
592
                    if (ac_FastDebug->isChecked())
592
                    if (ac_FastDebug->isChecked())
593
                    {
593
                    {
594
                        TX_Data[0] = Settings->Data.Debug_Fast / 10;
594
                        TX_Data[0] = Settings->Data.Debug_Fast / 10;
595
                        o_Connection->send_Cmd('d', ADDRESS_ALL, TX_Data, 1, false);
595
                        o_Connection->send_Cmd('d', ADDRESS_ALL, TX_Data, 1, false);
596
                    }
596
                    }
597
                    else
597
                    else
598
                    {
598
                    {
599
                        TX_Data[0] = Settings->Data.Debug_Slow / 10;
599
                        TX_Data[0] = Settings->Data.Debug_Slow / 10;
600
                        o_Connection->send_Cmd('d', ADDRESS_ALL, TX_Data, 1, false);
600
                        o_Connection->send_Cmd('d', ADDRESS_ALL, TX_Data, 1, false);
601
                    }
601
                    }
602
                break;
602
                break;
603
            }
603
            }
604
        }
604
        }
605
    }
605
    }
606
}
606
}
607
 
607
 
608
void MKTool::slot_QMKS_Connect()
608
void MKTool::slot_QMKS_Connect()
609
{
609
{
610
    if (ac_QMKServer->isChecked())
610
    if (ac_QMKServer->isChecked())
611
    {
611
    {
612
        lb_Status->setText(tr("Verbinde zum QMK-Datenserver."));
612
        lb_Status->setText(tr("Verbinde zum QMK-Datenserver."));
613
 
613
 
614
        QMK_Server->Connect(Settings->Server.QMKS_Host, Settings->Server.QMKS_Port.toInt(), Settings->Server.QMKS_Login, Settings->Server.QMKS_Password);
614
        QMK_Server->Connect(Settings->Server.QMKS_Host, Settings->Server.QMKS_Port.toInt(), Settings->Server.QMKS_Login, Settings->Server.QMKS_Password);
615
 
615
 
616
        connect(QMK_Server, SIGNAL(sig_Connected()), this, SLOT(slot_QMKS_Connected()));
616
        connect(QMK_Server, SIGNAL(sig_Connected()), this, SLOT(slot_QMKS_Connected()));
617
        connect(QMK_Server, SIGNAL(sig_Disconnected(int)), this, SLOT(slot_QMKS_Disconnected(int)));
617
        connect(QMK_Server, SIGNAL(sig_Disconnected(int)), this, SLOT(slot_QMKS_Disconnected(int)));
618
    }
618
    }
619
    else
619
    else
620
    {
620
    {
621
        if ((QMK_Server->property("Connect")) == true)
621
        if ((QMK_Server->property("Connect")) == true)
622
        {
622
        {
623
            disconnect(QMK_Server, SIGNAL(sig_Disconnected(int)), 0, 0);
623
            disconnect(QMK_Server, SIGNAL(sig_Disconnected(int)), 0, 0);
624
            lb_Status->setText(tr("Trenne vom QMK-Datenserver."));
624
            lb_Status->setText(tr("Trenne vom QMK-Datenserver."));
625
 
625
 
626
            QMK_Server->Disconnect();
626
            QMK_Server->Disconnect();
627
            QMK_Server->setProperty("Connect", false);
627
            QMK_Server->setProperty("Connect", false);
628
            ac_QMKServer->setText("QMK-Server Verbinden");
628
            ac_QMKServer->setText("QMK-Server Verbinden");
629
        }
629
        }
630
    }
630
    }
631
}
631
}
632
 
632
 
633
void MKTool::slot_QMKS_Connected()
633
void MKTool::slot_QMKS_Connected()
634
{
634
{
635
    QMK_Server->setProperty("Connect", true);
635
    QMK_Server->setProperty("Connect", true);
636
    ac_QMKServer->setText("QMK-Server Trennnen");
636
    ac_QMKServer->setText("QMK-Server Trennnen");
637
    lb_Status->setText(tr("Verbunden mit QMK-Datenserver."));
637
    lb_Status->setText(tr("Verbunden mit QMK-Datenserver."));
638
}
638
}
639
 
639
 
640
void MKTool::slot_QMKS_Disconnected(int Error)
640
void MKTool::slot_QMKS_Disconnected(int Error)
641
{
641
{
642
    QMK_Server->setProperty("Connect", false);
642
    QMK_Server->setProperty("Connect", false);
643
    ac_QMKServer->setText("QMK-Server Verbinden");
643
    ac_QMKServer->setText("QMK-Server Verbinden");
644
    ac_QMKServer->setChecked(false);
644
    ac_QMKServer->setChecked(false);
645
 
645
 
646
    disconnect(QMK_Server, SIGNAL(sig_Disconnected(int)), 0, 0);
646
    disconnect(QMK_Server, SIGNAL(sig_Disconnected(int)), 0, 0);
647
 
647
 
648
    switch (Error)
648
    switch (Error)
649
    {
649
    {
650
        case 1 :
650
        case 1 :
651
        {
651
        {
652
            lb_Status->setText(tr("Verbindung vom Server beendet."));
652
            lb_Status->setText(tr("Verbindung vom Server beendet."));
653
            QMessageBox::warning(this, QA_NAME,"QMK-Datenserver: Verbindung wurde vom Server beendet.", QMessageBox::Ok);
653
            QMessageBox::warning(this, QA_NAME,"QMK-Datenserver: Verbindung wurde vom Server beendet.", QMessageBox::Ok);
654
        }
654
        }
655
        break;
655
        break;
656
        case 2 :
656
        case 2 :
657
        {
657
        {
658
            lb_Status->setText(tr("Server nicht gefunden."));
658
            lb_Status->setText(tr("Server nicht gefunden."));
659
            QMessageBox::warning(this, QA_NAME,"QMK-Datenserver: Kann nicht zum Server verbinden.", QMessageBox::Ok);
659
            QMessageBox::warning(this, QA_NAME,"QMK-Datenserver: Kann nicht zum Server verbinden.", QMessageBox::Ok);
660
        }
660
        }
661
        break;
661
        break;
662
        case 3 :
662
        case 3 :
663
        {
663
        {
664
            lb_Status->setText(tr("Serververbindung getrennt. Logindaten falsch."));
664
            lb_Status->setText(tr("Serververbindung getrennt. Logindaten falsch."));
665
            QMessageBox::warning(this, QA_NAME,"QMK-Datenserver: Loginname oder Password falsch.", QMessageBox::Ok);
665
            QMessageBox::warning(this, QA_NAME,"QMK-Datenserver: Loginname oder Password falsch.", QMessageBox::Ok);
666
        }
666
        }
667
        break;
667
        break;
668
        default :
668
        default :
669
        {
669
        {
670
            lb_Status->setText(tr("Getrennt vom QMK-Datenserver."));
670
            lb_Status->setText(tr("Getrennt vom QMK-Datenserver."));
671
        }
671
        }
672
        break;
672
        break;
673
    }
673
    }
674
}
674
}
675
 
675
 
676
// Slots der Actions (Menüpunkte, Buttons)
676
// Slots der Actions (Menüpunkte, Buttons)
677
//////////////////////////////////////////
677
//////////////////////////////////////////
678
void MKTool::slot_ac_Motortest()
678
void MKTool::slot_ac_Motortest()
679
{
679
{
680
    dlg_Motortest *f_Motortest = new dlg_Motortest(this);
680
    dlg_Motortest *f_Motortest = new dlg_Motortest(this);
681
 
681
 
682
    connect(f_Motortest, SIGNAL(updateMotor(int, int, int, int)), this, SLOT(slot_Motortest(int, int, int, int)));
682
    connect(f_Motortest, SIGNAL(updateMotor(int, int, int, int)), this, SLOT(slot_Motortest(int, int, int, int)));
683
 
683
 
684
    if (f_Motortest->exec()==QDialog::Accepted)
684
    if (f_Motortest->exec()==QDialog::Accepted)
685
    {
685
    {
686
    }
686
    }
687
 
687
 
688
    disconnect(f_Motortest, 0,0,0);
688
    disconnect(f_Motortest, 0,0,0);
689
    slot_Motortest(0,0,0,0);
689
    slot_Motortest(0,0,0,0);
690
}
690
}
691
 
691
 
692
void MKTool::slot_ac_MotorMixer()
692
void MKTool::slot_ac_MotorMixer()
693
{
693
{
694
    f_MotorMixer->set_Objects(o_Connection, Settings);
694
    f_MotorMixer->set_Objects(o_Connection, Settings);
695
    f_MotorMixer->read_Mixer();
695
    f_MotorMixer->read_Mixer();
696
 
696
 
697
    if (f_MotorMixer->exec()==QDialog::Accepted)
697
    if (f_MotorMixer->exec()==QDialog::Accepted)
698
    {
698
    {
699
    }
699
    }
700
}
700
}
701
 
701
 
702
void MKTool::slot_ac_LCD()
702
void MKTool::slot_ac_LCD()
703
{
703
{
704
    if (!f_LCD->isVisible())
704
    if (!f_LCD->isVisible())
705
    {
705
    {
706
        delete f_LCD;
706
        delete f_LCD;
707
        f_LCD = new dlg_LCD(this);
707
        f_LCD = new dlg_LCD(this);
708
 
708
 
709
        // LCD auf / ab
709
        // LCD auf / ab
710
        connect(f_LCD->pb_LCDup,   SIGNAL(clicked()), this, SLOT(slot_LCD_UP()));
710
        connect(f_LCD->pb_LCDup,   SIGNAL(clicked()), this, SLOT(slot_LCD_UP()));
711
        connect(f_LCD->pb_LCDdown, SIGNAL(clicked()), this, SLOT(slot_LCD_DOWN()));
711
        connect(f_LCD->pb_LCDdown, SIGNAL(clicked()), this, SLOT(slot_LCD_DOWN()));
712
 
712
 
713
        f_LCD->show();
713
        f_LCD->show();
714
        TX_Data[0] = 0;
714
        TX_Data[0] = 0;
715
        TX_Data[1] = 0;
715
        TX_Data[1] = 0;
716
        o_Connection->send_Cmd('l', ADDRESS_ALL, TX_Data, 1, true);
716
        o_Connection->send_Cmd('l', ADDRESS_ALL, TX_Data, 1, true);
717
 
717
 
718
        Ticker->setInterval(500);
718
        Ticker->setInterval(500);
719
        TickerEvent[2] = true;
719
        TickerEvent[2] = true;
720
    }
720
    }
721
}
721
}
722
 
722
 
723
void MKTool::slot_ac_Map()
723
void MKTool::slot_ac_Map()
724
{
724
{
725
    if (!f_Map->isVisible())
725
    if (!f_Map->isVisible())
726
    {
726
    {
727
        f_Map->show();
727
        f_Map->show();
728
    }
728
    }
729
}
729
}
730
 
730
 
731
void MKTool::slot_MAP_SetTarget(sWayPoint Target)
731
void MKTool::slot_MAP_SetTarget(sWayPoint Target)
732
{
732
{
733
    le_TarLong->setText(QString("%1").arg(Target.Longitude));
733
    le_TarLong->setText(QString("%1").arg(Target.Longitude));
734
    le_TarLat->setText(QString("%1").arg(Target.Latitude));
734
    le_TarLat->setText(QString("%1").arg(Target.Latitude));
735
    sb_TarTime->setValue(Target.Time);
735
    sb_TarTime->setValue(Target.Time);
736
 
736
 
737
    slot_pb_SendWaypoint();
737
    slot_pb_SendWaypoint();
738
}
738
}
739
 
739
 
740
void MKTool::slot_Motortest(int Motor1, int Motor2, int Motor3, int Motor4)
740
void MKTool::slot_Motortest(int Motor1, int Motor2, int Motor3, int Motor4)
741
{
741
{
742
    TX_Data[0] = Motor1;
742
    TX_Data[0] = Motor1;
743
    TX_Data[1] = Motor2;
743
    TX_Data[1] = Motor2;
744
    TX_Data[2] = Motor3;
744
    TX_Data[2] = Motor3;
745
    TX_Data[3] = Motor4;
745
    TX_Data[3] = Motor4;
746
    o_Connection->send_Cmd('t', ADDRESS_FC, TX_Data, 4, false);
746
    o_Connection->send_Cmd('t', ADDRESS_FC, TX_Data, 4, false);
747
}
747
}
748
 
748
 
749
void MKTool::slot_ac_Config()
749
void MKTool::slot_ac_Config()
750
{
750
{
751
    set_Analog Old_Analog1;
751
    set_Analog Old_Analog1;
752
 
752
 
753
    Old_Analog1 = Settings->Analog1;
753
    Old_Analog1 = Settings->Analog1;
754
 
754
 
755
    dlg_Config *f_Config = new dlg_Config(this);
755
    dlg_Config *f_Config = new dlg_Config(this);
756
    f_Config->set_Settings(Settings, Mode.ID);
756
    f_Config->set_Settings(Settings, Mode.ID);
757
 
757
 
758
    if (f_Config->exec()==QDialog::Accepted)
758
    if (f_Config->exec()==QDialog::Accepted)
759
    {
759
    {
760
        Settings = f_Config->get_Settings();
760
        Settings = f_Config->get_Settings();
761
        Settings->write_Settings_Analog(Mode.ID);
761
        Settings->write_Settings_Analog(Mode.ID);
762
 
762
 
763
        // Plotter neu einrichten
763
        // Plotter neu einrichten
764
        if (Old_Analog1.PlotView != Settings->Analog1.PlotView)
764
        if (Old_Analog1.PlotView != Settings->Analog1.PlotView)
765
        {
765
        {
766
            config_Plot();
766
            config_Plot();
767
        }
767
        }
768
 
768
 
769
        // CVS-Datei neu anlegen.
769
        // CVS-Datei neu anlegen.
770
        if ((logger->is_active()) && (Old_Analog1.LogView != Settings->Analog1.LogView))
770
        if ((logger->is_active()) && (Old_Analog1.LogView != Settings->Analog1.LogView))
771
        {
771
        {
772
            logger->close();
772
            logger->close();
773
            logger->start_Log();
773
            logger->start_Log();
774
        }
774
        }
775
 
775
 
776
    }
776
    }
777
}
777
}
778
 
778
 
779
//aktualisiere Logging-Status
779
//aktualisiere Logging-Status
780
void MKTool::update_Log()
780
void MKTool::update_Log()
781
{
781
{
782
    if (logger->is_active())
782
    if (logger->is_active())
783
    {
783
    {
784
 
784
 
785
        ac_RecordCSV->setText("Log Stop");
785
        ac_RecordCSV->setText("Log Stop");
786
        lb_Status->setText(tr("Log-Record gestartet."));
786
        lb_Status->setText(tr("Log-Record gestartet."));
787
    }
787
    }
788
    else
788
    else
789
    {
789
    {
790
        ac_RecordCSV->setText("Log Aufzeichnen");
790
        ac_RecordCSV->setText("Log Aufzeichnen");
791
        lb_Status->setText(tr("Log-Record gestopt."));
791
        lb_Status->setText(tr("Log-Record gestopt."));
792
    }
792
    }
793
}
793
}
794
 
794
 
795
//starte/stoppe Logging, wenn auf den entsprechenden Button gedrückt wurde
795
//starte/stoppe Logging, wenn auf den entsprechenden Button gedrückt wurde
796
void MKTool::slot_RecordLog()
796
void MKTool::slot_RecordLog()
797
{
797
{
798
    if (!logger->is_active())
798
    if (!logger->is_active())
799
        logger->start_Log();
799
        logger->start_Log();
800
    else
800
    else
801
        logger->close();
801
        logger->close();
802
 
802
 
803
    update_Log();
803
    update_Log();
804
}
804
}
805
 
805
 
806
void MKTool::slot_ac_Preferences()
806
void MKTool::slot_ac_Preferences()
807
{
807
{
808
    dlg_Preferences *f_Preferences = new dlg_Preferences(this);
808
    dlg_Preferences *f_Preferences = new dlg_Preferences(this);
809
 
809
 
810
    Settings->TTY.Port = le_Port->text();
810
    Settings->TTY.Port = le_Port->text();
811
    f_Preferences->set_Settings(Settings);
811
    f_Preferences->set_Settings(Settings);
812
 
812
 
813
    if (f_Preferences->exec()==QDialog::Accepted)
813
    if (f_Preferences->exec()==QDialog::Accepted)
814
    {
814
    {
815
        Settings = f_Preferences->get_Settings();
815
        Settings = f_Preferences->get_Settings();
816
        Settings->write_Settings();
816
        Settings->write_Settings();
817
        le_Port->setText(Settings->TTY.Port);
817
        le_Port->setText(Settings->TTY.Port);
818
        config_Plot();
818
        config_Plot();
819
    }
819
    }
820
}
820
}
821
 
821
 
822
void MKTool::slot_ac_StartPlotter()
822
void MKTool::slot_ac_StartPlotter()
823
{
823
{
824
    if (ac_StartPlotter->isChecked())
824
    if (ac_StartPlotter->isChecked())
825
    {
825
    {
826
        lb_Status->setText(tr("Datenplotter gestartet."));
826
        lb_Status->setText(tr("Datenplotter gestartet."));
827
        ac_StartPlotter->setText("Stop Plotter");
827
        ac_StartPlotter->setText("Stop Plotter");
828
        pb_StartPlotter->setText("Stop Plotter");
828
        pb_StartPlotter->setText("Stop Plotter");
829
    }
829
    }
830
    else
830
    else
831
    {
831
    {
832
        lb_Status->setText(tr("Datenplotter gestopt."));
832
        lb_Status->setText(tr("Datenplotter gestopt."));
833
        ac_StartPlotter->setText("Start Plotter");
833
        ac_StartPlotter->setText("Start Plotter");
834
        pb_StartPlotter->setText("Start Plotter");
834
        pb_StartPlotter->setText("Start Plotter");
835
    }
835
    }
836
}
836
}
837
 
837
 
838
void MKTool::slot_ac_View()
838
void MKTool::slot_ac_View()
839
{
839
{
840
    int Aktive = -1;
840
    int Aktive = -1;
841
 
841
 
842
    QAction *Action = (QAction*)sender();
842
    QAction *Action = (QAction*)sender();
843
 
843
 
844
    if (Action->objectName() == QString("ac_View0"))
844
    if (Action->objectName() == QString("ac_View0"))
845
        Aktive = 0;
845
        Aktive = 0;
846
    if (Action->objectName() == QString("ac_View1"))
846
    if (Action->objectName() == QString("ac_View1"))
847
        Aktive = 1;
847
        Aktive = 1;
848
    if (Action->objectName() == QString("ac_View2"))
848
    if (Action->objectName() == QString("ac_View2"))
849
        Aktive = 2;
849
        Aktive = 2;
850
    if (Action->objectName() == QString("ac_View3"))
850
    if (Action->objectName() == QString("ac_View3"))
851
        Aktive = 3;
851
        Aktive = 3;
852
    if (Action->objectName() == QString("ac_View4"))
852
    if (Action->objectName() == QString("ac_View4"))
853
        Aktive = 4;
853
        Aktive = 4;
854
    if (Action->objectName() == QString("ac_View5"))
854
    if (Action->objectName() == QString("ac_View5"))
855
        Aktive = 5;
855
        Aktive = 5;
856
    if (Action->objectName() == QString("ac_View6"))
856
    if (Action->objectName() == QString("ac_View6"))
857
        Aktive = 6;
857
        Aktive = 6;
858
 
858
 
859
    QString TabName = QString("Tab_%1").arg(Aktive);
859
    QString TabName = QString("Tab_%1").arg(Aktive);
860
 
860
 
861
    if (!Action->isChecked())
861
    if (!Action->isChecked())
862
    {
862
    {
863
        for (int a = 0; a < tab_Main->count(); a++)
863
        for (int a = 0; a < tab_Main->count(); a++)
864
        {
864
        {
865
            if (tab_Main->widget(a)->objectName() == TabName)
865
            if (tab_Main->widget(a)->objectName() == TabName)
866
            {
866
            {
867
                tab_Main->removeTab(a);
867
                tab_Main->removeTab(a);
868
            }
868
            }
869
        }
869
        }
870
    }
870
    }
871
    else
871
    else
872
    {
872
    {
873
        tab_Main->insertTab(Aktive, TabWidgets[Aktive], Action->icon(), Action->text());
873
        tab_Main->insertTab(Aktive, TabWidgets[Aktive], Action->icon(), Action->text());
874
    }
874
    }
875
}
875
}
876
 
876
 
877
void MKTool::slot_ac_FastNavi() // DONE NC 0.12i
877
void MKTool::slot_ac_FastNavi() // DONE NC 0.12i
878
{
878
{
879
    if (!ac_NoNavi->isChecked())
879
    if (!ac_NoNavi->isChecked())
880
    {
880
    {
881
        if (ac_FastNavi->isChecked())
881
        if (ac_FastNavi->isChecked())
882
        {
882
        {
883
            lb_Status->setText(tr("Fordere schnelle NaviDaten an."));
883
            lb_Status->setText(tr("Fordere schnelle NaviDaten an."));
884
            TX_Data[0] = Settings->Data.Navi_Fast / 10;
884
            TX_Data[0] = Settings->Data.Navi_Fast / 10;
885
        }
885
        }
886
        else
886
        else
887
        {
887
        {
888
            lb_Status->setText(tr("Fordere langsame NaviDaten an."));
888
            lb_Status->setText(tr("Fordere langsame NaviDaten an."));
889
            TX_Data[0] = Settings->Data.Navi_Slow / 10;
889
            TX_Data[0] = Settings->Data.Navi_Slow / 10;
890
        }
890
        }
891
        o_Connection->send_Cmd('o', ADDRESS_NC, TX_Data, 1, false);
891
        o_Connection->send_Cmd('o', ADDRESS_NC, TX_Data, 1, false);
892
    }
892
    }
893
}
893
}
894
 
894
 
895
void MKTool::slot_ac_NoNavi() // DONE NC 0.12i
895
void MKTool::slot_ac_NoNavi() // DONE NC 0.12i
896
{
896
{
897
    if (ac_NoNavi->isChecked())
897
    if (ac_NoNavi->isChecked())
898
    {
898
    {
899
        lb_Status->setText(tr("NaviDaten abstellen."));
899
        lb_Status->setText(tr("NaviDaten abstellen."));
900
        TX_Data[0] = 0;
900
        TX_Data[0] = 0;
901
    }
901
    }
902
    else
902
    else
903
    {
903
    {
904
        if (ac_FastNavi->isChecked())
904
        if (ac_FastNavi->isChecked())
905
        {
905
        {
906
            lb_Status->setText(tr("Fordere schnelle NaviDaten an."));
906
            lb_Status->setText(tr("Fordere schnelle NaviDaten an."));
907
            TX_Data[0] = Settings->Data.Navi_Fast / 10;
907
            TX_Data[0] = Settings->Data.Navi_Fast / 10;
908
        }
908
        }
909
        else
909
        else
910
        {
910
        {
911
            lb_Status->setText(tr("Fordere langsame NaviDaten an."));
911
            lb_Status->setText(tr("Fordere langsame NaviDaten an."));
912
            TX_Data[0] = Settings->Data.Navi_Slow / 10;
912
            TX_Data[0] = Settings->Data.Navi_Slow / 10;
913
        }
913
        }
914
    }
914
    }
915
    o_Connection->send_Cmd('o', ADDRESS_NC, TX_Data, 1, false);
915
    o_Connection->send_Cmd('o', ADDRESS_NC, TX_Data, 1, false);
916
}
916
}
917
 
917
 
918
void MKTool::slot_ac_FastDebug() // DONE 0.71g
918
void MKTool::slot_ac_FastDebug() // DONE 0.71g
919
{
919
{
920
    if (!ac_NoDebug->isChecked())
920
    if (!ac_NoDebug->isChecked())
921
    {
921
    {
922
        if (ac_FastDebug->isChecked())
922
        if (ac_FastDebug->isChecked())
923
        {
923
        {
924
            lb_Status->setText(tr("Fordere schnelle DebugDaten an."));
924
            lb_Status->setText(tr("Fordere schnelle DebugDaten an."));
925
            TX_Data[0] = Settings->Data.Debug_Fast / 10;
925
            TX_Data[0] = Settings->Data.Debug_Fast / 10;
926
        }
926
        }
927
        else
927
        else
928
        {
928
        {
929
            lb_Status->setText(tr("Fordere langsame DebugDaten an."));
929
            lb_Status->setText(tr("Fordere langsame DebugDaten an."));
930
            TX_Data[0] = Settings->Data.Debug_Slow / 10;
930
            TX_Data[0] = Settings->Data.Debug_Slow / 10;
931
        }
931
        }
932
        o_Connection->send_Cmd('d', ADDRESS_ALL, TX_Data, 1, false);
932
        o_Connection->send_Cmd('d', ADDRESS_ALL, TX_Data, 1, false);
933
    }
933
    }
934
}
934
}
935
 
935
 
936
void MKTool::slot_ac_NoDebug() // DONE 0.71g
936
void MKTool::slot_ac_NoDebug() // DONE 0.71g
937
{
937
{
938
    if (ac_NoDebug->isChecked())
938
    if (ac_NoDebug->isChecked())
939
    {
939
    {
940
        lb_Status->setText(tr("DebugDaten abstellen."));
940
        lb_Status->setText(tr("DebugDaten abstellen."));
941
        TickerEvent[3] = false;
941
        TickerEvent[3] = false;
942
        TX_Data[0] = 0;
942
        TX_Data[0] = 0;
943
    }
943
    }
944
    else
944
    else
945
    {
945
    {
946
        // Wenn MK3MAG dann andauernd Daten neu anfragen.
946
        // Wenn MK3MAG dann andauernd Daten neu anfragen.
947
        if (Mode.ID == ADDRESS_MK3MAG)
947
        if (Mode.ID == ADDRESS_MK3MAG)
948
            TickerEvent[3] = true;
948
            TickerEvent[3] = true;
949
 
949
 
950
        if (ac_FastDebug->isChecked())
950
        if (ac_FastDebug->isChecked())
951
        {
951
        {
952
            lb_Status->setText(tr("Fordere schnelle DebugDaten an."));
952
            lb_Status->setText(tr("Fordere schnelle DebugDaten an."));
953
            TX_Data[0] = Settings->Data.Debug_Fast / 10;
953
            TX_Data[0] = Settings->Data.Debug_Fast / 10;
954
        }
954
        }
955
        else
955
        else
956
        {
956
        {
957
            lb_Status->setText(tr("Fordere langsame DebugDaten an."));
957
            lb_Status->setText(tr("Fordere langsame DebugDaten an."));
958
            TX_Data[0] = Settings->Data.Debug_Slow / 10;
958
            TX_Data[0] = Settings->Data.Debug_Slow / 10;
959
        }
959
        }
960
    }
960
    }
961
    o_Connection->send_Cmd('d', ADDRESS_ALL, TX_Data, 1, false);
961
    o_Connection->send_Cmd('d', ADDRESS_ALL, TX_Data, 1, false);
962
}
962
}
963
 
963
 
964
void MKTool::slot_ac_About()
964
void MKTool::slot_ac_About()
965
{
965
{
966
    QMessageBox::about(this, trUtf8(("Über ")) + QA_NAME, QA_ABOUT);
966
    QMessageBox::about(this, trUtf8(("Über ")) + QA_NAME, QA_ABOUT);
967
}
967
}
968
 
968
 
969
void MKTool::slot_ac_GetLabels() // DONE 0.71g
969
void MKTool::slot_ac_GetLabels() // DONE 0.71g
970
{
970
{
971
    lb_Status->setText(tr("Analoglabels auslesen."));
971
    lb_Status->setText(tr("Analoglabels auslesen."));
972
    TX_Data[0] = 0;
972
    TX_Data[0] = 0;
973
    o_Connection->send_Cmd('a', ADDRESS_ALL, TX_Data, 1, true);
973
    o_Connection->send_Cmd('a', ADDRESS_ALL, TX_Data, 1, true);
974
}
974
}
975
 
975
 
976
void MKTool::slot_ac_StartServer()
976
void MKTool::slot_ac_StartServer()
977
{
977
{
978
    if (ac_StartServer->isChecked())
978
    if (ac_StartServer->isChecked())
979
    {
979
    {
980
        lb_Status->setText(tr("KML-Server gestartet."));
980
        lb_Status->setText(tr("KML-Server gestartet."));
981
        KML_Server->start_Server(Settings->Server.Port.toInt(), Settings);
981
        KML_Server->start_Server(Settings->Server.Port.toInt(), Settings);
982
    }
982
    }
983
    else
983
    else
984
    {
984
    {
985
        lb_Status->setText(tr("KML-Server gestopt."));
985
        lb_Status->setText(tr("KML-Server gestopt."));
986
        KML_Server->stop_Server();
986
        KML_Server->stop_Server();
987
    }
987
    }
988
}
988
}
989
 
989
 
990
 
990
 
991
//  Daten-Plotter
991
//  Daten-Plotter
992
/////////////////
992
/////////////////
993
void MKTool::update_Plot()
993
void MKTool::update_Plot()
994
{
994
{
995
    for (int a = 0; a < MaxAnalog; a++)
995
    for (int a = 0; a < MaxAnalog; a++)
996
    {
996
    {
997
        Plot[a]->setData(aID,aData[a],NextPlot - 1);
997
        Plot[a]->setData(aID,aData[a],NextPlot - 1);
998
    }
998
    }
999
 
999
 
1000
    if ((NextPlot > Settings->Data.Plotter_Count))
1000
    if ((NextPlot > Settings->Data.Plotter_Count))
1001
    {
1001
    {
1002
        scroll_plot->setMaximum(NextPlot - Settings->Data.Plotter_Count);
1002
        scroll_plot->setMaximum(NextPlot - Settings->Data.Plotter_Count);
1003
    }
1003
    }
1004
 
1004
 
1005
    if ((scroll_plot->value() == NextPlot - (Settings->Data.Plotter_Count + 1)))
1005
    if ((scroll_plot->value() == NextPlot - (Settings->Data.Plotter_Count + 1)))
1006
    {
1006
    {
1007
        qwtPlot->setAxisScale(QwtPlot::xBottom,NextPlot - Settings->Data.Plotter_Count,NextPlot,0);
1007
        qwtPlot->setAxisScale(QwtPlot::xBottom,NextPlot - Settings->Data.Plotter_Count,NextPlot,0);
1008
        scroll_plot->setValue(NextPlot - Settings->Data.Plotter_Count);
1008
        scroll_plot->setValue(NextPlot - Settings->Data.Plotter_Count);
1009
    }
1009
    }
1010
 
1010
 
1011
    qwtPlot->replot();
1011
    qwtPlot->replot();
1012
}
1012
}
1013
 
1013
 
1014
void MKTool::config_Plot()
1014
void MKTool::config_Plot()
1015
{
1015
{
1016
//    qDebug("Plotter rekonfiguriert..!!");
1016
//    qDebug("Plotter rekonfiguriert..!!");
1017
    qwtPlot->setAxisScale(QwtPlot::xBottom,0,Settings->Data.Plotter_Count,0);
1017
    qwtPlot->setAxisScale(QwtPlot::xBottom,0,Settings->Data.Plotter_Count,0);
1018
 
1018
 
1019
    for (int a = 0; a < MaxAnalog; a++)
1019
    for (int a = 0; a < MaxAnalog; a++)
1020
    {
1020
    {
1021
        Plot[a]->detach();
1021
        Plot[a]->detach();
1022
        Plot[a]->setPen(QPen(QColor(Def_Colors[a])));
1022
        Plot[a]->setPen(QPen(QColor(Def_Colors[a])));
1023
 
1023
 
1024
        if (Settings->Analog1.PlotView[a])
1024
        if (Settings->Analog1.PlotView[a])
1025
        {
1025
        {
1026
            Plot[a]->setTitle(Settings->Analog1.Label[a]);
1026
            Plot[a]->setTitle(Settings->Analog1.Label[a]);
1027
            Plot[a]->attach(qwtPlot);
1027
            Plot[a]->attach(qwtPlot);
1028
        }
1028
        }
1029
    }
1029
    }
1030
    qwtPlot->replot();
1030
    qwtPlot->replot();
1031
}
1031
}
1032
 
1032
 
1033
void MKTool::slot_ScrollPlot(int Pos)
1033
void MKTool::slot_ScrollPlot(int Pos)
1034
{
1034
{
1035
    qwtPlot->setAxisScale(QwtPlot::xBottom,Pos,Pos + Settings->Data.Plotter_Count,0);
1035
    qwtPlot->setAxisScale(QwtPlot::xBottom,Pos,Pos + Settings->Data.Plotter_Count,0);
1036
    qwtPlot->replot();
1036
    qwtPlot->replot();
1037
}
1037
}
1038
 
1038
 
1039
 
1039
 
1040
// Firmeware-Update
1040
// Firmeware-Update
1041
///////////////////
1041
///////////////////
1042
void MKTool::slot_pb_Update()
1042
void MKTool::slot_pb_Update()
1043
{
1043
{
1044
    QString Device;
1044
    QString Device;
1045
    QString Hardware;
1045
    QString Hardware;
1046
 
1046
 
1047
    if (rb_FC->isChecked())
1047
    if (rb_FC->isChecked())
1048
    {
1048
    {
1049
        Device   = "m644";
1049
        Device   = "m644";
1050
        Hardware = "FlightCtrl";
1050
        Hardware = "FlightCtrl";
1051
    }
1051
    }
1052
    else if (rb_MK3MAG->isChecked())
1052
    else if (rb_MK3MAG->isChecked())
1053
    {
1053
    {
1054
        Device   = "m168";
1054
        Device   = "m168";
1055
        Hardware = "MK3MAG";
1055
        Hardware = "MK3MAG";
1056
    }
1056
    }
1057
    else if (rb_BL->isChecked())
1057
    else if (rb_BL->isChecked())
1058
    {
1058
    {
1059
        Device   = "m8";
1059
        Device   = "m8";
1060
        Hardware = "BL-Ctrl";
1060
        Hardware = "BL-Ctrl";
1061
    }
1061
    }
1062
 
1062
 
1063
    QString Message = "Firmeware-Datei \n\n";
1063
    QString Message = "Firmeware-Datei \n\n";
1064
    Message = Message + le_HexFile->text() + "\n\n";
1064
    Message = Message + le_HexFile->text() + "\n\n";
1065
    Message = Message + "an " + Hardware + trUtf8(" mit AVRDUDE - Seriel & Bootloader über ") + le_Port->text() + trUtf8(" übertragen?\n");
1065
    Message = Message + "an " + Hardware + trUtf8(" mit AVRDUDE - Seriel & Bootloader über ") + le_Port->text() + trUtf8(" übertragen?\n");
1066
 
1066
 
1067
    if (le_HexFile->text() == "")
1067
    if (le_HexFile->text() == "")
1068
    {
1068
    {
1069
        QMessageBox::warning(this, QA_NAME, trUtf8("Bitte Firmeware-Datei wählen."), QMessageBox::Ok);
1069
        QMessageBox::warning(this, QA_NAME, trUtf8("Bitte Firmeware-Datei wählen."), QMessageBox::Ok);
1070
    }
1070
    }
1071
    else if (QMessageBox::warning(this, QA_NAME, Message, QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes)
1071
    else if (QMessageBox::warning(this, QA_NAME, Message, QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes)
1072
    {
1072
    {
1073
        QString Programm = Settings->DIR.AVRDUDE;
1073
        QString Programm = Settings->DIR.AVRDUDE;
1074
 
1074
 
1075
        QStringList Argumente;
1075
        QStringList Argumente;
1076
 
1076
 
1077
        Update = new QProcess();
1077
        Update = new QProcess();
1078
 
1078
 
1079
        if (o_Connection->isOpen())
1079
        if (o_Connection->isOpen())
1080
        {
1080
        {
1081
            slot_OpenPort();
1081
            slot_OpenPort();
1082
        }
1082
        }
1083
 
1083
 
1084
        Argumente << "-P";
1084
        Argumente << "-P";
1085
        Argumente << le_Port->text();
1085
        Argumente << le_Port->text();
1086
        Argumente << "-p";
1086
        Argumente << "-p";
1087
        Argumente << Device;
1087
        Argumente << Device;
1088
        Argumente << "-c";
1088
        Argumente << "-c";
1089
        Argumente << "butterfly";
1089
        Argumente << "butterfly";
1090
        Argumente << "-b";
1090
        Argumente << "-b";
1091
        Argumente << "57600";
1091
        Argumente << "57600";
1092
        Argumente << "-U";
1092
        Argumente << "-U";
1093
        Argumente << "flash:w:" + le_HexFile->text();
1093
        Argumente << "flash:w:" + le_HexFile->text();
1094
 
1094
 
1095
//    QString Programm = "/home/Manuel/bin/avrdude -p m644 -P /dev/ttyS0 -c butterfly -b 57600 -U flash:w:/home/Manuel/Documents/Mikrokopter/Firmeware/FlightCtrl/Flight-Ctrl_MEGA644_V0_71h.hex";
1095
//    QString Programm = "/home/Manuel/bin/avrdude -p m644 -P /dev/ttyS0 -c butterfly -b 57600 -U flash:w:/home/Manuel/Documents/Mikrokopter/Firmeware/FlightCtrl/Flight-Ctrl_MEGA644_V0_71h.hex";
1096
 
1096
 
1097
        te_Shell->setText(""); // Ausgabefenster säubern
1097
        te_Shell->setText(""); // Ausgabefenster säubern
1098
 
1098
 
1099
        connect(Update, SIGNAL(readyReadStandardOutput()), this, SLOT(slot_UpdateShell()) );
1099
        connect(Update, SIGNAL(readyReadStandardOutput()), this, SLOT(slot_UpdateShell()) );
1100
        connect(Update, SIGNAL(readyReadStandardError()), this, SLOT(slot_UpdateShell()) );
1100
        connect(Update, SIGNAL(readyReadStandardError()), this, SLOT(slot_UpdateShell()) );
1101
 
1101
 
1102
        Update->start(Programm, Argumente); // Programmaufruf
1102
        Update->start(Programm, Argumente); // Programmaufruf
1103
    }
1103
    }
1104
}
1104
}
1105
 
1105
 
1106
void MKTool::slot_UpdateShell()
1106
void MKTool::slot_UpdateShell()
1107
{
1107
{
1108
    QByteArray Output;
1108
    QByteArray Output;
1109
 
1109
 
1110
    Output = Update->readAllStandardError(); // Shellausgabe an Variable
1110
    Output = Update->readAllStandardError(); // Shellausgabe an Variable
1111
    te_Shell->moveCursor(QTextCursor::End,  QTextCursor::MoveAnchor);
1111
    te_Shell->moveCursor(QTextCursor::End,  QTextCursor::MoveAnchor);
1112
    te_Shell->insertPlainText(QString::fromUtf8(Output));
1112
    te_Shell->insertPlainText(QString::fromUtf8(Output));
1113
 
1113
 
1114
    Output = Update->readAll();
1114
    Output = Update->readAll();
1115
    te_Shell->moveCursor(QTextCursor::End,  QTextCursor::MoveAnchor);
1115
    te_Shell->moveCursor(QTextCursor::End,  QTextCursor::MoveAnchor);
1116
    te_Shell->insertPlainText(QString::fromUtf8(Output));
1116
    te_Shell->insertPlainText(QString::fromUtf8(Output));
1117
}
1117
}
1118
 
1118
 
1119
void MKTool::slot_pb_HexFile()
1119
void MKTool::slot_pb_HexFile()
1120
{
1120
{
1121
    QString FileName = QFileDialog::getOpenFileName(this,trUtf8(("Firmeware-Datei wählen")),"",
1121
    QString FileName = QFileDialog::getOpenFileName(this,trUtf8(("Firmeware-Datei wählen")),"",
1122
                                tr("Intel Hex(*.hex);;Alle Dateien (*)"));
1122
                                tr("Intel Hex(*.hex);;Alle Dateien (*)"));
1123
    if (!FileName.isEmpty())
1123
    if (!FileName.isEmpty())
1124
    {
1124
    {
1125
        le_HexFile->setText(FileName);
1125
        le_HexFile->setText(FileName);
1126
    }
1126
    }
1127
}
1127
}
1128
 
1128
 
1129
 
1129
 
1130
// Wechsel der Tabs erkennen
1130
// Wechsel der Tabs erkennen
1131
void MKTool::slot_TabChanged(int Tab) // DONE 0.71g
1131
void MKTool::slot_TabChanged(int Tab) // DONE 0.71g
1132
{
1132
{
1133
    Tab = Tab;
1133
    Tab = Tab;
1134
    if (tab_Main->count() != 0)
1134
    if (tab_Main->count() != 0)
1135
    {
1135
    {
1136
        if ((tab_Main->currentWidget()->objectName() == QString("Tab_2")) && (f_Settings->listWidget->currentRow() == 1))
1136
        if ((tab_Main->currentWidget()->objectName() == QString("Tab_2")) && (f_Settings->listWidget->currentRow() == 1))
1137
        {
1137
        {
1138
            TX_Data[0] = 0;
1138
            TX_Data[0] = 0;
1139
            o_Connection->send_Cmd('p', ADDRESS_FC, TX_Data, 0, false);
1139
            o_Connection->send_Cmd('p', ADDRESS_FC, TX_Data, 0, false);
1140
 
1140
 
1141
            Ticker->setInterval(500);
1141
            Ticker->setInterval(500);
1142
            TickerEvent[1] = true;
1142
            TickerEvent[1] = true;
1143
        }
1143
        }
1144
        else
1144
        else
1145
        {
1145
        {
1146
            Ticker->setInterval(2000);
1146
            Ticker->setInterval(2000);
1147
            TickerEvent[1] = false;
1147
            TickerEvent[1] = false;
1148
        }
1148
        }
1149
    }
1149
    }
1150
}
1150
}
1151
 
1151
 
1152
// LCD-Seiten weiterschalten
1152
// LCD-Seiten weiterschalten
1153
void MKTool::slot_LCD_UP() // DONE 0.71g
1153
void MKTool::slot_LCD_UP() // DONE 0.71g
1154
{
1154
{
1155
    if (LCD_Page == LCD_MAX_Page)
1155
    if (LCD_Page == LCD_MAX_Page)
1156
        TX_Data[0] = 0;
1156
        TX_Data[0] = 0;
1157
    else
1157
    else
1158
        TX_Data[0] = LCD_Page + 1;
1158
        TX_Data[0] = LCD_Page + 1;
1159
 
1159
 
1160
    TX_Data[1] = 0;
1160
    TX_Data[1] = 0;
1161
    o_Connection->send_Cmd('l', ADDRESS_ALL, TX_Data, 1, true);
1161
    o_Connection->send_Cmd('l', ADDRESS_ALL, TX_Data, 1, true);
1162
}
1162
}
1163
 
1163
 
1164
void MKTool::slot_LCD_DOWN() // DONE 0.71g
1164
void MKTool::slot_LCD_DOWN() // DONE 0.71g
1165
{
1165
{
1166
    if (LCD_Page == 0)
1166
    if (LCD_Page == 0)
1167
        TX_Data[0] = LCD_MAX_Page;
1167
        TX_Data[0] = LCD_MAX_Page;
1168
    else
1168
    else
1169
        TX_Data[0] = LCD_Page - 1;
1169
        TX_Data[0] = LCD_Page - 1;
1170
 
1170
 
1171
    TX_Data[1] = 0;
1171
    TX_Data[1] = 0;
1172
    o_Connection->send_Cmd('l', ADDRESS_ALL, TX_Data, 1, true);
1172
    o_Connection->send_Cmd('l', ADDRESS_ALL, TX_Data, 1, true);
1173
}
1173
}
1174
 
1174
 
1175
// Settings aus MK lesen / in MK schreiben
1175
// Settings aus MK lesen / in MK schreiben
1176
void MKTool::slot_GetFCSettings() // DONE 0.71g
1176
void MKTool::slot_GetFCSettings() // DONE 0.71g
1177
{
1177
{
1178
    lb_Status->setText(tr("Lese FlightCtrl-Settings aus."));
1178
    lb_Status->setText(tr("Lese FlightCtrl-Settings aus."));
1179
    TX_Data[0] = f_Settings->sb_Set->value();
1179
    TX_Data[0] = f_Settings->sb_Set->value();
1180
    TX_Data[1] = 0;
1180
    TX_Data[1] = 0;
1181
    o_Connection->send_Cmd('q', ADDRESS_FC, TX_Data, 1, true);
1181
    o_Connection->send_Cmd('q', ADDRESS_FC, TX_Data, 1, true);
1182
}
1182
}
1183
 
1183
 
1184
void MKTool::slot_SetFCSettings() // DONE 0.71g
1184
void MKTool::slot_SetFCSettings() // DONE 0.71g
1185
{
1185
{
1186
    char *TX_Data2 = f_Settings->GetFCSettings();
1186
    char *TX_Data2 = f_Settings->GetFCSettings();
1187
 
1187
 
1188
    lb_Status->setText(tr("Schreibe FlightCtrl-Settings."));
1188
    lb_Status->setText(tr("Schreibe FlightCtrl-Settings."));
1189
 
1189
 
1190
    o_Connection->send_Cmd('s', ADDRESS_FC, TX_Data2, MaxParameter + 2, true);
1190
    o_Connection->send_Cmd('s', ADDRESS_FC, TX_Data2, MaxParameter + 2, true);
1191
}
1191
}
1192
 
1192
 
1193
 
1193
 
1194
// Save GUI-Preferences
1194
// Save GUI-Preferences
1195
///////////////////////
1195
///////////////////////
1196
void MKTool::set_Preferences()
1196
void MKTool::set_Preferences()
1197
{
1197
{
1198
    Settings->GUI.TabViews.setBit(0, ac_View0->isChecked());
1198
    Settings->GUI.TabViews.setBit(0, ac_View0->isChecked());
1199
    Settings->GUI.TabViews.setBit(1, ac_View1->isChecked());
1199
    Settings->GUI.TabViews.setBit(1, ac_View1->isChecked());
1200
    Settings->GUI.TabViews.setBit(2, ac_View2->isChecked());
1200
    Settings->GUI.TabViews.setBit(2, ac_View2->isChecked());
1201
    Settings->GUI.TabViews.setBit(3, ac_View3->isChecked());
1201
    Settings->GUI.TabViews.setBit(3, ac_View3->isChecked());
1202
    Settings->GUI.TabViews.setBit(4, ac_View4->isChecked());
1202
    Settings->GUI.TabViews.setBit(4, ac_View4->isChecked());
1203
    Settings->GUI.TabViews.setBit(5, ac_View5->isChecked());
1203
    Settings->GUI.TabViews.setBit(5, ac_View5->isChecked());
1204
    Settings->GUI.TabViews.setBit(6, ac_View6->isChecked());
1204
    Settings->GUI.TabViews.setBit(6, ac_View6->isChecked());
1205
 
1205
 
1206
    Settings->GUI.ToolViews.setBit(0, tb_Allgemein->isVisibleTo(this));
1206
    Settings->GUI.ToolViews.setBit(0, tb_Allgemein->isVisibleTo(this));
1207
    Settings->GUI.ToolViews.setBit(1, tb_Werkzeuge->isVisibleTo(this));
1207
    Settings->GUI.ToolViews.setBit(1, tb_Werkzeuge->isVisibleTo(this));
1208
    Settings->GUI.ToolViews.setBit(2, tb_Debug->isVisibleTo(this));
1208
    Settings->GUI.ToolViews.setBit(2, tb_Debug->isVisibleTo(this));
1209
    Settings->GUI.ToolViews.setBit(3, tb_TTY->isVisibleTo(this));
1209
    Settings->GUI.ToolViews.setBit(3, tb_TTY->isVisibleTo(this));
1210
    Settings->GUI.ToolViews.setBit(4, tb_Hardware->isVisibleTo(this));
1210
    Settings->GUI.ToolViews.setBit(4, tb_Hardware->isVisibleTo(this));
1211
 
1211
 
1212
    Settings->GUI.Term_Info   = cb_ShowMSG->isChecked();
1212
    Settings->GUI.Term_Info   = cb_ShowMSG->isChecked();
1213
    Settings->GUI.Term_Data   = cb_ShowData->isChecked();
1213
    Settings->GUI.Term_Data   = cb_ShowData->isChecked();
1214
    Settings->GUI.Term_Always = cb_ShowAlways->isChecked();
1214
    Settings->GUI.Term_Always = cb_ShowAlways->isChecked();
1215
    Settings->GUI.Term_Send   = cb_ShowSend->isChecked();
1215
    Settings->GUI.Term_Send   = cb_ShowSend->isChecked();
1216
    Settings->GUI.isMax       = isMaximized();
1216
    Settings->GUI.isMax       = isMaximized();
1217
    Settings->GUI.Size        = size();
1217
    Settings->GUI.Size        = size();
1218
    Settings->GUI.Point       = pos();
1218
    Settings->GUI.Point       = pos();
1219
 
1219
 
1220
    Settings->TTY.Port = le_Port->text();
1220
    Settings->TTY.Port = le_Port->text();
1221
}
1221
}
1222
 
1222
 
1223
void MKTool::show_DebugData()
1223
void MKTool::show_DebugData()
1224
{
1224
{
1225
    if (logger->is_active())
1225
    if (logger->is_active())
1226
        logger->write(AnalogData);
1226
        logger->write(AnalogData);
1227
 
1227
 
1228
    if (ac_StartPlotter->isChecked())
1228
    if (ac_StartPlotter->isChecked())
1229
    {
1229
    {
1230
        aID[NextPlot] = NextPlot;
1230
        aID[NextPlot] = NextPlot;
1231
 
1231
 
1232
        for (int a = 0; a < MaxAnalog; a++)
1232
        for (int a = 0; a < MaxAnalog; a++)
1233
        {
1233
        {
1234
            aData[a][NextPlot] = AnalogData[a];
1234
            aData[a][NextPlot] = AnalogData[a];
1235
        }
1235
        }
1236
        NextPlot++;
1236
        NextPlot++;
1237
 
1237
 
1238
        if ((tab_Main->currentWidget()->objectName() == QString("Tab_1")))
1238
        if ((tab_Main->currentWidget()->objectName() == QString("Tab_1")))
1239
            update_Plot();
1239
            update_Plot();
1240
    }
1240
    }
1241
 
1241
 
1242
    le_A_0->setText(QString("%1").arg(AnalogData[0]));
1242
    le_A_0->setText(QString("%1").arg(AnalogData[0]));
1243
    le_A_1->setText(QString("%1").arg(AnalogData[1]));
1243
    le_A_1->setText(QString("%1").arg(AnalogData[1]));
1244
    le_A_2->setText(QString("%1").arg(AnalogData[2]));
1244
    le_A_2->setText(QString("%1").arg(AnalogData[2]));
1245
    le_A_3->setText(QString("%1").arg(AnalogData[3]));
1245
    le_A_3->setText(QString("%1").arg(AnalogData[3]));
1246
    le_A_4->setText(QString("%1").arg(AnalogData[4]));
1246
    le_A_4->setText(QString("%1").arg(AnalogData[4]));
1247
    le_A_5->setText(QString("%1").arg(AnalogData[5]));
1247
    le_A_5->setText(QString("%1").arg(AnalogData[5]));
1248
    le_A_6->setText(QString("%1").arg(AnalogData[6]));
1248
    le_A_6->setText(QString("%1").arg(AnalogData[6]));
1249
    le_A_7->setText(QString("%1").arg(AnalogData[7]));
1249
    le_A_7->setText(QString("%1").arg(AnalogData[7]));
1250
    le_A_8->setText(QString("%1").arg(AnalogData[8]));
1250
    le_A_8->setText(QString("%1").arg(AnalogData[8]));
1251
    le_A_9->setText(QString("%1").arg(AnalogData[9]));
1251
    le_A_9->setText(QString("%1").arg(AnalogData[9]));
1252
    le_A_10->setText(QString("%1").arg(AnalogData[10]));
1252
    le_A_10->setText(QString("%1").arg(AnalogData[10]));
1253
    le_A_11->setText(QString("%1").arg(AnalogData[11]));
1253
    le_A_11->setText(QString("%1").arg(AnalogData[11]));
1254
    le_A_12->setText(QString("%1").arg(AnalogData[12]));
1254
    le_A_12->setText(QString("%1").arg(AnalogData[12]));
1255
    le_A_13->setText(QString("%1").arg(AnalogData[13]));
1255
    le_A_13->setText(QString("%1").arg(AnalogData[13]));
1256
    le_A_14->setText(QString("%1").arg(AnalogData[14]));
1256
    le_A_14->setText(QString("%1").arg(AnalogData[14]));
1257
    le_A_15->setText(QString("%1").arg(AnalogData[15]));
1257
    le_A_15->setText(QString("%1").arg(AnalogData[15]));
1258
    le_A_16->setText(QString("%1").arg(AnalogData[16]));
1258
    le_A_16->setText(QString("%1").arg(AnalogData[16]));
1259
    le_A_17->setText(QString("%1").arg(AnalogData[17]));
1259
    le_A_17->setText(QString("%1").arg(AnalogData[17]));
1260
    le_A_18->setText(QString("%1").arg(AnalogData[18]));
1260
    le_A_18->setText(QString("%1").arg(AnalogData[18]));
1261
    le_A_19->setText(QString("%1").arg(AnalogData[19]));
1261
    le_A_19->setText(QString("%1").arg(AnalogData[19]));
1262
    le_A_20->setText(QString("%1").arg(AnalogData[20]));
1262
    le_A_20->setText(QString("%1").arg(AnalogData[20]));
1263
    le_A_21->setText(QString("%1").arg(AnalogData[21]));
1263
    le_A_21->setText(QString("%1").arg(AnalogData[21]));
1264
    le_A_22->setText(QString("%1").arg(AnalogData[22]));
1264
    le_A_22->setText(QString("%1").arg(AnalogData[22]));
1265
    le_A_23->setText(QString("%1").arg(AnalogData[23]));
1265
    le_A_23->setText(QString("%1").arg(AnalogData[23]));
1266
    le_A_24->setText(QString("%1").arg(AnalogData[24]));
1266
    le_A_24->setText(QString("%1").arg(AnalogData[24]));
1267
    le_A_25->setText(QString("%1").arg(AnalogData[25]));
1267
    le_A_25->setText(QString("%1").arg(AnalogData[25]));
1268
    le_A_26->setText(QString("%1").arg(AnalogData[26]));
1268
    le_A_26->setText(QString("%1").arg(AnalogData[26]));
1269
    le_A_27->setText(QString("%1").arg(AnalogData[27]));
1269
    le_A_27->setText(QString("%1").arg(AnalogData[27]));
1270
    le_A_28->setText(QString("%1").arg(AnalogData[28]));
1270
    le_A_28->setText(QString("%1").arg(AnalogData[28]));
1271
    le_A_29->setText(QString("%1").arg(AnalogData[29]));
1271
    le_A_29->setText(QString("%1").arg(AnalogData[29]));
1272
    le_A_30->setText(QString("%1").arg(AnalogData[30]));
1272
    le_A_30->setText(QString("%1").arg(AnalogData[30]));
1273
    le_A_31->setText(QString("%1").arg(AnalogData[31]));
1273
    le_A_31->setText(QString("%1").arg(AnalogData[31]));
1274
 
1274
 
1275
    if ((Mode.ID == ADDRESS_FC) && (FCSettings[P_GYRO_ACC_FAKTOR] > 0))
1275
    if ((Mode.ID == ADDRESS_FC) && (FCSettings[P_GYRO_ACC_FAKTOR] > 0))
1276
    {
1276
    {
1277
        bar_UBAT->setValue(AnalogData[9]);
1277
        bar_UBAT->setValue(AnalogData[9]);
1278
        bar_RX->setValue(AnalogData[10]);
1278
        bar_RX->setValue(AnalogData[10]);
1279
 
1279
 
1280
        Compass->setValue(AnalogData[8]);
1280
        Compass->setValue(AnalogData[8]);
1281
 
1281
 
1282
        int Roll = (AnalogData[1] * FCSettings[P_GYRO_ACC_FAKTOR]) / 1024;
1282
        int Roll = (AnalogData[1] * FCSettings[P_GYRO_ACC_FAKTOR]) / 1024;
1283
        int Nick = (AnalogData[0] * FCSettings[P_GYRO_ACC_FAKTOR]) / 1024;
1283
        int Nick = (AnalogData[0] * FCSettings[P_GYRO_ACC_FAKTOR]) / 1024;
1284
 
1284
 
1285
        if (Roll > 128)
1285
        if (Roll > 128)
1286
            Roll = Roll - 255;
1286
            Roll = Roll - 255;
1287
 
1287
 
1288
        if (Nick > 128)
1288
        if (Nick > 128)
1289
            Nick = Nick - 255;
1289
            Nick = Nick - 255;
1290
 
1290
 
1291
        Attitude->setAngle(Roll);
1291
        Attitude->setAngle(Roll);
1292
        Attitude->setGradient(double(double(Nick) / 100.0));
1292
        Attitude->setGradient(double(double(Nick) / 100.0));
1293
    }
1293
    }
1294
}
1294
}
1295
 
1295
 
1296
void MKTool::new_NaviData(sRxData RX)
1296
void MKTool::new_NaviData(sRxData RX)
1297
{
1297
{
1298
//    qDebug("Navi-Data");
1298
//    qDebug("Navi-Data");
1299
 
1299
 
1300
    switch(RX.Decode[N_NC_FLAGS])
1300
    switch(RX.Decode[N_NC_FLAGS])
1301
    {
1301
    {
1302
        case 1 : lb_Mode->setText("Free"); break;
1302
        case 1 : lb_Mode->setText("Free"); break;
1303
        case 2 : lb_Mode->setText("Position Hold"); break;
1303
        case 2 : lb_Mode->setText("Position Hold"); break;
1304
        case 4 : lb_Mode->setText("Coming Home"); break;
1304
        case 4 : lb_Mode->setText("Coming Home"); break;
1305
        case 8 : lb_Mode->setText("Range Limit"); break;
1305
        case 8 : lb_Mode->setText("Range Limit"); break;
1306
    }
1306
    }
1307
 
1307
 
1308
    Navi.Current.Longitude = ToolBox::Data2Long(RX.Decode, N_CUR_LONGITUDE, true);
1308
    Navi.Current.Longitude = ToolBox::Data2Long(RX.Decode, N_CUR_LONGITUDE, true);
1309
    Navi.Current.Latitude  = ToolBox::Data2Long(RX.Decode, N_CUR_LATITUDE,  true);
1309
    Navi.Current.Latitude  = ToolBox::Data2Long(RX.Decode, N_CUR_LATITUDE,  true);
1310
    Navi.Current.Altitude  = ToolBox::Data2Long(RX.Decode, N_CUR_ALTITUDE,  true);
1310
    Navi.Current.Altitude  = ToolBox::Data2Long(RX.Decode, N_CUR_ALTITUDE,  true);
1311
    Navi.Target.Longitude  = ToolBox::Data2Long(RX.Decode, N_TAR_LONGITUDE, true);
1311
    Navi.Target.Longitude  = ToolBox::Data2Long(RX.Decode, N_TAR_LONGITUDE, true);
1312
    Navi.Target.Latitude   = ToolBox::Data2Long(RX.Decode, N_TAR_LATITUDE,  true);
1312
    Navi.Target.Latitude   = ToolBox::Data2Long(RX.Decode, N_TAR_LATITUDE,  true);
1313
    Navi.Target.Altitude   = ToolBox::Data2Long(RX.Decode, N_TAR_ALTITUDE,  true);
1313
    Navi.Target.Altitude   = ToolBox::Data2Long(RX.Decode, N_TAR_ALTITUDE,  true);
1314
 
1314
 
1315
    le_CDistance->setText(QString("%1 cm").arg(ToolBox::Data2Int(RX.Decode, N_HOME_DISTANCE)));
1315
    le_CDistance->setText(QString("%1 cm").arg(ToolBox::Data2Int(RX.Decode, N_HOME_DISTANCE)));
1316
    le_CWPA->setText(QString("%1").arg(RX.Decode[N_WP_INDEX]));
1316
    le_CWPA->setText(QString("%1").arg(RX.Decode[N_WP_INDEX]));
1317
    le_CWPT->setText(QString("%1").arg(RX.Decode[N_WP_NUMBER]));
1317
    le_CWPT->setText(QString("%1").arg(RX.Decode[N_WP_NUMBER]));
1318
    le_CSats->setText(QString("%1").arg(RX.Decode[N_SATS_IN_USER]));
1318
    le_CSats->setText(QString("%1").arg(RX.Decode[N_SATS_IN_USER]));
1319
 
1319
 
1320
    qwt_Rate->setValue(double(ToolBox::Data2Int(RX.Decode, N_VARIOMETER, true)));
1320
    qwt_Rate->setValue(double(ToolBox::Data2Int(RX.Decode, N_VARIOMETER, true)));
1321
 
1321
 
1322
    le_CTime->setText(QString("%1 sec.").arg(ToolBox::Data2Int(RX.Decode, N_FLYING_TIME)));
1322
    le_CTime->setText(QString("%1 sec.").arg(ToolBox::Data2Int(RX.Decode, N_FLYING_TIME)));
1323
 
1323
 
1324
    bar_UBAT->setValue(RX.Decode[N_UBAT]);
1324
    bar_UBAT->setValue(RX.Decode[N_UBAT]);
1325
 
1325
 
1326
    double Speed = double((ToolBox::Data2Int(RX.Decode, N_GROUND_SPEED)) / 10.0);
1326
    double Speed = double((ToolBox::Data2Int(RX.Decode, N_GROUND_SPEED)) / 10.0);
1327
 
1327
 
1328
    if ((Speed > 4.5) && SpeedMeter->property("END") == 5)
1328
    if ((Speed > 4.5) && SpeedMeter->property("END") == 5)
1329
    {
1329
    {
1330
        SpeedMeter->setRange(0.0, 10.0);
1330
        SpeedMeter->setRange(0.0, 10.0);
1331
        SpeedMeter->setScale(1, 2, 1);
1331
        SpeedMeter->setScale(1, 2, 1);
1332
        SpeedMeter->setProperty("END", 10);
1332
        SpeedMeter->setProperty("END", 10);
1333
    }
1333
    }
1334
 
1334
 
1335
    if ((Speed > 9) && SpeedMeter->property("END") == 10)
1335
    if ((Speed > 9) && SpeedMeter->property("END") == 10)
1336
    {
1336
    {
1337
        SpeedMeter->setRange(0.0, 20.0);
1337
        SpeedMeter->setRange(0.0, 20.0);
1338
        SpeedMeter->setScale(1, 2, 2);
1338
        SpeedMeter->setScale(1, 2, 2);
1339
        SpeedMeter->setProperty("END", 20);
1339
        SpeedMeter->setProperty("END", 20);
1340
    }
1340
    }
1341
 
1341
 
1342
    SpeedMeter->setValue(Speed);
1342
    SpeedMeter->setValue(Speed);
1343
 
1343
 
1344
    Compass->setValue(ToolBox::Data2Int(RX.Decode, N_COMAPSS_HEADING)); //(68)
1344
    Compass->setValue(ToolBox::Data2Int(RX.Decode, N_COMAPSS_HEADING)); //(68)
1345
 
1345
 
1346
    bar_RX->setValue(RX.Decode[N_RC_QUALITY]);
1346
    bar_RX->setValue(RX.Decode[N_RC_QUALITY]);
1347
 
1347
 
1348
    int Nick = RX.Decode[N_ANGLE_NICK];
1348
    int Nick = RX.Decode[N_ANGLE_NICK];
1349
    int Roll = RX.Decode[N_ANGLE_ROLL];
1349
    int Roll = RX.Decode[N_ANGLE_ROLL];
1350
 
1350
 
1351
    if (Roll > 128)
1351
    if (Roll > 128)
1352
        Roll = Roll - 255;
1352
        Roll = Roll - 255;
1353
 
1353
 
1354
    if (Nick > 128)
1354
    if (Nick > 128)
1355
        Nick = Nick - 255;
1355
        Nick = Nick - 255;
1356
 
1356
 
1357
    Attitude->setAngle(Roll);
1357
    Attitude->setAngle(Roll);
1358
    Attitude->setGradient(double(0.0 - (double(Nick) / 100.0)));
1358
    Attitude->setGradient(double(0.0 - (double(Nick) / 100.0)));
1359
 
1359
 
1360
    sNaviString NaviString;
1360
    sNaviString NaviString;
1361
 
1361
 
1362
    NaviString.Longitude = ToolBox::get_Float(Navi.Current.Longitude,10000000);
1362
    NaviString.Longitude = ToolBox::get_Float(Navi.Current.Longitude,7);
1363
    NaviString.Latitude  = ToolBox::get_Float(Navi.Current.Latitude,10000000);
1363
    NaviString.Latitude  = ToolBox::get_Float(Navi.Current.Latitude,7);
1364
    NaviString.Altitude  = ToolBox::get_Float(Navi.Current.Altitude,1000);
1364
    NaviString.Altitude  = ToolBox::get_Float(Navi.Current.Altitude,3);
1365
 
1365
 
1366
    le_CurLong->setText(NaviString.Longitude);
1366
    le_CurLong->setText(NaviString.Longitude);
1367
    le_CurLat->setText(NaviString.Latitude);
1367
    le_CurLat->setText(NaviString.Latitude);
1368
 
1368
 
1369
    KML_Server->store_NaviString(NaviString);
1369
    KML_Server->store_NaviString(NaviString);
1370
 
1370
 
1371
    f_Map->add_Position(NaviString.Longitude.toDouble(), NaviString.Latitude.toDouble());
1371
    f_Map->add_Position(NaviString.Longitude.toDouble(), NaviString.Latitude.toDouble());
1372
 
1372
 
1373
    if ((QMK_Server->property("Connect")) == true)
1373
    if ((QMK_Server->property("Connect")) == true)
1374
    {
1374
    {
1375
//        qDebug("Send Data to Server..!!");
1375
//        qDebug("Send Data to Server..!!");
1376
        QMK_Server->NewPosition(NaviString);
1376
        QMK_Server->NewPosition(NaviString);
1377
    }
1377
    }
1378
}
1378
}
1379
 
1379
 
1380
// Kopter-Kommunikations-Bereich, Befehle senden und Daten empfangen
1380
// Kopter-Kommunikations-Bereich, Befehle senden und Daten empfangen
1381
////////////////////////////////////////////////////////////////////
1381
////////////////////////////////////////////////////////////////////
1382
 
1382
 
1383
// Neues Datenpacket empfangen -> Verarbeiten
1383
// Neues Datenpacket empfangen -> Verarbeiten
1384
void MKTool::slot_newData(sRxData RX) // DONE 0.71g
1384
void MKTool::slot_newData(sRxData RX) // DONE 0.71g
1385
{
1385
{
1386
    if (LastSend.length() > 2)
1386
    if (LastSend.length() > 2)
1387
    {
1387
    {
1388
    }
1388
    }
1389
    int HardwareID = RX.Input[1] - 'a';
1389
    int HardwareID = RX.Input[1] - 'a';
1390
 
1390
 
1391
    switch(HardwareID)
1391
    switch(HardwareID)
1392
    {
1392
    {
1393
        case ADDRESS_FC :
1393
        case ADDRESS_FC :
1394
            switch(RX.Input[2])
1394
            switch(RX.Input[2])
1395
            {
1395
            {
1396
                // Motor-Mixer
1396
                // Motor-Mixer
1397
                case 'N' :
1397
                case 'N' :
1398
                    if (ToolBox::Decode64(RX))
1398
                    if (ToolBox::Decode64(RX))
1399
                    {
1399
                    {
1400
                        o_Connection->stop_ReSend();
1400
                        o_Connection->stop_ReSend();
1401
 
1401
 
1402
                        if (RX.Decode[0] == VERSION_MIXER)
1402
                        if (RX.Decode[0] == VERSION_MIXER)
1403
                        {
1403
                        {
1404
                            f_MotorMixer->set_MotorConfig(RX);
1404
                            f_MotorMixer->set_MotorConfig(RX);
1405
                        }
1405
                        }
1406
                    }
1406
                    }
1407
                break;
1407
                break;
1408
                // Motor-Mixer Schreib-Bestätigung
1408
                // Motor-Mixer Schreib-Bestätigung
1409
                case 'M' :
1409
                case 'M' :
1410
                    if (ToolBox::Decode64(RX))
1410
                    if (ToolBox::Decode64(RX))
1411
                    {
1411
                    {
1412
                        o_Connection->stop_ReSend();
1412
                        o_Connection->stop_ReSend();
1413
 
1413
 
1414
                        if (RX.Decode[0] == 1)
1414
                        if (RX.Decode[0] == 1)
1415
                        {
1415
                        {
1416
                            lb_Status->setText(tr("MotorMixer-Daten in FC geschrieben."));
1416
                            lb_Status->setText(tr("MotorMixer-Daten in FC geschrieben."));
1417
                        }
1417
                        }
1418
                    }
1418
                    }
1419
                break;
1419
                break;
1420
 
1420
 
1421
                // Stick-Belegung der Fernsteuerung
1421
                // Stick-Belegung der Fernsteuerung
1422
                case 'P' : // DONE 0.71g
1422
                case 'P' : // DONE 0.71g
1423
                    if (ToolBox::Decode64(RX))
1423
                    if (ToolBox::Decode64(RX))
1424
                    {
1424
                    {
1425
                        f_Settings->pb_K1->setValue(ToolBox::Data2Int(RX.Decode,  2,true));
1425
                        f_Settings->pb_K1->setValue(ToolBox::Data2Int(RX.Decode,  2,true));
1426
                        f_Settings->pb_K2->setValue(ToolBox::Data2Int(RX.Decode,  4,true));
1426
                        f_Settings->pb_K2->setValue(ToolBox::Data2Int(RX.Decode,  4,true));
1427
                        f_Settings->pb_K3->setValue(ToolBox::Data2Int(RX.Decode,  6,true));
1427
                        f_Settings->pb_K3->setValue(ToolBox::Data2Int(RX.Decode,  6,true));
1428
                        f_Settings->pb_K4->setValue(ToolBox::Data2Int(RX.Decode,  8,true));
1428
                        f_Settings->pb_K4->setValue(ToolBox::Data2Int(RX.Decode,  8,true));
1429
                        f_Settings->pb_K5->setValue(ToolBox::Data2Int(RX.Decode, 10 ,true));
1429
                        f_Settings->pb_K5->setValue(ToolBox::Data2Int(RX.Decode, 10 ,true));
1430
                        f_Settings->pb_K6->setValue(ToolBox::Data2Int(RX.Decode, 12,true));
1430
                        f_Settings->pb_K6->setValue(ToolBox::Data2Int(RX.Decode, 12,true));
1431
                        f_Settings->pb_K7->setValue(ToolBox::Data2Int(RX.Decode, 14,true));
1431
                        f_Settings->pb_K7->setValue(ToolBox::Data2Int(RX.Decode, 14,true));
1432
                        f_Settings->pb_K8->setValue(ToolBox::Data2Int(RX.Decode, 16,true));
1432
                        f_Settings->pb_K8->setValue(ToolBox::Data2Int(RX.Decode, 16,true));
1433
                    }
1433
                    }
1434
                break;
1434
                break;
1435
                // Settings lesen
1435
                // Settings lesen
1436
                case 'Q' : // DONE 0.71g
1436
                case 'Q' : // DONE 0.71g
1437
                    if (ToolBox::Decode64(RX))
1437
                    if (ToolBox::Decode64(RX))
1438
                    {
1438
                    {
1439
                        o_Connection->stop_ReSend();
1439
                        o_Connection->stop_ReSend();
1440
 
1440
 
1441
                        if (RX.Decode[1] == VERSION_SETTINGS)
1441
                        if (RX.Decode[1] == VERSION_SETTINGS)
1442
                        {
1442
                        {
1443
                            int Settings_ID = RX.Decode[0];
1443
                            int Settings_ID = RX.Decode[0];
1444
                            for (int a = 0; a < MaxParameter; a++)
1444
                            for (int a = 0; a < MaxParameter; a++)
1445
                            {
1445
                            {
1446
                                FCSettings[a] = RX.Decode[a + 2];
1446
                                FCSettings[a] = RX.Decode[a + 2];
1447
                            }
1447
                            }
1448
                            f_Settings->show_FCSettings(Settings_ID, FCSettings);
1448
                            f_Settings->show_FCSettings(Settings_ID, FCSettings);
1449
                            f_Settings->pb_Read->setEnabled(true);
1449
                            f_Settings->pb_Read->setEnabled(true);
1450
                            f_Settings->pb_Write->setEnabled(true);
1450
                            f_Settings->pb_Write->setEnabled(true);
1451
                        }
1451
                        }
1452
                        else
1452
                        else
1453
                        {
1453
                        {
1454
                            f_Settings->pb_Read->setDisabled(true);
1454
                            f_Settings->pb_Read->setDisabled(true);
1455
                            f_Settings->pb_Write->setDisabled(true);
1455
                            f_Settings->pb_Write->setDisabled(true);
1456
 
1456
 
1457
                            QMessageBox::warning(this, QA_NAME,
1457
                            QMessageBox::warning(this, QA_NAME,
1458
                                   "Versionen inkompatibel. \nParameterbearbeitung nicht moeglich.", QMessageBox::Ok);
1458
                                   "Versionen inkompatibel. \nParameterbearbeitung nicht moeglich.", QMessageBox::Ok);
1459
                        }
1459
                        }
1460
                    }
1460
                    }
1461
                break;
1461
                break;
1462
                // Settings geschrieben
1462
                // Settings geschrieben
1463
                case 'S' : // DONE 0.71g
1463
                case 'S' : // DONE 0.71g
1464
                    o_Connection->stop_ReSend();
1464
                    o_Connection->stop_ReSend();
1465
                break;
1465
                break;
1466
            }
1466
            }
1467
 
1467
 
1468
        case ADDRESS_NC :
1468
        case ADDRESS_NC :
1469
            switch(RX.Input[2])
1469
            switch(RX.Input[2])
1470
            {
1470
            {
1471
                // Navigationsdaten
1471
                // Navigationsdaten
1472
                case 'O' : // NOT DONE 0.12h
1472
                case 'O' : // NOT DONE 0.12h
1473
                    if (ToolBox::Decode64(RX))
1473
                    if (ToolBox::Decode64(RX))
1474
                    {
1474
                    {
1475
                        new_NaviData(RX);
1475
                        new_NaviData(RX);
1476
                    }
1476
                    }
1477
                break;
1477
                break;
1478
            }
1478
            }
1479
//        case ADDRESS_MK3MAG :
1479
//        case ADDRESS_MK3MAG :
1480
 
1480
 
1481
        default :
1481
        default :
1482
            switch(RX.Input[2])
1482
            switch(RX.Input[2])
1483
            {
1483
            {
1484
                // LCD-Anzeige
1484
                // LCD-Anzeige
1485
                case 'L' : // DONE 0.71g
1485
                case 'L' : // DONE 0.71g
1486
                    if (ToolBox::Decode64(RX))
1486
                    if (ToolBox::Decode64(RX))
1487
                    {
1487
                    {
1488
                        o_Connection->stop_ReSend();
1488
                        o_Connection->stop_ReSend();
1489
 
1489
 
1490
                        int LCD[150];
1490
                        int LCD[150];
1491
                        memcpy(LCD,RX.Decode, sizeof(RX.Decode));
1491
                        memcpy(LCD,RX.Decode, sizeof(RX.Decode));
1492
 
1492
 
1493
                        f_LCD->show_Data(LCD);
1493
                        f_LCD->show_Data(LCD);
1494
 
1494
 
1495
                        LCD_Page     = RX.Decode[0];
1495
                        LCD_Page     = RX.Decode[0];
1496
                        LCD_MAX_Page = RX.Decode[1];
1496
                        LCD_MAX_Page = RX.Decode[1];
1497
                    }
1497
                    }
1498
                break;
1498
                break;
1499
                // Analoglabels
1499
                // Analoglabels
1500
                case 'A' : // DONE 0.71g
1500
                case 'A' : // DONE 0.71g
1501
                    if (ToolBox::Decode64(RX))
1501
                    if (ToolBox::Decode64(RX))
1502
                    {
1502
                    {
1503
                        o_Connection->stop_ReSend();
1503
                        o_Connection->stop_ReSend();
1504
 
1504
 
1505
                        int Position = RX.Decode[0];
1505
                        int Position = RX.Decode[0];
1506
                        if (Position != 31)
1506
                        if (Position != 31)
1507
                        {
1507
                        {
1508
                            Settings->Analog1.Label[Position] = ToolBox::Data2QString(RX.Decode,1,17).trimmed();
1508
                            Settings->Analog1.Label[Position] = ToolBox::Data2QString(RX.Decode,1,17).trimmed();
1509
                            if (Settings->Analog1.Label[Position] == "")
1509
                            if (Settings->Analog1.Label[Position] == "")
1510
                            {
1510
                            {
1511
                                Settings->Analog1.Label[Position] = "A-" + QString("%1").arg(Position);
1511
                                Settings->Analog1.Label[Position] = "A-" + QString("%1").arg(Position);
1512
                            }
1512
                            }
1513
                            Position ++;
1513
                            Position ++;
1514
                            TX_Data[0] = Position;
1514
                            TX_Data[0] = Position;
1515
                            o_Connection->send_Cmd('a', ADDRESS_ALL, TX_Data, 1, true);
1515
                            o_Connection->send_Cmd('a', ADDRESS_ALL, TX_Data, 1, true);
1516
                        }
1516
                        }
1517
                        if (Position == 31)
1517
                        if (Position == 31)
1518
                        {
1518
                        {
1519
                            for (int a = 0; a < MaxAnalog; a++)
1519
                            for (int a = 0; a < MaxAnalog; a++)
1520
                            {
1520
                            {
1521
                                lb_Analog[a]->setText(Settings->Analog1.Label[a]);
1521
                                lb_Analog[a]->setText(Settings->Analog1.Label[a]);
1522
                            }
1522
                            }
1523
                            Settings->Analog1.Version = Mode.Version;
1523
                            Settings->Analog1.Version = Mode.Version;
1524
                            Settings->write_Settings_AnalogLabels(HardwareID);
1524
                            Settings->write_Settings_AnalogLabels(HardwareID);
1525
                            config_Plot();
1525
                            config_Plot();
1526
                        }
1526
                        }
1527
                    }
1527
                    }
1528
                break;
1528
                break;
1529
                // Debug-Daten
1529
                // Debug-Daten
1530
                case 'D' : // DONE 0.71g
1530
                case 'D' : // DONE 0.71g
1531
                    if (ToolBox::Decode64(RX))
1531
                    if (ToolBox::Decode64(RX))
1532
                    {
1532
                    {
1533
                        for (int i = 0; i < MaxAnalog; i++)
1533
                        for (int i = 0; i < MaxAnalog; i++)
1534
                        {
1534
                        {
1535
                            AnalogData[i] = ToolBox::Data2Int(RX.Decode, (i * 2) + 2);
1535
                            AnalogData[i] = ToolBox::Data2Int(RX.Decode, (i * 2) + 2);
1536
                        }
1536
                        }
1537
                        show_DebugData();
1537
                        show_DebugData();
1538
                    }
1538
                    }
1539
                break;
1539
                break;
1540
                // Version
1540
                // Version
1541
                case 'V' : // DONE 0.71h
1541
                case 'V' : // DONE 0.71h
1542
                    if (ToolBox::Decode64(RX))
1542
                    if (ToolBox::Decode64(RX))
1543
                    {
1543
                    {
1544
                        o_Connection->stop_ReSend();
1544
                        o_Connection->stop_ReSend();
1545
 
1545
 
1546
                        Mode.ID            = HardwareID;
1546
                        Mode.ID            = HardwareID;
1547
                        Mode.VERSION_MAJOR = RX.Decode[0];
1547
                        Mode.VERSION_MAJOR = RX.Decode[0];
1548
                        Mode.VERSION_MINOR = RX.Decode[1];
1548
                        Mode.VERSION_MINOR = RX.Decode[1];
1549
                        Mode.VERSION_PATCH = RX.Decode[4];
1549
                        Mode.VERSION_PATCH = RX.Decode[4];
1550
                        Mode.VERSION_SERIAL_MAJOR = RX.Decode[2];
1550
                        Mode.VERSION_SERIAL_MAJOR = RX.Decode[2];
1551
                        Mode.VERSION_SERIAL_MINOR = RX.Decode[3];
1551
                        Mode.VERSION_SERIAL_MINOR = RX.Decode[3];
1552
 
1552
 
1553
                        Mode.Hardware   = HardwareType[Mode.ID];
1553
                        Mode.Hardware   = HardwareType[Mode.ID];
1554
                        Mode.Version    = QString("%1").arg(RX.Decode[0]) + "." + QString("%1").arg(RX.Decode[1]) + QString(RX.Decode[4] + 'a');
1554
                        Mode.Version    = QString("%1").arg(RX.Decode[0]) + "." + QString("%1").arg(RX.Decode[1]) + QString(RX.Decode[4] + 'a');
1555
 
1555
 
1556
                        setWindowTitle(QA_NAME + " v" + QA_VERSION + " - " + Mode.Hardware + " " + Mode.Version);
1556
                        setWindowTitle(QA_NAME + " v" + QA_VERSION + " - " + Mode.Hardware + " " + Mode.Version);
1557
 
1557
 
1558
                        if (Mode.VERSION_SERIAL_MAJOR != VERSION_SERIAL_MAJOR)
1558
                        if (Mode.VERSION_SERIAL_MAJOR != VERSION_SERIAL_MAJOR)
1559
                        {
1559
                        {
1560
//                                AllowSend = false;
1560
//                                AllowSend = false;
1561
                                QMessageBox::warning(this, QA_NAME,
1561
                                QMessageBox::warning(this, QA_NAME,
1562
                                   "Serielles Protokoll Inkompatibel. \nBitte neue Programmversion installieren,", QMessageBox::Ok);
1562
                                   "Serielles Protokoll Inkompatibel. \nBitte neue Programmversion installieren,", QMessageBox::Ok);
1563
                        }
1563
                        }
1564
 
1564
 
1565
                        if (ac_NoDebug->isChecked())
1565
                        if (ac_NoDebug->isChecked())
1566
                        {
1566
                        {
1567
                            TX_Data[0] = 0;
1567
                            TX_Data[0] = 0;
1568
                        }
1568
                        }
1569
                        else
1569
                        else
1570
                        if (ac_FastDebug->isChecked())
1570
                        if (ac_FastDebug->isChecked())
1571
                        {
1571
                        {
1572
                            TX_Data[0] = Settings->Data.Debug_Fast / 10;
1572
                            TX_Data[0] = Settings->Data.Debug_Fast / 10;
1573
                        }
1573
                        }
1574
                        else
1574
                        else
1575
                        {
1575
                        {
1576
                            TX_Data[0] = Settings->Data.Debug_Slow / 10;
1576
                            TX_Data[0] = Settings->Data.Debug_Slow / 10;
1577
                        }
1577
                        }
1578
 
1578
 
1579
                        o_Connection->send_Cmd('d', ADDRESS_ALL, TX_Data, 1, false);
1579
                        o_Connection->send_Cmd('d', ADDRESS_ALL, TX_Data, 1, false);
1580
 
1580
 
1581
                        // Wenn MK3MAG dann andauernd Daten neu anfragen.
1581
                        // Wenn MK3MAG dann andauernd Daten neu anfragen.
1582
                        if (Mode.ID == ADDRESS_MK3MAG)
1582
                        if (Mode.ID == ADDRESS_MK3MAG)
1583
                        {
1583
                        {
1584
                            TickerEvent[3] = true;
1584
                            TickerEvent[3] = true;
1585
                            rb_SelMag->setChecked(true);
1585
                            rb_SelMag->setChecked(true);
1586
                        }
1586
                        }
1587
 
1587
 
1588
                        // Wenn NaviCtrl dann hier.
1588
                        // Wenn NaviCtrl dann hier.
1589
                        if (Mode.ID == ADDRESS_NC)
1589
                        if (Mode.ID == ADDRESS_NC)
1590
                        {
1590
                        {
1591
                            rb_SelNC->setChecked(true);
1591
                            rb_SelNC->setChecked(true);
1592
 
1592
 
1593
                            if (ac_NoNavi->isChecked())
1593
                            if (ac_NoNavi->isChecked())
1594
                            {
1594
                            {
1595
                                TX_Data[0] = 0;
1595
                                TX_Data[0] = 0;
1596
                            }
1596
                            }
1597
                            else
1597
                            else
1598
                            if (ac_FastNavi->isChecked())
1598
                            if (ac_FastNavi->isChecked())
1599
                            {
1599
                            {
1600
                                TX_Data[0] = Settings->Data.Navi_Fast / 10;
1600
                                TX_Data[0] = Settings->Data.Navi_Fast / 10;
1601
                            }
1601
                            }
1602
                            else
1602
                            else
1603
                            {
1603
                            {
1604
                                TX_Data[0] = Settings->Data.Navi_Slow / 10;
1604
                                TX_Data[0] = Settings->Data.Navi_Slow / 10;
1605
                            }
1605
                            }
1606
 
1606
 
1607
                            o_Connection->send_Cmd('o', ADDRESS_NC, TX_Data, 1, false);
1607
                            o_Connection->send_Cmd('o', ADDRESS_NC, TX_Data, 1, false);
1608
                        }
1608
                        }
1609
 
1609
 
1610
 
1610
 
1611
                        // Wenn FlightCtrl dann Settings abfragen.
1611
                        // Wenn FlightCtrl dann Settings abfragen.
1612
                        if (Mode.ID == ADDRESS_FC)
1612
                        if (Mode.ID == ADDRESS_FC)
1613
                        {
1613
                        {
1614
                            rb_SelFC->setChecked(true);
1614
                            rb_SelFC->setChecked(true);
1615
                            {
1615
                            {
1616
                                TX_Data[0] = 0xff;
1616
                                TX_Data[0] = 0xff;
1617
                                TX_Data[1] = 0;
1617
                                TX_Data[1] = 0;
1618
 
1618
 
1619
                                // DEP: Raus wenn Resend implementiert.
1619
                                // DEP: Raus wenn Resend implementiert.
1620
                                ToolBox::Wait(SLEEP);
1620
                                ToolBox::Wait(SLEEP);
1621
                                o_Connection->send_Cmd('q', ADDRESS_FC, TX_Data, 1, true);
1621
                                o_Connection->send_Cmd('q', ADDRESS_FC, TX_Data, 1, true);
1622
                                qDebug("FC - Get Settings");
1622
                                qDebug("FC - Get Settings");
1623
                            }
1623
                            }
1624
                        }
1624
                        }
1625
                        // Wenn nicht Lesen und Schreiben der Settings deaktivieren.
1625
                        // Wenn nicht Lesen und Schreiben der Settings deaktivieren.
1626
                        else
1626
                        else
1627
                        {
1627
                        {
1628
                                f_Settings->pb_Read->setDisabled(true);
1628
                                f_Settings->pb_Read->setDisabled(true);
1629
                                f_Settings->pb_Write->setDisabled(true);
1629
                                f_Settings->pb_Write->setDisabled(true);
1630
                        }
1630
                        }
1631
 
1631
 
1632
                        Settings->read_Settings_Analog(HardwareID);
1632
                        Settings->read_Settings_Analog(HardwareID);
1633
                        Settings->read_Settings_AnalogLabels(HardwareID);
1633
                        Settings->read_Settings_AnalogLabels(HardwareID);
1634
 
1634
 
1635
                        if (Settings->Analog1.Version != Mode.Version)
1635
                        if (Settings->Analog1.Version != Mode.Version)
1636
                        {
1636
                        {
1637
                            lb_Status->setText("Analoglabel-Version unterschiedlich. Lese Analoglabels neu aus.");
1637
                            lb_Status->setText("Analoglabel-Version unterschiedlich. Lese Analoglabels neu aus.");
1638
                            slot_ac_GetLabels();
1638
                            slot_ac_GetLabels();
1639
                        }
1639
                        }
1640
                        else
1640
                        else
1641
                        for (int a = 0; a < MaxAnalog; a++)
1641
                        for (int a = 0; a < MaxAnalog; a++)
1642
                        {
1642
                        {
1643
                            lb_Analog[a]->setText(Settings->Analog1.Label[a]);
1643
                            lb_Analog[a]->setText(Settings->Analog1.Label[a]);
1644
                        }
1644
                        }
1645
                        config_Plot();
1645
                        config_Plot();
1646
                    }
1646
                    }
1647
                break;
1647
                break;
1648
            }
1648
            }
1649
    }
1649
    }
1650
 
1650
 
1651
    // TODO: Roh-Daten senden zum QMK-Server dazu Sendebuffer bauen.
1651
    // TODO: Roh-Daten senden zum QMK-Server dazu Sendebuffer bauen.
1652
    if ((QMK_Server->property("Connect")) == true)
1652
    if ((QMK_Server->property("Connect")) == true)
1653
    {
1653
    {
1654
//        QMK_Server->send_RawData(RX.String);
1654
//        QMK_Server->send_RawData(RX.String);
1655
    }
1655
    }
1656
 
1656
 
1657
    slot_showTerminal(1, RX.String);
1657
    slot_showTerminal(1, RX.String);
1658
}
1658
}
1659
 
1659
 
1660
void MKTool::slot_showTerminal(int Typ, QString Text)
1660
void MKTool::slot_showTerminal(int Typ, QString Text)
1661
{
1661
{
1662
    switch(Typ)
1662
    switch(Typ)
1663
    {
1663
    {
1664
        case 1 :
1664
        case 1 :
1665
        {
1665
        {
1666
            if ((cb_ShowData->isChecked()) && ((tab_Main->currentWidget()->objectName() == QString("Tab_3")) || (cb_ShowAlways->isChecked())))
1666
            if ((cb_ShowData->isChecked()) && ((tab_Main->currentWidget()->objectName() == QString("Tab_3")) || (cb_ShowAlways->isChecked())))
1667
            {
1667
            {
1668
                te_RX->moveCursor(QTextCursor::End,  QTextCursor::MoveAnchor);
1668
                te_RX->moveCursor(QTextCursor::End,  QTextCursor::MoveAnchor);
1669
                te_RX->insertHtml("<span style=\"color:#00008b;\">" + Text + "<br /></span>");
1669
                te_RX->insertHtml("<span style=\"color:#00008b;\">" + Text + "<br /></span>");
1670
            }
1670
            }
1671
        }
1671
        }
1672
        break;
1672
        break;
1673
        case 2 :
1673
        case 2 :
1674
        {
1674
        {
1675
            if ((cb_ShowMSG->isChecked()) && ((tab_Main->currentWidget()->objectName() == QString("Tab_3")) || (cb_ShowAlways->isChecked())))
1675
            if ((cb_ShowMSG->isChecked()) && ((tab_Main->currentWidget()->objectName() == QString("Tab_3")) || (cb_ShowAlways->isChecked())))
1676
            {
1676
            {
1677
                if (Text.length() > 0)
1677
                if (Text.length() > 0)
1678
                {
1678
                {
1679
                    te_RX->moveCursor(QTextCursor::End,  QTextCursor::MoveAnchor);
1679
                    te_RX->moveCursor(QTextCursor::End,  QTextCursor::MoveAnchor);
1680
                    te_RX->insertHtml("<span style=\"color:#008b00;\">" + Text + "</span><br />");
1680
                    te_RX->insertHtml("<span style=\"color:#008b00;\">" + Text + "</span><br />");
1681
                }
1681
                }
1682
            }
1682
            }
1683
        }
1683
        }
1684
        break;
1684
        break;
1685
        case 3 :
1685
        case 3 :
1686
        {
1686
        {
1687
            if (cb_ShowSend->isChecked())
1687
            if (cb_ShowSend->isChecked())
1688
            {
1688
            {
1689
                te_RX->moveCursor(QTextCursor::End,  QTextCursor::MoveAnchor);
1689
                te_RX->moveCursor(QTextCursor::End,  QTextCursor::MoveAnchor);
1690
                te_RX->insertHtml("<span style='color:#8b0000;'>" + Text + "<br /></span>");
1690
                te_RX->insertHtml("<span style='color:#8b0000;'>" + Text + "<br /></span>");
1691
            }
1691
            }
1692
        }
1692
        }
1693
        break;
1693
        break;
1694
    }
1694
    }
1695
}
1695
}
1696
 
1696
 
1697
// Verbindung zum Kopter herstellen / Trennen
1697
// Verbindung zum Kopter herstellen / Trennen
1698
void MKTool::slot_OpenPort()
1698
void MKTool::slot_OpenPort()
1699
{
1699
{
1700
    if (o_Connection->isOpen())
1700
    if (o_Connection->isOpen())
1701
    {
1701
    {
1702
        TX_Data[0] = Settings->Data.Debug_Off / 10;
1702
        TX_Data[0] = Settings->Data.Debug_Off / 10;
1703
        o_Connection->send_Cmd('d', ADDRESS_ALL, TX_Data, 1, false);
1703
        o_Connection->send_Cmd('d', ADDRESS_ALL, TX_Data, 1, false);
1704
        ToolBox::Wait(SLEEP);
1704
        ToolBox::Wait(SLEEP);
1705
 
1705
 
1706
        if (Mode.ID == ADDRESS_NC)
1706
        if (Mode.ID == ADDRESS_NC)
1707
        {
1707
        {
1708
            TX_Data[0] = Settings->Data.Navi_Off / 10;
1708
            TX_Data[0] = Settings->Data.Navi_Off / 10;
1709
            o_Connection->send_Cmd('o', ADDRESS_NC, TX_Data, 1, false);
1709
            o_Connection->send_Cmd('o', ADDRESS_NC, TX_Data, 1, false);
1710
            ToolBox::Wait(SLEEP);
1710
            ToolBox::Wait(SLEEP);
1711
        }
1711
        }
1712
 
1712
 
1713
        if (Mode.ID == ADDRESS_FC)
1713
        if (Mode.ID == ADDRESS_FC)
1714
        {
1714
        {
1715
            TX_Data[0] = 0;
1715
            TX_Data[0] = 0;
1716
            TX_Data[1] = 0;
1716
            TX_Data[1] = 0;
1717
            TX_Data[2] = 0;
1717
            TX_Data[2] = 0;
1718
            TX_Data[3] = 0;
1718
            TX_Data[3] = 0;
1719
            o_Connection->send_Cmd('t', ADDRESS_FC, TX_Data, 4, false);
1719
            o_Connection->send_Cmd('t', ADDRESS_FC, TX_Data, 4, false);
1720
            ToolBox::Wait(SLEEP);
1720
            ToolBox::Wait(SLEEP);
1721
        }
1721
        }
1722
 
1722
 
1723
        o_Connection->Close();
1723
        o_Connection->Close();
1724
 
1724
 
1725
        ac_ConnectTTY->setText("Kopter Verbinden");
1725
        ac_ConnectTTY->setText("Kopter Verbinden");
1726
        le_Port->setEnabled(true);
1726
        le_Port->setEnabled(true);
1727
 
1727
 
1728
        Ticker->stop();
1728
        Ticker->stop();
1729
    }
1729
    }
1730
    else
1730
    else
1731
    {
1731
    {
1732
        int i_Type;
1732
        int i_Type;
1733
        if (le_Port->text().contains(QString("IP:")))
1733
        if (le_Port->text().contains(QString("IP:")))
1734
        {
1734
        {
1735
            i_Type = C_IP;
1735
            i_Type = C_IP;
1736
        }
1736
        }
1737
        else
1737
        else
1738
        {
1738
        {
1739
            i_Type = C_TTY;
1739
            i_Type = C_TTY;
1740
        }
1740
        }
1741
 
1741
 
1742
        if (o_Connection->Open(i_Type, le_Port->text()))
1742
        if (o_Connection->Open(i_Type, le_Port->text()))
1743
        {
1743
        {
1744
            ac_ConnectTTY->setText("Kopter Trennen");
1744
            ac_ConnectTTY->setText("Kopter Trennen");
1745
            le_Port->setEnabled(false);
1745
            le_Port->setEnabled(false);
1746
 
1746
 
1747
            o_Connection->send_Cmd('v', ADDRESS_ALL, TX_Data, 0, true);
1747
            o_Connection->send_Cmd('v', ADDRESS_ALL, TX_Data, 0, true);
1748
 
1748
 
1749
            Ticker->start(2000);
1749
            Ticker->start(2000);
1750
        }
1750
        }
1751
    }
1751
    }
1752
}
1752
}
1753
 
1753
 
1754
// Programm beenden
1754
// Programm beenden
1755
///////////////////
1755
///////////////////
1756
 
1756
 
1757
MKTool::~MKTool()
1757
MKTool::~MKTool()
1758
{
1758
{
1759
    if (o_Connection->isOpen())
1759
    if (o_Connection->isOpen())
1760
    {
1760
    {
1761
        o_Connection->Close();
1761
        o_Connection->Close();
1762
    }
1762
    }
1763
 
1763
 
1764
    set_Preferences();
1764
    set_Preferences();
1765
    Settings->write_Settings();
1765
    Settings->write_Settings();
1766
 
1766
 
1767
    logger->close();
1767
    logger->close();
1768
}
1768
}
1769
 
1769