Subversion Repositories Projects

Rev

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

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