diff --git a/app/gui/oven_control/ovenstatics.h b/app/gui/oven_control/ovenstatics.h index 709dc05..5156fe9 100644 --- a/app/gui/oven_control/ovenstatics.h +++ b/app/gui/oven_control/ovenstatics.h @@ -411,6 +411,14 @@ private: 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); + 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(); diff --git a/app/gui/oven_control/servicedata.cpp b/app/gui/oven_control/servicedata.cpp index 15c5192..491f288 100644 --- a/app/gui/oven_control/servicedata.cpp +++ b/app/gui/oven_control/servicedata.cpp @@ -89,7 +89,7 @@ bool ServiceData::loadServiceData(void){ return saveServiceData(); } - qDebug() << "FRAM Read, Write Size is " << sizeof(error_log)+sizeof(use_statics_log); + qDebug() << "FRAM Read, Write Size is " << sizeof(error_log)+sizeof(use_statics_log) + sizeof(sensor_log); memcpy((void*)err_log.data,pBuff,sizeof(error_log)); pBuff += sizeof(error_log); memcpy((void*)use_log.data, pBuff,sizeof(use_statics_log));pBuff += sizeof(use_statics_log); memcpy((void*)sensor_log.data,pBuff,sizeof(sensor_statics_log)); pBuff+= sizeof(sensor_statics_log); @@ -111,6 +111,41 @@ bool ServiceData::resetSensorlogData() return saveServiceData(); } +bool ServiceData::setWashState(bool bval, bool save) +{ + use_log.items.b_oven_state.b.wash_state = bval; + if(save) return saveServiceData(); + else return true; +} + +bool ServiceData::setTotalCookingTime(uint32_t val, bool save) +{ + use_log.items.total_cook_time = val; + if(save) return saveServiceData(); + else return true; +} + +bool ServiceData::setTotalCookingCount(uint32_t val, bool save) +{ + use_log.items.total_cook_count = val; + if(save) return saveServiceData(); + else return true; +} + +bool ServiceData::addTotalCookingCount(uint32_t val, bool save) +{ + use_log.items.total_cook_count +=val; + if(save) return saveServiceData(); + else return true; +} + +bool ServiceData::addTotalCookingTime(uint32_t val, bool save) +{ + use_log.items.total_cook_time += val; + if(save) return saveServiceData(); + else return true; +} + bool ServiceData::saveServiceData(void){ uint8_t buffs[FRAM_SIZE]; uint8_t* pBuff; diff --git a/app/gui/oven_control/servicedata.h b/app/gui/oven_control/servicedata.h index 75bd50c..009f2d9 100644 --- a/app/gui/oven_control/servicedata.h +++ b/app/gui/oven_control/servicedata.h @@ -8,10 +8,12 @@ #define MAX_ERROR_TYPE_CNT 31 -#define MAX_STATICS_CNT 23 +#define MAX_STATICS_CNT 26 #define MAX_LOG_SENSOR 16 +#define MAX_OVEN_STATE_ + typedef struct _error_item{ uint16_t fired_cnt; time_t first_fired; @@ -152,6 +154,14 @@ enum USE_ITEMS_IDX{ }; +typedef union _bool_oven_state{ + uint32_t dVal; + struct{ + uint32_t wash_state:1; + uint32_t reserved:31; + }b; +}bool_oven_state; + typedef union _use_statics_log{ @@ -181,6 +191,9 @@ typedef union _use_statics_log{ uint32_t hdm_open; uint32_t dp_open; uint32_t unp_open; + uint32_t total_cook_time; + uint32_t total_cook_count; + bool_oven_state b_oven_state; }items; }STRUCT_PACK use_statics_log; @@ -197,6 +210,14 @@ public: bool saveServiceData(void); bool loadServiceData(void); bool resetSensorlogData(void); + bool loadWashState(void){return (bool)use_log.items.b_oven_state.b.wash_state;}; + bool setWashState(bool bval,bool save=true); + uint32_t loadTotalCookingTime(void){return use_log.items.total_cook_time;}; + bool setTotalCookingTime(uint32_t val, bool save=true); + bool addTotalCookingTime(uint32_t val, bool save=true); + uint32_t loadTotalCookingCount(void){return use_log.items.total_cook_count;}; + bool setTotalCookingCount(uint32_t val,bool save = true); + bool addTotalCookingCount(uint32_t val, bool save = true); }; #endif // SERVICEDATA_H