Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
158 | KeyOz | 1 | /*************************************************************************** |
2 | * Copyright (C) 2008 by Manuel Schrape * |
||
3 | * manuel.schrape@gmx.de * |
||
4 | * * |
||
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 * |
||
7 | * the Free Software Foundation; either version 2 of the License. * |
||
8 | * * |
||
9 | * This program is distributed in the hope that it will be useful, * |
||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
||
12 | * GNU General Public License for more details. * |
||
13 | * * |
||
14 | * You should have received a copy of the GNU General Public License * |
||
15 | * along with this program; if not, write to the * |
||
16 | * Free Software Foundation, Inc., * |
||
17 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
||
18 | ***************************************************************************/ |
||
19 | |||
20 | |||
21 | #ifndef MKTOOL_H |
||
22 | #define MKTOOL_H |
||
23 | |||
24 | #include <QMainWindow> |
||
25 | #include <QSettings> |
||
26 | #include <QString> |
||
27 | #include <QTimer> |
||
28 | #include <QComboBox> |
||
29 | #include <QIcon> |
||
30 | #include <QProcess> |
||
31 | |||
32 | #include <qwt_plot_curve.h> |
||
33 | #include <qwt_plot_grid.h> |
||
34 | #include <qwt_legend.h> |
||
35 | #include <qwt_plot.h> |
||
36 | #include "ui_mktool.h" |
||
37 | |||
38 | #include "../SerialPort/ManageSerialPort.h" |
||
39 | #include "../cSettings.h" |
||
40 | |||
41 | class QextSerialPort; |
||
42 | |||
43 | class MKTool : public QMainWindow, public Ui::dlg_mktool_UI |
||
44 | { |
||
45 | Q_OBJECT |
||
46 | |||
47 | public: |
||
48 | MKTool(); |
||
49 | ~MKTool(); |
||
50 | |||
51 | private: |
||
159 | KeyOz | 52 | bool AllowSend; |
158 | KeyOz | 53 | // Object für Serielport |
54 | ManageSerialPort *serialPort; |
||
55 | |||
56 | // Settings-Object |
||
57 | cSettings *Settings; |
||
58 | |||
59 | // Default-Ticker |
||
60 | QTimer *Ticker; |
||
61 | |||
62 | // Die Tabs des Hauptfensters |
||
63 | QWidget *TabWidgets[6]; |
||
64 | |||
65 | // Analogwert-Beschreibungen |
||
66 | QLabel *lb_Analog[MaxAnalog]; |
||
67 | |||
68 | // Analogwerte |
||
69 | int AnalogData[MaxAnalog]; |
||
70 | |||
71 | // Plots für die Analogwerte |
||
72 | QwtPlotCurve *Plot[MaxAnalog]; |
||
73 | |||
74 | // Datenspeicher für die Plots |
||
75 | double aData[MaxAnalog][MaxPlot]; |
||
76 | double aID[MaxPlot]; |
||
77 | int NextPlot; |
||
78 | |||
79 | // Ticker-Event-Array |
||
80 | bool TickerEvent[MaxTickerEvents]; |
||
81 | bool TickerDiv; |
||
82 | |||
159 | KeyOz | 83 | int LCD_Page; |
84 | int LCD_MAX_Page; |
||
85 | |||
158 | KeyOz | 86 | // Alle Icons |
87 | QIcon Icons[30]; |
||
88 | |||
89 | // QByteArray allDataReceived; |
||
90 | |||
91 | // Object für das Datenfile; |
||
92 | QFile *CSVFile; |
||
93 | |||
94 | sMode Mode; |
||
95 | sRxData RxData; |
||
96 | |||
97 | QString RXS; |
||
98 | QString LastSend; |
||
99 | |||
100 | // TestOnly |
||
162 | KeyOz | 101 | QProcess *Update; |
158 | KeyOz | 102 | |
103 | |||
104 | // int DecodeData[150]; |
||
105 | char TX_Data[150]; |
||
106 | |||
107 | int ParameterSet[11][MaxParameter]; |
||
108 | |||
109 | // Programm Initialisieren |
||
110 | void init_GUI(); |
||
111 | void init_Objects(); |
||
112 | void init_Connections(); |
||
113 | void init_Arrays(); |
||
114 | void init_Icons(); |
||
115 | void init_Plot(); |
||
116 | |||
117 | // Daten-Plotter |
||
118 | void update_Plot(); |
||
119 | 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 | |||
128 | // Daten Senden, Empfangen und verarbeiten |
||
159 | KeyOz | 129 | void send_Data(char CMD, int Address, char Data[150],unsigned int Length, bool Resend = true); |
158 | KeyOz | 130 | void new_RXData(sRxData RX); |
131 | |||
132 | // Debugdaten anzeigen und speichern. |
||
133 | void show_DebugData(); |
||
134 | void write_CSV(); |
||
135 | |||
136 | // Programmeinstellungen speichern |
||
137 | void write_Settings(); |
||
138 | |||
139 | private slots: |
||
140 | void slot_ac_Config(); |
||
159 | KeyOz | 141 | void slot_ac_Preferences(); |
158 | KeyOz | 142 | void slot_ac_StartPlotter(); |
143 | void slot_ac_View(); |
||
144 | void slot_ac_MehrDaten(); |
||
145 | void slot_ac_About(); |
||
146 | void slot_ac_GetLabels(); |
||
147 | void slot_ac_Motortest(); |
||
148 | |||
149 | // Default-Ticker |
||
150 | void slot_Ticker(); |
||
151 | |||
159 | KeyOz | 152 | void slot_LCD_UP(); |
153 | void slot_LCD_DOWN(); |
||
154 | |||
158 | KeyOz | 155 | void slot_Motortest(int Motor1, int Motor2, int Motor3, int Motor4); |
156 | |||
157 | void slot_pb_Update(); |
||
158 | |||
159 | void slot_UpdateShell(); |
||
160 | |||
161 | // Seriell-Port Slots |
||
162 | void slot_newDataReceived(const QByteArray &dataReceived); |
||
163 | void slot_OpenPort(); |
||
164 | |||
165 | void slot_tbUp(); |
||
166 | void slot_tbDown(); |
||
167 | void slot_tbLeft(); |
||
168 | void slot_tbRight(); |
||
169 | void slot_LEDtoValue(); |
||
170 | void slot_ValuetoLED16(int Wert); |
||
171 | void slot_ValuetoLED17(int Wert); |
||
172 | |||
173 | void slot_TabChanged(int Tab); |
||
174 | |||
175 | void slot_RecordCSV(); |
||
176 | |||
177 | void slot_ScrollPlot(int Pos); |
||
178 | |||
179 | void slot_GetParameter(); |
||
180 | void slot_SetParameter(); |
||
181 | void slot_LoadParameter(); |
||
182 | void slot_SaveParameter(); |
||
183 | }; |
||
184 | |||
185 | #endif |