ovenstatics.h
28.5 KB
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
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
#ifndef OVENSTATICS_H
#define OVENSTATICS_H
#include <QObject>
#include <time.h>
#include <qmap.h>
#include "../../app-prime-modbus/include/all_share.h"
#include "udphandler.h"
#include "oven.h"
#include "servicedata.h"
#include "config.h"
#include "servicepassinputdlg.h"
#define MAX_MODEL_COUNT 12
#define SYS_STATE_MAX 5
#define DELAY_ERROR_TIME 10 //Secs
#define SYS_ERR_MAX 10
#define SYS_ERROR_MASK 0x03ff
#define COMM_ERROR_MASK 0x001f
#define SENSOR_ERROR_MASK 0x0213
#define STATE_ERROR_MASK 0x0018
#define SYS_ERR_MASK_ERR_CLEAR_COOKING 0x00ff
#define SYS_ERR_MASK_ERR_CLEAR_NONCOOKING 0x00ff
#define SYS_ERR_MASK_COOKING 0x00ff
#define SYS_ERR_MASK_NONCOOKING (SYS_ERR_OVNE_TEMP_ALARM)
#define COMM_ERR_MAX 5
#define STATE_ERR_MAX 5
#define COMM_ERR_MASK_ERR_CLEAR_COOKING 0x0000
#define COMM_ERR_MASK_ERR_CLEAR_NONCOOKING 0x0000
#define COMM_ERR_MASK_COOKING 0x0000
#define COMM_ERR_MASK_NONCOOKING 0x0000
#define SENSOR_ERR_MAX 10
#define SENSOR_ERR_MASK_ERR_CLEAR 0x0000
#define SENSOR_ERR_MASK_COOKING 0x0000
#define SENSOR_ERR_MASK_NONCOOKING 0x0000
#define MAKE_MASK(MASK) (1<<MASK)
#define LOAD_STATE1_UPPER_BUNNER 0x0001
#define LOAD_STATE1_LOWER_BUNNER 0x0002
#define LOAD_STATE1_STEAM_BUNNER 0x0004
#define LOAD_STATE1_UPPER_FAN 0x0008
#define LOAD_STATE1_LOWER_FAN 0x0010
#define LOAD_STATE1_STEAM_FAN 0x0020
#define LOAD_STATE1_CONVEC_FAN1 0x0040
#define LOAD_STATE1_CONVEC_FAN2 0x0080
/*#define LOAD_STATE2_DV 0x0001
#define LOAD_STATE2_CFAN 0x0002
#define LOAD_STATE2_WSV 0x0004
#define LOAD_STATE2_QNV 0x0008
#define LOAD_STATE2_SSV 0x0010
#define LOAD_STATE2_SNV 0x0020
#define LOAD_STATE2_ERRLED 0x0040
#define LOAD_STATE2_ATVLED 0x0080
#define LOAD_STATE2_HL 0x0100
#define LOAD_STATE2_DP 0x0200
#define LOAD_STATE2_SSP 0x0400
#define LOAD_STATE2_UNP 0x0800
#define LOAD_STATE2_HT1 0x1000
#define LOAD_STATE2_HT2 0x2000
#define LOAD_STATE2_HDM 0x4000
#define LOAD_STATE2_ST1 0x8000*/
#define LOAD_STATE2_DV 0x0001
#define LOAD_STATE2_CFAN 0x0002
#define LOAD_STATE2_WSV 0x0004
#define LOAD_STATE2_QNV 0x0008
#define LOAD_STATE2_SSV 0x0010
#define LOAD_STATE2_SNV 0x0020
#define LOAD_STATE2_HL 0x0040
#define LOAD_STATE2_DP 0x0080
#define LOAD_STATE2_SSP 0x0100
#define LOAD_STATE2_UNP 0x0200
#define LOAD_STATE2_HDM 0x0400
#define LOAD_STATE2_SGNV 0x0800
enum sys_state_type{
SYS_OFF_COOK_OFF=0,
SYS_ON_COOK_OFF=1,
SYS_ON_COOK_ON=2,
SYS_ON_WASH=3,
SYS_OFF_COOK_ON=4 //unnormal state
};
enum sys_error_id{
SYS_ERR_FIRE_TRIGGER1 =0,
SYS_ERR_FIRE_TRIGGER2 ,
SYS_ERR_FIRE_TRIGGER3 ,
SYS_ERR_OVNE_TEMP_ALARM ,
SYS_ERR_QUN_TEMP_ALARM ,
SYS_ERR_CENTER_TEMP_ALARM ,
SYS_ERR_WALL_TEMP_ALARM ,
SYS_ERR_STAM_TEMP_ALARM ,
SYS_ERR_WATER_LEVEL_FAIL ,
SYS_ERR_WATER_SPLY_FAIL
};
enum comm_err_id{
COMM_ERR_BUNNER1 =0,
COMM_ERR_BUNNER2 ,
COMM_ERR_BUNNER3 ,
COMM_ERR_UPPERFAN ,
COMM_ERR_LOWERFAN
};
enum state_err_id{
STATE_ERR_BUNNER1 =0,
STATE_ERR_BUNNER2 ,
STATE_ERR_BUNNER3 ,
STATE_ERR_UPPERFAN ,
STATE_ERR_LOWERFAN
};
enum sensor_err_id{
SENSOR_ERR_SENSOR_1 =0,
SENSOR_ERR_SENSOR_2 ,
SENSOR_ERR_SENSOR_3 ,
SENSOR_ERR_SENSOR_4 ,
SENSOR_ERR_SENSOR_5 ,
SENSOR_ERR_SENSOR_6 ,
SENSOR_ERR_SENSOR_7 ,
SENSOR_ERR_SENSOR_8 ,
SENSOR_ERR_SENSOR_9 ,
SENSOR_ERR_SENSOR_10
};
enum error_exe_type{
error_type_allnone=0,
error_type_olnystopcmd,
error_type_onlypop,
error_type_onlyeng,
error_type_onlychk,
error_type_popnonclr,
error_type_engnonclr,
error_type_clrsplit,
error_type_chkclr,
error_type_popclr,
error_type_engclr,
error_type_chkclrstopcmd,
error_type_popclrstopcmd,
error_type_engclrstopcmd,
};
enum error_sound_type{
error_sound_none=0,
error_sound1,
error_sound2
};
enum wash_mode_type{
wash_mode_nocleanser=1,
wash_mode_simple,
wash_mode_standard,
wash_mode_strong,
wash_mode_highspeed
};
enum water_level_state{
water_level_normal = 0,
water_level_low,
water_level_high
};
typedef union
{
uint32_t d32;
struct
{
uint32_t reserved : 9;
uint32_t door_open : 1;
uint32_t wsv_open : 1;
uint32_t dv_open : 1;
uint32_t sgnv_open : 1;
uint32_t water_level : 16;
uint32_t snv_open : 1;
uint32_t qnv_open : 1;
uint32_t ssv_open : 1;
}b;
}realtime_data;
typedef struct _popup_list_item{
QString strTitle;
QString strDesc;
bool bNeedClear;
}popup_list_item;
class OvenStatistics : public QObject
{
Q_OBJECT
public:
ServiceData* srvdata;
static OvenStatistics* getInstance(QObject* parent = 0);
static void destroy();
bool getNeedErrorClear();
void clearNeedErrorClear();
realtime_data getPartsRealtimeData(void);
uint8_t getSensorTypeByIdx(uint16_t idx);
type_temp getCurSensorValueByIdx(uint16_t idx);
void resetSensorHistory(void);
private:
/*
* 180920 : 중심온도 센서 과열 에러 삭제 *
*/
const uint32_t sys_err_mask[3][MAX_MODEL_COUNT] = {
{0x0398, //ele_10
0x0398, //ele_20
0x0398, //ele_24
0x0398, //ele_40
0x0398, //lpg_10
0x0398, //lpg_20
0x0398, //lpg_24
0x0398, //lpg_40
0x0398, //lng_10
0x0398, //lng_20
0x0398, //lng_24
0x0398 //lng_40
},// noncooking state
{0x039d, //ele_10
0x039f, //ele_20
0x039d, //ele_24
0x039f, //ele_40
0x039d, //lpg_10
0x039f, //lpg_20
0x039d, //lpg_24
0x039f, //lpg_40
0x039d, //lng_10
0x039f, //lng_20
0x039d, //lng_24
0x039f //lng_40
},//cooking state
{0x039d, //ele_10
0x039f, //ele_20
0x039d, //ele_24
0x039f, //ele_40
0x039d, //lpg_10
0x039f, //lpg_20
0x039d, //lpg_24
0x039f, //lpg_40
0x039d, //lng_10
0x039f, //lng_20
0x039d, //lng_24
0x039f //lng_40
} //washing state
};
const uint32_t comm_err_mask[3][MAX_MODEL_COUNT] = {
{0x000d, //ele_10
0x001f, //ele_20
0x000d, //ele_24
0x001f, //ele_40
0x000d, //lpg_10
0x001f, //lpg_20
0x000d, //lpg_24
0x001f, //lpg_40
0x000d, //lng_10
0x001f, //lng_20
0x000d, //lng_24
0x001f //lng_40
}, // noncooking state
{0x000d, //ele_10
0x001f, //ele_20
0x000d, //ele_24
0x001f, //ele_40
0x000d, //lpg_10
0x001f, //lpg_20
0x000d, //lpg_24
0x001f, //lpg_40
0x000d, //lng_10
0x001f, //lng_20
0x000d, //lng_24
0x001f //lng_40
}, //cooking state
{0x000d, //ele_10
0x001f, //ele_20
0x000d, //ele_24
0x001f, //ele_40
0x000d, //lpg_10
0x001f, //lpg_20
0x000d, //lpg_24
0x001f, //lpg_40
0x000d, //lng_10
0x001f, //lng_20
0x000d, //lng_24
0x001f //lng_40
} // washing state
};
// const uint32_t sensor_err_mask[MAX_MODEL_COUNT] = {0x0213, //ele10
// 0x0213, //ele 20
// 0x0213, //ele 24
// 0x0213, //ele 40
// 0x0213, //lpg 10
// 0x0213, //lpg 20
// 0x0213, //lpg 24
// 0x0213, //lpg 40
// 0x0213, //lng 10
// 0x0213, //lng 20
// 0x0213, //lng 24
// 0x0213 //lng40
// };
const uint32_t sensor_err_mask[3][MAX_MODEL_COUNT] = {
{0x0213, //ele10
0x0213, //ele 20
0x0213, //ele 24
0x0213, //ele 40
0x0213, //lpg 10
0x0213, //lpg 20
0x0213, //lpg 24
0x0213, //lpg 40
0x0213, //lng 10
0x0213, //lng 20
0x0213, //lng 24
0x0213 //lng40
}, // end of noncooking state
{0x0213, //ele10
0x0213, //ele 20
0x0213, //ele 24
0x0213, //ele 40
0x0213, //lpg 10
0x0213, //lpg 20
0x0213, //lpg 24
0x0213, //lpg 40
0x0213, //lng 10
0x0213, //lng 20
0x0213, //lng 24
0x0213 //lng40
}, //cooking state
{0x0213, //ele10
0x0213, //ele 20
0x0213, //ele 24
0x0213, //ele 40
0x0213, //lpg 10
0x0213, //lpg 20
0x0213, //lpg 24
0x0213, //lpg 40
0x0213, //lng 10
0x0213, //lng 20
0x0213, //lng 24
0x0213 //lng40
} // washing state
};
const uint32_t state_err_mask[3][MAX_MODEL_COUNT] = {
{0x0018, //ele 10
0x0018, //ele 20
0x0018, //ele 24
0x0018, //ele 40
0x0018, //lpg 10
0x0018, //lpg 20
0x0018, //lpg 24
0x0018, //lpg 40
0x0018, //lng 10
0x0018, //lng 20
0x0018, //lng 24
0x0018 //lng 40
}, //end of noncooking state
{0x0018, //ele 10
0x0018, //ele 20
0x0018, //ele 24
0x0018, //ele 40
0x0018, //lpg 10
0x0018, //lpg 20
0x0018, //lpg 24
0x0018, //lpg 40
0x0018, //lng 10
0x0018, //lng 20
0x0018, //lng 24
0x0018 //lng 40
},
{0x0000, //ele 10
0x0000, //ele 20
0x0000, //ele 24
0x0000, //ele 40
0x0000, //lpg 10
0x0000, //lpg 20
0x0000, //lpg 24
0x0000, //lpg 40
0x0000, //lng 10
0x0000, //lng 20
0x0000, //lng 24
0x0000 //lng 40
}//washing state
};
const error_exe_type sys_err_type_def[SYS_STATE_MAX][SYS_ERR_MAX]={ //30047
{error_type_popclr,error_type_popclr,error_type_popclr,error_type_popclr,error_type_popclr,
error_type_popclr,error_type_popclr,error_type_popclr,error_type_popclr,error_type_popclr}, // SYS_OFF_COOK_OFF state
{error_type_onlychk,error_type_onlychk,error_type_onlychk,error_type_engclrstopcmd,error_type_engclrstopcmd,
error_type_engclrstopcmd,error_type_engclrstopcmd,error_type_engclrstopcmd,error_type_popclr,error_type_popclr}, // SYS_ON_COOK_OFF state
{error_type_popclrstopcmd,error_type_popclrstopcmd,error_type_popclrstopcmd,error_type_popclrstopcmd,error_type_popclrstopcmd,
error_type_popclrstopcmd,error_type_popclrstopcmd,error_type_popclrstopcmd,error_type_popclrstopcmd,error_type_popclrstopcmd}, // SYS_ON_COOK_ON state
{error_type_popclr,error_type_popclr,error_type_popclr,error_type_popclr,error_type_popclr,
error_type_popclr,error_type_popclr,error_type_popclr,error_type_popclr,error_type_popclr}, // SYS_ON_WASH state
{error_type_popclr,error_type_popclr,error_type_popclr,error_type_popclr,error_type_popclr,
error_type_popclr,error_type_popclr,error_type_popclr,error_type_popclr,error_type_popclr}, // SYS_OFF_COOK_ON state
};
const error_exe_type comm_err_type_def[SYS_STATE_MAX][COMM_ERR_MAX] ={ //30048
{error_type_popnonclr,error_type_popnonclr,error_type_popnonclr,error_type_engnonclr,error_type_engnonclr}, //SYS_OFF_COO_OFF
{error_type_popclrstopcmd,error_type_popclrstopcmd,error_type_popclrstopcmd,error_type_popclrstopcmd,error_type_popclrstopcmd}, //SYS_ON_COO_OFF
{error_type_popclrstopcmd,error_type_popclrstopcmd,error_type_popclrstopcmd,error_type_popclrstopcmd,error_type_popclrstopcmd}, //SYS_ON_COO_ON
{error_type_popclr,error_type_popclr,error_type_popclr,error_type_popclr,error_type_popclr}, //SYS_ON_WASH
{error_type_popnonclr,error_type_popnonclr,error_type_popnonclr,error_type_engnonclr,error_type_engnonclr}, //SYS_OFF_COO_ON
};
const error_exe_type state_err_type_def[SYS_STATE_MAX][STATE_ERR_MAX] ={ //30057
{error_type_popclr,error_type_popclr,error_type_popclr,error_type_popclr,error_type_popclr}, //SYS_OFF_COO_OFF
{error_type_popclrstopcmd,error_type_popclrstopcmd,error_type_popclrstopcmd,error_type_popclrstopcmd,error_type_popclrstopcmd}, //SYS_ON_COO_OFF
{error_type_popclrstopcmd,error_type_popclrstopcmd,error_type_popclrstopcmd,error_type_popclrstopcmd,error_type_popclrstopcmd}, //SYS_ON_COO_ON
{error_type_allnone,error_type_allnone,error_type_allnone,error_type_allnone,error_type_allnone}, //SYS_ON_WASH
//{error_type_popclrstopcmd,error_type_popclrstopcmd,error_type_popclrstopcmd,error_type_popclrstopcmd,error_type_popclrstopcmd}, //SYS_ON_WASH
{error_type_popclr,error_type_popclr,error_type_popclr,error_type_popclr,error_type_popclr}, //SYS_OFF_COO_ON
};
const error_exe_type sensor_err_type_def[SYS_STATE_MAX][SENSOR_ERR_MAX]={ //30049
{error_type_popclr,error_type_popclr,error_type_allnone,error_type_popclr,error_type_popclr,
error_type_popclr,error_type_popclr,error_type_popclr,error_type_popclr,error_type_popclr}, // SYS_OFF_COOK_OFF state
{error_type_popclrstopcmd,error_type_popclrstopcmd,error_type_allnone,error_type_popclrstopcmd,error_type_popclrstopcmd,
error_type_popclrstopcmd,error_type_popclrstopcmd,error_type_popclrstopcmd,error_type_popclrstopcmd,error_type_popclrstopcmd}, // SYS_ON_COOK_OFF state
{error_type_popclrstopcmd,error_type_popclrstopcmd,error_type_allnone,error_type_popclrstopcmd,error_type_popclrstopcmd,
error_type_popclrstopcmd,error_type_popclrstopcmd,error_type_popclrstopcmd,error_type_popclrstopcmd,error_type_popclrstopcmd}, // SYS_ON_COOK_ON state
{error_type_popclr,error_type_popclr,error_type_allnone,error_type_allnone,error_type_popclr,
error_type_popclr,error_type_popclr,error_type_popclr,error_type_popclr,error_type_popclr}, // SYS_ON_WASH
{error_type_engnonclr,error_type_popnonclr,error_type_allnone,error_type_popnonclr,error_type_onlychk,
error_type_popnonclr,error_type_allnone,error_type_allnone,error_type_allnone,error_type_popnonclr}, // SYS_OFF_COOK_ON state same with SYS_OFF_COOK_OFF
};
const error_sound_type sys_err_sound_def[SYS_ERR_MAX]={ //30047
error_sound2,error_sound2,error_sound2,error_sound2,error_sound2,
error_sound2,error_sound2,error_sound2,error_sound2,error_sound2};
const error_sound_type comm_err_sound_def[COMM_ERR_MAX] ={ //30048
error_sound1,error_sound1,error_sound1,error_sound1,error_sound1};
const error_sound_type state_err_sound_def[STATE_ERR_MAX] ={ //30057
error_sound1,error_sound1,error_sound1,error_sound1,error_sound1};
const error_sound_type sensor_err_sound_def[SENSOR_ERR_MAX]={ //30049
error_sound1,error_sound1,error_sound1,error_sound1,error_sound1,
error_sound1,error_sound1,error_sound1,error_sound1,error_sound2};
const uint8_t sensorTypeInfo[MAX_LOG_SENSOR] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 1, 2, 0, 1, 1
}; //Type 2 is /10 value;
type_temp curSensorValue[MAX_LOG_SENSOR];
static OvenStatistics* p_singletonInstance;
UdpHandler *udp;
Oven* oven;
Config* cfg;
oven_control_t control;
oven_state_t state;
error_item* m_pLastErrItem;
QMap<uint32_t, QWidget *> m_mapPopupList;
uint32_t m_nLastPopupidx;
bool m_bPopupShow;
bool curdoorstate;
uint16_t curSysErrorState;
uint16_t curCommErrorState;
uint16_t curSensorErrorState;
uint16_t curControlErrorState;
bool bNeedErrorClear;
bool bDataRefreshed;
realtime_data realdata;
ServicePassInputDlg *m_wndSrvpassdlg;
uint32_t m_nUpperRpm;
uint32_t m_nLowerRpm;
uint32_t m_nSteamRpm;
explicit OvenStatistics(QObject* parent);
~OvenStatistics();
void processSystemError(uint16_t errflag,time_t ltime);
void processCommError(uint16_t errflag,time_t ltime);
void processSensorError(uint16_t errflag, time_t ltime);
void processStateError(uint16_t errflat, time_t ltime);
void processErrorItems(error_item *item, error_exe_type errtype, const QString &MsgDesc,const QString &MsgTitle, time_t ltime, error_sound_type errsnd=error_sound1);
public:
bool loadWashState(void){return srvdata->loadWashState();}
bool setWashState(bool bval,bool save=true){return srvdata->setWashState(bval,save);}
uint32_t loadTotalCookingTime(void){return srvdata->loadTotalCookingTime();}
bool setTotalCookingTime(uint32_t val, bool save=true){return srvdata->setTotalCookingTime(val,save);}
bool addTotalCookingTime(uint32_t val, bool save=true){return srvdata->addTotalCookingTime(val,save);}
uint32_t loadTotalCookingCount(void){return srvdata->loadTotalCookingCount();}
bool setTotalCookingCount(uint32_t val,bool save = true){return srvdata->setTotalCookingCount(val,save);}
bool addTotalCookingCount(uint32_t val, bool save = true){return srvdata->addTotalCookingCount(val,save);}
public slots:
void onDataChanged();
void oneSecTimerFired(void);
void onErrorPopupClosed(int erridx);
void setWndPassInputNull(void){m_wndSrvpassdlg = NULL;}
signals:
void onErrorFired(int erridx);
};
#endif // OVENSTATICS_H