Subversion Repositories Projects

Rev

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

Rev 166 Rev 167
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
 
20
 
21
#ifndef MKTOOL_H
21
#ifndef MKTOOL_H
22
#define MKTOOL_H
22
#define MKTOOL_H
23
 
23
 
24
#include <QMainWindow>
24
#include <QMainWindow>
25
#include <QSettings>
25
#include <QSettings>
26
#include <QString>
26
#include <QString>
27
#include <QTimer>
27
#include <QTimer>
28
#include <QComboBox>
28
#include <QComboBox>
29
#include <QIcon>
29
#include <QIcon>
30
#include <QProcess>
30
#include <QProcess>
31
 
31
 
32
#include <qwt_plot_curve.h>
32
#include <qwt_plot_curve.h>
33
#include <qwt_plot_grid.h>
33
#include <qwt_plot_grid.h>
34
#include <qwt_legend.h>
34
#include <qwt_legend.h>
35
#include <qwt_plot.h>
35
#include <qwt_plot.h>
36
#include "ui_mktool.h"
36
#include "ui_mktool.h"
-
 
37
#include "wdg_Settings.h"
37
 
38
 
38
#include "../SerialPort/ManageSerialPort.h"
39
#include "../SerialPort/ManageSerialPort.h"
39
#include "../cSettings.h"
40
#include "../cSettings.h"
40
 
41
 
41
class QextSerialPort;
42
class QextSerialPort;
42
 
43
 
43
class MKTool : public QMainWindow, public Ui::dlg_mktool_UI
44
class MKTool : public QMainWindow, public Ui::dlg_mktool_UI
44
{
45
{
45
      Q_OBJECT
46
      Q_OBJECT
46
 
47
 
47
public:
48
public:
48
      MKTool();
49
      MKTool();
49
      ~MKTool();
50
      ~MKTool();
50
 
51
 
51
private:
52
private:
52
    bool AllowSend;
53
    bool AllowSend;
53
    // Object für Serielport
54
    // Object für Serielport
54
    ManageSerialPort *serialPort;
55
    ManageSerialPort *serialPort;
55
 
56
 
56
    // Settings-Object
57
    // Settings-Object
57
    cSettings *Settings;
58
    cSettings *Settings;
-
 
59
 
-
 
60
    // Settings-Widget
-
 
61
    wdg_Settings *f_Settings;
58
 
62
 
59
    // Default-Ticker
63
    // Default-Ticker
60
    QTimer *Ticker;
64
    QTimer *Ticker;
61
 
65
 
62
    // Die Tabs des Hauptfensters
66
    // Die Tabs des Hauptfensters
63
    QWidget *TabWidgets[6];
67
    QWidget *TabWidgets[6];
64
 
68
 
65
    // Analogwert-Beschreibungen
69
    // Analogwert-Beschreibungen
66
    QLabel *lb_Analog[MaxAnalog];
70
    QLabel *lb_Analog[MaxAnalog];
67
 
71
 
68
    // Analogwerte
72
    // Analogwerte
69
    int AnalogData[MaxAnalog];
73
    int AnalogData[MaxAnalog];
70
 
74
 
71
    // Plots für die Analogwerte
75
    // Plots für die Analogwerte
72
    QwtPlotCurve *Plot[MaxAnalog];
76
    QwtPlotCurve *Plot[MaxAnalog];
73
 
77
 
74
    // Datenspeicher für die Plots
78
    // Datenspeicher für die Plots
75
    double aData[MaxAnalog][MaxPlot];
79
    double aData[MaxAnalog][MaxPlot];
76
    double aID[MaxPlot];
80
    double aID[MaxPlot];
77
    int NextPlot;
81
    int NextPlot;
78
 
82
 
79
    // Ticker-Event-Array
83
    // Ticker-Event-Array
80
    bool TickerEvent[MaxTickerEvents];
84
    bool TickerEvent[MaxTickerEvents];
81
    bool TickerDiv;
85
    bool TickerDiv;
82
 
86
 
83
    int LCD_Page;
87
    int LCD_Page;
84
    int LCD_MAX_Page;
88
    int LCD_MAX_Page;
85
 
89
 
86
    // Alle Icons
90
    // Alle Icons
87
    QIcon Icons[30];
91
    QIcon Icons[30];
88
 
92
 
89
//    QByteArray allDataReceived;
93
//    QByteArray allDataReceived;
90
 
94
 
91
    // Object für das Datenfile;
95
    // Object für das Datenfile;
92
    QFile  *CSVFile;
96
    QFile  *CSVFile;
93
 
97
 
94
    sMode Mode;
98
    sMode Mode;
95
    sRxData RxData;
99
    sRxData RxData;
96
 
100
 
97
    QString RXS;
101
    QString RXS;
98
    QString LastSend;
102
    QString LastSend;
99
 
103
 
100
    // TestOnly
104
    // Softwareupdate
101
    QProcess *Update;
-
 
102
 
-
 
103
 
105
    QProcess *Update;
104
//    int DecodeData[150];
106
 
105
    char TX_Data[150];
107
    char TX_Data[150];
106
 
108
 
107
    int ParameterSet[11][MaxParameter];
109
    int ParameterSet[11][MaxParameter];
108
 
110
 
109
    // Programm Initialisieren
111
    // Programm Initialisieren
110
    void init_GUI();
112
    void init_GUI();
111
    void init_Objects();
113
    void init_Objects();
112
    void init_Connections();
114
    void init_Connections();
113
    void init_Arrays();
115
    void init_Arrays();
114
    void init_Icons();
116
    void init_Icons();
115
    void init_Plot();
117
    void init_Plot();
116
 
118
 
117
    // Daten-Plotter
119
    // Daten-Plotter
118
    void update_Plot();
120
    void update_Plot();
119
    void config_Plot();
121
    void config_Plot();
120
 
-
 
121
    // Settings-Bereich
-
 
122
    QComboBox *setCombo(QComboBox *Combo, int Set, int Wert);
-
 
123
    int get_Value(QComboBox *Combo);
-
 
124
    void show_ParameterSet(int Set);
-
 
125
    void store_ParameterSet(int Set);
-
 
126
    void set_LED(QToolButton *ToolButton, bool On=false);
-
 
127
 
122
 
128
    // Daten Senden, Empfangen und verarbeiten
123
    // Daten Senden, Empfangen und verarbeiten
129
    void send_Data(char CMD, int Address, char Data[150],unsigned int Length, bool Resend = true);
124
    void send_Data(char CMD, int Address, char Data[150],unsigned int Length, bool Resend = true);
130
    void new_RXData(sRxData RX);
125
    void new_RXData(sRxData RX);
131
 
126
 
132
    // Debugdaten anzeigen und speichern.
127
    // Debugdaten anzeigen und speichern.
133
    void show_DebugData();
128
    void show_DebugData();
134
    void write_CSV();
129
    void write_CSV();
135
 
130
 
136
    // Programmeinstellungen speichern
131
    // Programmeinstellungen speichern
137
    void write_Settings();
132
    void set_Preferences();
138
 
133
 
139
private slots:
134
private slots:
140
    void slot_ac_Config();
135
    void slot_ac_Config();
141
    void slot_ac_Preferences();
136
    void slot_ac_Preferences();
142
    void slot_ac_StartPlotter();
137
    void slot_ac_StartPlotter();
143
    void slot_ac_View();
138
    void slot_ac_View();
144
    void slot_ac_MehrDaten();
139
    void slot_ac_MehrDaten();
145
    void slot_ac_KeineDaten();
140
    void slot_ac_KeineDaten();
146
    void slot_ac_About();
141
    void slot_ac_About();
147
    void slot_ac_GetLabels();
142
    void slot_ac_GetLabels();
148
    void slot_ac_Motortest();
143
    void slot_ac_Motortest();
149
    void slot_pb_HexFile();
144
    void slot_pb_HexFile();
150
 
145
 
151
    // Default-Ticker
146
    // Default-Ticker
152
    void slot_Ticker();
147
    void slot_Ticker();
153
 
148
 
154
    void slot_LCD_UP();
149
    void slot_LCD_UP();
155
    void slot_LCD_DOWN();
150
    void slot_LCD_DOWN();
156
 
151
 
157
    void slot_Motortest(int Motor1, int Motor2, int Motor3, int Motor4);
152
    void slot_Motortest(int Motor1, int Motor2, int Motor3, int Motor4);
158
 
153
 
159
    void slot_pb_Update();
154
    void slot_pb_Update();
160
 
155
 
161
    void slot_UpdateShell();
156
    void slot_UpdateShell();
162
 
157
 
163
    // Seriell-Port Slots
158
    // Seriell-Port Slots
164
    void slot_newDataReceived(const QByteArray &dataReceived);
159
    void slot_newDataReceived(const QByteArray &dataReceived);
165
    void slot_OpenPort();
160
    void slot_OpenPort();
166
 
-
 
167
    void slot_tbUp();
-
 
168
    void slot_tbDown();
-
 
169
    void slot_tbLeft();
-
 
170
    void slot_tbRight();
-
 
171
    void slot_LEDtoValue();
-
 
172
    void slot_ValuetoLED16(int Wert);
-
 
173
    void slot_ValuetoLED17(int Wert);
-
 
174
 
161
 
175
    void slot_TabChanged(int Tab);
162
    void slot_TabChanged(int Tab);
176
 
163
 
177
    void slot_RecordCSV();
164
    void slot_RecordCSV();
178
 
165
 
179
    void slot_ScrollPlot(int Pos);
166
    void slot_ScrollPlot(int Pos);
180
 
167
 
181
    void slot_GetParameter();
168
    void slot_GetParameter();
182
    void slot_SetParameter();
169
    void slot_SetParameter();
183
    void slot_LoadParameter();
-
 
184
    void slot_SaveParameter();
-
 
185
};
170
};
186
 
171
 
187
#endif
172
#endif
188
 
173