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