-
Notifications
You must be signed in to change notification settings - Fork 0
/
paramwidget.h
367 lines (334 loc) · 8.24 KB
/
paramwidget.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
#ifndef PARAMWIDGET_H
#define PARAMWIDGET_H
#include <QWidget>
#include "motorform.h"
class QLineEdit;
class QPushButton;
class QTableWidget;
class QCheckBox;
class InnfosChartWidget;
class WaveTriggerWidget;
class AngleClock;
class MyDoubleSpinBox;
class QButtonGroup;
class QCheckBox;
class ParamWidget : public QWidget
{
Q_OBJECT
public:
explicit ParamWidget(quint8 nDeviceId,MotorForm::Motor_Mode modeId,QWidget *parent = 0);
virtual void initData()=0;
virtual ~ParamWidget(){}
bool isActivate();
enum SPIN_ATTR{
MIN_VALUE,
MAX_VALUE,
STEP_VALUE,
ATTR_CNT
};
public slots:
virtual void valueChangeByUser()=0;//user modify data
virtual void motorDataChange(quint8 nDeviceId, int nId)=0;//motor data change acturally
void activeMode(bool bActive);//active mode or not
virtual void enableMode(bool bEnable)=0;//
MotorForm::Motor_Mode getModeId()const{
return m_modeId;
}
virtual void onlineStatus(bool bOnline);
void currentErrorChange(qint16 nCurErrorId);
void showGraphWithRect(QRect rc);
void showGraph();
void closeGraph();
bool ChartShowing()const{return m_pGraph != nullptr;}
QRect chartGeometry()const;
void checkError();
protected:
void showErrorHistroy();
void errorBtnChange(bool bHasError);
bool isCurrentDevice(quint8 nDeviceId)const{return m_nDeviceId == nDeviceId;}
protected:
QTableWidget * m_pTableErrors;
QPushButton * m_pClearErrors;
QPushButton * m_pErrorInfos;
QPushButton * m_pStatus;
QPushButton * m_pBtnActiveMode;
WaveTriggerWidget * m_pWaveWidget;
quint8 m_nDeviceId;
private:
MotorForm::Motor_Mode m_modeId;
InnfosChartWidget * m_pGraph;
};
class CurWidget : public ParamWidget
{
Q_OBJECT
public:
explicit CurWidget(quint8 nDeviceId,MotorForm::Motor_Mode modeId,QWidget *parent = 0);
enum CurParams{
IQ_SET,
PROPORTIONAL,
INTEGRAL,
ID_SET,
MINIMAL,
MAXIMUM,
NOMINAL,
OUTPUT,
MAXSPEED,
CUR_PARAM_CNT,
};
enum CurActuals{
ACTUAL,
DEMAND,
VELOCITY,
POSITION,
VOLTAGE,
TEMP_MOTOR,
TEMP_INVERTER,
ACTUAL_CNT
};
signals:
public:
void initData();
public slots:
void valueChangeByUser();
void motorDataChange(quint8 nDeviceId, int nId);
virtual void enableMode(bool bEnable);
private:
MyDoubleSpinBox * m_pParams[CUR_PARAM_CNT];
QLineEdit * m_pActuals[ACTUAL_CNT];
QLineEdit * m_pModeEdit;
QPushButton * m_pBtnEffect;
QPushButton * m_pBtnHalt;
QPushButton * m_pViewGraph;
int m_nParamsDataId[CUR_PARAM_CNT];
int m_nActualsDataId[ACTUAL_CNT];
QPushButton * m_pSwitch;
};
class VelWidget : public ParamWidget
{
Q_OBJECT
public:
explicit VelWidget(quint8 nDeviceId,MotorForm::Motor_Mode modeId,QWidget *parent = 0);
enum VelParams{
SET,
PROPORTIONAL,
INTEGRAL,
MINIMAL,
MAXIMUM,
VEL_PARAM_CNT,
};
enum VelActual{
ACTUAL,
DEMAND,
CURRENT,
POSITION,
VOLTAGE,
TEMP_MOTOR,
TEMP_INVERTER,
ACTUAL_CNT
};
signals:
public:
void initData();
public slots:
void valueChangeByUser();
void motorDataChange(quint8 nDeviceId,int nId);
virtual void enableMode(bool bEnable);
private:
MyDoubleSpinBox * m_pParams[VEL_PARAM_CNT];
QLineEdit * m_pActuals[ACTUAL_CNT];
QLineEdit * m_pModeEdit;
//QPushButton * m_pBtnActiveMode;
QPushButton * m_pBtnEffect;
QPushButton * m_pBtnHalt;
QPushButton * m_pViewGraph;
int m_nParamsDataId[VEL_PARAM_CNT];
int m_nActualsDataId[ACTUAL_CNT];
};
class PosWidget : public ParamWidget
{
Q_OBJECT
public:
explicit PosWidget(quint8 nDeviceId,MotorForm::Motor_Mode modeId,QWidget *parent = 0);
enum PosParams{
SET,
PROPORTIONAL,
INTEGRAL,
DIFFERENTIAL,
MINIMAL,
MAXIMUM,
STEP_ADD,
MIN_POS,
MAX_POS,
POS_OFFSET,
POS_PARAM_CNT,
};
enum{
ACTUAL,
DEMAND,
CURRENT,
VELOCITY,
VOLTAGE,
TEMP_MOTOR,
TEMP_INVERTER,
ACTUAL_CNT
};
signals:
public:
void initData();
public slots:
void valueChangeByUser();
void motorDataChange(quint8 nDeviceId,int nId);
virtual void enableMode(bool bEnable);
void stepAdd();
void stepMinus();
private:
MyDoubleSpinBox * m_pParams[POS_PARAM_CNT];
QLineEdit * m_pActuals[ACTUAL_CNT];
QLineEdit * m_pModeEdit;
//QPushButton * m_pBtnActiveMode;
QPushButton * m_pBtnStepAdd;
QPushButton * m_pBtnStepMinus;
QPushButton * m_pBtnEffect;
// QPushButton * m_pBtnCalibrate;
// QPushButton * m_pBtnHoming;
QPushButton * m_pViewGraph;
QCheckBox * m_pMinEnable;
QCheckBox * m_pMaxEnable;
int m_nParamsDataId[POS_PARAM_CNT];
int m_nActualsDataId[ACTUAL_CNT];
};
class ProfilePosWidget : public ParamWidget
{
Q_OBJECT
public:
explicit ProfilePosWidget(quint8 nDeviceId,MotorForm::Motor_Mode modeId,QWidget *parent = 0);
enum ProfilePosParams{
TARGET,
PROFILE,
ACCELERATE,
DECELERATE,
MAX_SPEED,
STEP_ADD,
MIN_POS,
MAX_POS,
POS_OFFSET,
ACTUAL,
DEMAND,
CURRENT,
VELOCITY,
VOLTAGE,
TEMP_MOTOR,
TEMP_INVERTER,
PROFILE_POS_PARAM_CNT,
};
signals:
public:
void initData();
public slots:
void valueChangeByUser();
void motorDataChange(quint8 nDeviceId,int nId);
virtual void enableMode(bool bEnable);
private:
QWidget * m_pParams[PROFILE_POS_PARAM_CNT];
QLineEdit * m_pModeEdit;
//QPushButton * m_pBtnActiveMode;
QPushButton * m_pBtnStepAdd;
QPushButton * m_pBtnStepMinus;
QPushButton * m_pBtnHalt;
QPushButton * m_pViewGraph;
int m_nDataId[PROFILE_POS_PARAM_CNT];
};
class ProfileVelWidget : public ParamWidget
{
Q_OBJECT
public:
explicit ProfileVelWidget(quint8 nDeviceId,MotorForm::Motor_Mode modeId,QWidget *parent = 0);
enum ProfileVelParams{
TARGET,
PROFILE,
ACCELERATE,
DECELERATE,
MAX_SPEED,
ACTUAL,
DEMAND,
CURRENT,
POSITION,
VOLTAGE,
TEMP_MOTOR,
TEMP_INVERTER,
PROFILE_VEL_PARAM_CNT,
};
signals:
public:
void initData();
public slots:
void valueChangeByUser();
void motorDataChange(quint8 nDeviceId,int nId);
virtual void enableMode(bool bEnable);
private:
QWidget * m_pParams[PROFILE_VEL_PARAM_CNT];
QLineEdit * m_pModeEdit;
//QPushButton * m_pBtnActiveMode;
QPushButton * m_pBtnAbsolute;
QPushButton * m_pBtnRelative;
QPushButton * m_pBtnHalt;
QPushButton * m_pViewGraph;
int m_nDataId[PROFILE_VEL_PARAM_CNT];
};
class HomingWidget : public ParamWidget
{
Q_OBJECT
public:
explicit HomingWidget(quint8 nDeviceId,MotorForm::Motor_Mode modeId,QWidget *parent = 0);
enum HomingParams{
MAX_POS,
MIN_POS,
VEL_SET,
VEL_ADD,
VEL_MIN,
VEL_MAX,
CURRENT,
VELOCITY,
POSITION,
POS_OFFSET,
INERTIA,
LOCK_ENERGY,
TEMP_PROTECT,
TEMP_RECOVERY,
HOMING_PARAM_CNT,
};
signals:
public:
void initData();
public slots:
void valueChangeByUser();
void motorDataChange(quint8 nDeviceId,int nId);
virtual void enableMode(bool bEnable);
void homingCallback();
void homingCallback2();
void velAddCallback();
void velMinusCallback();
protected slots:
void operationModeChanged(int nChangeId);
private:
void setVelocity(qreal vel);
private:
QLineEdit * m_pParams[HOMING_PARAM_CNT];
QLineEdit * m_pModeEdit;
//QPushButton * m_pBtnActiveMode;
QPushButton * m_pBtnCalibrate;
QPushButton * m_pBtnHoming;
QPushButton * m_pBtnVelAdd;
QPushButton * m_pBtnVelMinus;
QPushButton * m_pBtnHalt;
QPushButton * m_pReset;
QPushButton * m_pBtnAuto;
QPushButton * m_pBtnManual;
QCheckBox * m_pNeedLimit;
QButtonGroup * m_pGroup;
QPushButton * m_pSetMin;
QPushButton * m_pSetMax;
//QPushButton * m_pViewGraph;
int m_nDataId[HOMING_PARAM_CNT];
};
#endif // PARAMWIDGET_H