Blame view

app/gui/oven_control/ovenstatics.h 8.53 KB
652e9cd54   고영탁   Merge
1
2
3
4
5
  #ifndef OVENSTATICS_H
  #define OVENSTATICS_H
  
  #include <QObject>
  #include <time.h>
cf0ca80f6   김태훈   app_oven_control를...
6
  #include "../../app-prime-modbus/include/all_share.h"
652e9cd54   고영탁   Merge
7
8
9
  #include "udphandler.h"
  #include "oven.h"
  #include "servicedatas.h"
c50beef02   고영탁   에러 처리 루틴 및 에러 처리 ...
10
  #define SYS_STATE_MAX 4
652e9cd54   고영탁   Merge
11
652e9cd54   고영탁   Merge
12
c50beef02   고영탁   에러 처리 루틴 및 에러 처리 ...
13
  #define SYS_ERR_MAX     10
652e9cd54   고영탁   Merge
14
c50beef02   고영탁   에러 처리 루틴 및 에러 처리 ...
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
  #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 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
  
  enum sys_state_type{
      SYS_OFF_COOK_OFF=0,
      SYS_ON_COOK_OFF=1,
      SYS_ON_COOK_ON=2,
      SYS_OFF_COOK_ON=3 //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_LOWERPAN
  };
  
  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_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,
  };
  
  
  enum wash_mode_type{
      wash_mode_nocleanser=1,
      wash_mode_simple,
      wash_mode_standard,
      wash_mode_strong,
      wash_mode_highspeed
  };
652e9cd54   고영탁   Merge
128
129
130
131
132
133
134
  
  class OvenStatics : public QObject
  {
      Q_OBJECT
  public:
      static OvenStatics* getInstance(QObject* parent = 0,UdpHandler * udp=0, Oven* oven=0);
      static void destroy();
c50beef02   고영탁   에러 처리 루틴 및 에러 처리 ...
135
136
      bool getNeedErrorClear();
      void clearNeedErrorClear();
652e9cd54   고영탁   Merge
137
138
  
  private:
c50beef02   고영탁   에러 처리 루틴 및 에러 처리 ...
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
  
      const error_exe_type sys_err_type_def[SYS_STATE_MAX][SYS_ERR_MAX]={
                                                          {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_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_COOK_OFF 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_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_OFF_COOK_ON state
                                                          };
  
      const error_exe_type comm_err_type_def[SYS_STATE_MAX][COMM_ERR_MAX] ={\
                                                         {error_type_popnonclr,error_type_popnonclr,error_type_popnonclr,error_type_engnonclr,error_type_engnonclr}, //SYS_OFF_COO_OFF
                                                         {error_type_popnonclr,error_type_popnonclr,error_type_popnonclr,error_type_engnonclr,error_type_engnonclr}, //SYS_ON_COO_OFF
                                                         {error_type_popnonclr,error_type_popnonclr,error_type_popnonclr,error_type_popnonclr,error_type_popnonclr}, //SYS_ON_COO_ON
                                                         {error_type_popnonclr,error_type_popnonclr,error_type_popnonclr,error_type_engnonclr,error_type_engnonclr}, //SYS_OFF_COO_ON
      };
  
      const error_exe_type sensor_err_type_def[SYS_STATE_MAX][SENSOR_ERR_MAX]={
                                                          {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_OFF state
                                                          {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_ON_COOK_OFF state
                                                          {error_type_onlychk,error_type_onlychk,error_type_allnone,error_type_popnonclr,error_type_popnonclr,
                                                          error_type_popnonclr,error_type_allnone,error_type_allnone,error_type_allnone,error_type_popnonclr}, // SYS_ON_COOK_ON state
                                                          {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
      };
652e9cd54   고영탁   Merge
168
169
170
171
172
173
174
175
176
177
      static OvenStatics* p_singtonInstance;
      UdpHandler *udp;
      Oven* oven;
      oven_control_t control;
      oven_state_t state;
      servicedatas* srvdatas;
  
  
      bool curdoorstate;
      uint16_t curSysErrorState;
c50beef02   고영탁   에러 처리 루틴 및 에러 처리 ...
178
179
180
181
      uint16_t curCommErrorState;
      uint16_t curSensorErrorState;
      bool bNeedErrorClear;
      bool bDataRefreshed;
652e9cd54   고영탁   Merge
182
183
184
      explicit OvenStatics(QObject* parent);
      ~OvenStatics();
      void processSystemError(uint16_t errflag,time_t ltime);
c50beef02   고영탁   에러 처리 루틴 및 에러 처리 ...
185
186
187
      void processCommError(uint16_t errflag,time_t ltime);
      void processSensorError(uint16_t errflag, time_t ltime);
      void processErrorItems(error_item *item, error_exe_type errtype, const QString &MsgDesc, time_t ltime);
652e9cd54   고영탁   Merge
188
189
  public slots:
      void onDataChanged();
c50beef02   고영탁   에러 처리 루틴 및 에러 처리 ...
190
      void oneSecTimerFired(void);
652e9cd54   고영탁   Merge
191
192
193
  };
  
  #endif // OVENSTATICS_H