Commit a46dd440978a326a6f6630a585cfa9f58998da48

Authored by 고영탁
1 parent eeffffb47f
Exists in master and in 2 other branches fhd, fhd-demo

오븐 상태 저장 기능 추가

app/gui/oven_control/ovenstatics.h
@@ -411,6 +411,14 @@ private: @@ -411,6 +411,14 @@ private:
411 void processStateError(uint16_t errflat, time_t ltime); 411 void processStateError(uint16_t errflat, time_t ltime);
412 void processErrorItems(error_item *item, error_exe_type errtype, const QString &MsgDesc,const QString &MsgTitle, time_t ltime); 412 void processErrorItems(error_item *item, error_exe_type errtype, const QString &MsgDesc,const QString &MsgTitle, time_t ltime);
413 413
  414 + bool loadWashState(void){return srvdata->loadWashState();};
  415 + bool setWashState(bool bval,bool save=true){return srvdata->setWashState(bval,save);};
  416 + uint32_t loadTotalCookingTime(void){return srvdata->loadTotalCookingTime();};
  417 + bool setTotalCookingTime(uint32_t val, bool save=true){return srvdata->setTotalCookingTime(val,save);};
  418 + bool addTotalCookingTime(uint32_t val, bool save=true){return srvdata->addTotalCookingTime(val,save);};
  419 + uint32_t loadTotalCookingCount(void){return srvdata->loadTotalCookingCount();};
  420 + bool setTotalCookingCount(uint32_t val,bool save = true){return srvdata->setTotalCookingCount(val,save);};
  421 + bool addTotalCookingCount(uint32_t val, bool save = true){return srvdata->addTotalCookingCount(val,save);};
414 422
415 public slots: 423 public slots:
416 void onDataChanged(); 424 void onDataChanged();
app/gui/oven_control/servicedata.cpp
@@ -89,7 +89,7 @@ bool ServiceData::loadServiceData(void){ @@ -89,7 +89,7 @@ bool ServiceData::loadServiceData(void){
89 return saveServiceData(); 89 return saveServiceData();
90 } 90 }
91 91
92 - qDebug() << "FRAM Read, Write Size is " << sizeof(error_log)+sizeof(use_statics_log); 92 + qDebug() << "FRAM Read, Write Size is " << sizeof(error_log)+sizeof(use_statics_log) + sizeof(sensor_log);
93 memcpy((void*)err_log.data,pBuff,sizeof(error_log)); pBuff += sizeof(error_log); 93 memcpy((void*)err_log.data,pBuff,sizeof(error_log)); pBuff += sizeof(error_log);
94 memcpy((void*)use_log.data, pBuff,sizeof(use_statics_log));pBuff += sizeof(use_statics_log); 94 memcpy((void*)use_log.data, pBuff,sizeof(use_statics_log));pBuff += sizeof(use_statics_log);
95 memcpy((void*)sensor_log.data,pBuff,sizeof(sensor_statics_log)); pBuff+= sizeof(sensor_statics_log); 95 memcpy((void*)sensor_log.data,pBuff,sizeof(sensor_statics_log)); pBuff+= sizeof(sensor_statics_log);
@@ -111,6 +111,41 @@ bool ServiceData::resetSensorlogData() @@ -111,6 +111,41 @@ bool ServiceData::resetSensorlogData()
111 return saveServiceData(); 111 return saveServiceData();
112 } 112 }
113 113
  114 +bool ServiceData::setWashState(bool bval, bool save)
  115 +{
  116 + use_log.items.b_oven_state.b.wash_state = bval;
  117 + if(save) return saveServiceData();
  118 + else return true;
  119 +}
  120 +
  121 +bool ServiceData::setTotalCookingTime(uint32_t val, bool save)
  122 +{
  123 + use_log.items.total_cook_time = val;
  124 + if(save) return saveServiceData();
  125 + else return true;
  126 +}
  127 +
  128 +bool ServiceData::setTotalCookingCount(uint32_t val, bool save)
  129 +{
  130 + use_log.items.total_cook_count = val;
  131 + if(save) return saveServiceData();
  132 + else return true;
  133 +}
  134 +
  135 +bool ServiceData::addTotalCookingCount(uint32_t val, bool save)
  136 +{
  137 + use_log.items.total_cook_count +=val;
  138 + if(save) return saveServiceData();
  139 + else return true;
  140 +}
  141 +
  142 +bool ServiceData::addTotalCookingTime(uint32_t val, bool save)
  143 +{
  144 + use_log.items.total_cook_time += val;
  145 + if(save) return saveServiceData();
  146 + else return true;
  147 +}
  148 +
114 bool ServiceData::saveServiceData(void){ 149 bool ServiceData::saveServiceData(void){
115 uint8_t buffs[FRAM_SIZE]; 150 uint8_t buffs[FRAM_SIZE];
116 uint8_t* pBuff; 151 uint8_t* pBuff;
app/gui/oven_control/servicedata.h
@@ -8,10 +8,12 @@ @@ -8,10 +8,12 @@
8 8
9 #define MAX_ERROR_TYPE_CNT 31 9 #define MAX_ERROR_TYPE_CNT 31
10 10
11 -#define MAX_STATICS_CNT 23 11 +#define MAX_STATICS_CNT 26
12 12
13 #define MAX_LOG_SENSOR 16 13 #define MAX_LOG_SENSOR 16
14 14
  15 +#define MAX_OVEN_STATE_
  16 +
15 typedef struct _error_item{ 17 typedef struct _error_item{
16 uint16_t fired_cnt; 18 uint16_t fired_cnt;
17 time_t first_fired; 19 time_t first_fired;
@@ -152,6 +154,14 @@ enum USE_ITEMS_IDX{ @@ -152,6 +154,14 @@ enum USE_ITEMS_IDX{
152 }; 154 };
153 155
154 156
  157 +typedef union _bool_oven_state{
  158 + uint32_t dVal;
  159 + struct{
  160 + uint32_t wash_state:1;
  161 + uint32_t reserved:31;
  162 + }b;
  163 +}bool_oven_state;
  164 +
155 165
156 166
157 typedef union _use_statics_log{ 167 typedef union _use_statics_log{
@@ -181,6 +191,9 @@ typedef union _use_statics_log{ @@ -181,6 +191,9 @@ typedef union _use_statics_log{
181 uint32_t hdm_open; 191 uint32_t hdm_open;
182 uint32_t dp_open; 192 uint32_t dp_open;
183 uint32_t unp_open; 193 uint32_t unp_open;
  194 + uint32_t total_cook_time;
  195 + uint32_t total_cook_count;
  196 + bool_oven_state b_oven_state;
184 }items; 197 }items;
185 }STRUCT_PACK use_statics_log; 198 }STRUCT_PACK use_statics_log;
186 199
@@ -197,6 +210,14 @@ public: @@ -197,6 +210,14 @@ public:
197 bool saveServiceData(void); 210 bool saveServiceData(void);
198 bool loadServiceData(void); 211 bool loadServiceData(void);
199 bool resetSensorlogData(void); 212 bool resetSensorlogData(void);
  213 + bool loadWashState(void){return (bool)use_log.items.b_oven_state.b.wash_state;};
  214 + bool setWashState(bool bval,bool save=true);
  215 + uint32_t loadTotalCookingTime(void){return use_log.items.total_cook_time;};
  216 + bool setTotalCookingTime(uint32_t val, bool save=true);
  217 + bool addTotalCookingTime(uint32_t val, bool save=true);
  218 + uint32_t loadTotalCookingCount(void){return use_log.items.total_cook_count;};
  219 + bool setTotalCookingCount(uint32_t val,bool save = true);
  220 + bool addTotalCookingCount(uint32_t val, bool save = true);
200 }; 221 };
201 222
202 #endif // SERVICEDATA_H 223 #endif // SERVICEDATA_H