Commit cefd483e4066e4ba94dbaede9080b21ed5161e1b

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

에러 수정

- 시간 오표시 에러 수정(로컬 타임 적용)
- 팝업 표시 알고리즘 수정(Modal -> Modaless)
app/gui/oven_control/historylistwindow.cpp
@@ -97,10 +97,10 @@ void HistoryListWindow::reloadDataset(void){ @@ -97,10 +97,10 @@ void HistoryListWindow::reloadDataset(void){
97 item = err_items[m_nCurDpStartPos+i]; 97 item = err_items[m_nCurDpStartPos+i];
98 m_ctrlErrBtns[i]->setText(strTemp); 98 m_ctrlErrBtns[i]->setText(strTemp);
99 m_ctrlCountLabels[i] ->setText(strTemp.sprintf("%d",item->fired_cnt)); 99 m_ctrlCountLabels[i] ->setText(strTemp.sprintf("%d",item->fired_cnt));
100 - timeptr = gmtime(&(item->first_fired)); 100 + timeptr = localtime(&(item->first_fired));
101 strftime(strTime,64,"%y-%m-%d %H:%M:%S",timeptr); 101 strftime(strTime,64,"%y-%m-%d %H:%M:%S",timeptr);
102 m_ctrlFirstTimeLabels[i]->setText(strTime); 102 m_ctrlFirstTimeLabels[i]->setText(strTime);
103 - timeptr = gmtime(&(item->last_fried)); 103 + timeptr = localtime(&(item->last_fried));
104 strftime(strTime,64,"%y-%m-%d %H:%M:%S",timeptr); 104 strftime(strTime,64,"%y-%m-%d %H:%M:%S",timeptr);
105 m_ctrlLastTimeLabels[i]->setText(strTime); 105 m_ctrlLastTimeLabels[i]->setText(strTime);
106 } 106 }
app/gui/oven_control/ovenstatics.cpp
@@ -41,6 +41,9 @@ OvenStatistics::OvenStatistics(QObject* parent) :QObject(parent) @@ -41,6 +41,9 @@ OvenStatistics::OvenStatistics(QObject* parent) :QObject(parent)
41 curSensorErrorState = 0; 41 curSensorErrorState = 0;
42 bDataRefreshed = false; 42 bDataRefreshed = false;
43 realdata.d32 = 0; 43 realdata.d32 = 0;
  44 + m_bPopupShow = false;
  45 + m_nLastPopupidx = MAX_ERROR_TYPE_CNT;
  46 +
44 47
45 for(i=0;i<MAX_LOG_SENSOR;i++){ 48 for(i=0;i<MAX_LOG_SENSOR;i++){
46 curSensorValue[i].utemp = 0; 49 curSensorValue[i].utemp = 0;
@@ -242,7 +245,7 @@ void OvenStatistics::processSystemError(uint16_t errflag,time_t ltime){ @@ -242,7 +245,7 @@ void OvenStatistics::processSystemError(uint16_t errflag,time_t ltime){
242 if(errflag & MAKE_MASK(SYS_ERR_FIRE_TRIGGER3)){ 245 if(errflag & MAKE_MASK(SYS_ERR_FIRE_TRIGGER3)){
243 item = &(srvdata->err_log.items.steam_fire_fail); 246 item = &(srvdata->err_log.items.steam_fire_fail);
244 strMsg = tr("스팀 버너 착하가 되지 않습니다."); 247 strMsg = tr("스팀 버너 착하가 되지 않습니다.");
245 - strMsg = tr("스팀 버너 착하 이상 발생"); 248 + strTitle = tr("스팀 버너 착하 이상 발생");
246 processErrorItems(item, sys_err_type_def[state][SYS_ERR_FIRE_TRIGGER3],strMsg,strTitle,ltime); 249 processErrorItems(item, sys_err_type_def[state][SYS_ERR_FIRE_TRIGGER3],strMsg,strTitle,ltime);
247 } 250 }
248 if(errflag & MAKE_MASK(SYS_ERR_OVNE_TEMP_ALARM)){ 251 if(errflag & MAKE_MASK(SYS_ERR_OVNE_TEMP_ALARM)){
@@ -491,8 +494,8 @@ void OvenStatistics::oneSecTimerFired(void){ @@ -491,8 +494,8 @@ void OvenStatistics::oneSecTimerFired(void){
491 } 494 }
492 495
493 void OvenStatistics::processErrorItems(error_item *item, error_exe_type errtype, const QString &MsgDesc, const QString &MsgTitle, time_t ltime){ 496 void OvenStatistics::processErrorItems(error_item *item, error_exe_type errtype, const QString &MsgDesc, const QString &MsgTitle, time_t ltime){
494 -  
495 - qDebug() << (int) (item - &(srvdata->err_log.values[0])) << "ERROR Fired!"; 497 + uint32_t erridx = (uint32_t) (item - &(srvdata->err_log.values[0]));
  498 + qDebug() << (uint32_t) (item - &(srvdata->err_log.values[0])) << "ERROR Fired!";
496 if(m_pLastErrItem == item ){ 499 if(m_pLastErrItem == item ){
497 srvdata->err_log.items.repeat_error.fired_cnt =item->fired_cnt; 500 srvdata->err_log.items.repeat_error.fired_cnt =item->fired_cnt;
498 srvdata->err_log.items.repeat_error.first_fired = item->first_fired; 501 srvdata->err_log.items.repeat_error.first_fired = item->first_fired;
@@ -505,13 +508,41 @@ void OvenStatistics::processErrorItems(error_item *item, error_exe_type errtype, @@ -505,13 +508,41 @@ void OvenStatistics::processErrorItems(error_item *item, error_exe_type errtype,
505 if(item->first_fired == 0) item->first_fired = ltime; 508 if(item->first_fired == 0) item->first_fired = ltime;
506 item->last_fried = ltime; 509 item->last_fried = ltime;
507 } 510 }
  511 +
  512 + if(errtype > error_type_clrsplit){
  513 + //에러 클리어 명령 송신
  514 + if(errtype == error_type_engclr){
  515 + //확인 후 송신
  516 + bNeedErrorClear = true;
  517 + }
  518 + else{
  519 + //에러클리어 메시지 즉시 송신
  520 + //udp->set(TG_ERROR_CLEAR,0xCECE);
  521 + bNeedErrorClear=true;
  522 + }
  523 + }
  524 +
508 switch(errtype){ 525 switch(errtype){
509 case error_type_onlypop: 526 case error_type_onlypop:
510 case error_type_popclr: 527 case error_type_popclr:
511 case error_type_popnonclr: 528 case error_type_popnonclr:
512 { 529 {
513 - ErrorPopupDlg *dlg = new ErrorPopupDlg(QApplication::activeWindow(),MsgDesc,MsgTitle);  
514 - dlg->exec(); 530 + if(m_bPopupShow==false){
  531 + m_bPopupShow = true;
  532 + ErrorPopupDlg *dlg = new ErrorPopupDlg(QApplication::activeWindow(),MsgDesc,MsgTitle);
  533 + connect(dlg,SIGNAL(destroyed(QObject*)),this, SLOT(onErrorPopupClosed()));
  534 + dlg->showFullScreen();
  535 + m_nLastPopupidx = erridx;
  536 + }
  537 + else{
  538 + if(erridx != m_nLastPopupidx && m_mapPopupList.contains(erridx) ==false){
  539 + popup_list_item popitem;
  540 + popitem.bNeedClear = bNeedErrorClear;
  541 + popitem.strDesc = MsgDesc;
  542 + popitem.strTitle = MsgTitle;
  543 + m_mapPopupList.insert(erridx,popitem);
  544 + }
  545 + }
515 break; 546 break;
516 } 547 }
517 case error_type_engclr: 548 case error_type_engclr:
@@ -525,18 +556,7 @@ void OvenStatistics::processErrorItems(error_item *item, error_exe_type errtype, @@ -525,18 +556,7 @@ void OvenStatistics::processErrorItems(error_item *item, error_exe_type errtype,
525 default: 556 default:
526 break; 557 break;
527 } 558 }
528 - if(errtype > error_type_clrsplit){  
529 - //에러 클리어 명령 송신  
530 - qDebug() << "send error clear command";  
531 - if(errtype == error_type_engclr){  
532 - //확인 후 송신  
533 - bNeedErrorClear = true;  
534 - }  
535 - else{  
536 - //에러클리어 메시지 즉시 송신  
537 - udp->set(TG_ERROR_CLEAR,0xCECE);  
538 - }  
539 - } 559 +
540 560
541 } 561 }
542 562
@@ -552,3 +572,26 @@ uint8_t OvenStatistics::getSensorTypeByIdx(uint16_t idx){ @@ -552,3 +572,26 @@ uint8_t OvenStatistics::getSensorTypeByIdx(uint16_t idx){
552 type_temp OvenStatistics::getCurSensorValueByIdx(uint16_t idx){ 572 type_temp OvenStatistics::getCurSensorValueByIdx(uint16_t idx){
553 return curSensorValue[idx]; 573 return curSensorValue[idx];
554 } 574 }
  575 +
  576 +void OvenStatistics::onErrorPopupClosed(void){
  577 + qDebug() << "Error Popup Closed!";
  578 + if(bNeedErrorClear) {
  579 + qDebug() << "send error clear command";
  580 + bNeedErrorClear = false;
  581 + udp->set(TG_ERROR_CLEAR,0xCECE);
  582 + }
  583 + if(m_mapPopupList.isEmpty()==false){
  584 + popup_list_item item;
  585 + item = m_mapPopupList.first();
  586 + m_nLastPopupidx = m_mapPopupList.firstKey();
  587 + bNeedErrorClear = item.bNeedClear;
  588 + ErrorPopupDlg *dlg = new ErrorPopupDlg(QApplication::activeWindow(),item.strDesc,item.strTitle);
  589 + m_mapPopupList.remove(m_nLastPopupidx);
  590 + connect(dlg,SIGNAL(destroyed(QObject*)),this, SLOT(onErrorPopupClosed()));
  591 + dlg->showFullScreen();
  592 + }
  593 + else{
  594 + m_bPopupShow = false;
  595 + m_nLastPopupidx = MAX_ERROR_TYPE_CNT;
  596 + }
  597 +}
app/gui/oven_control/ovenstatics.h
@@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
3 3
4 #include <QObject> 4 #include <QObject>
5 #include <time.h> 5 #include <time.h>
  6 +#include <qmap.h>
6 #include "../../app-prime-modbus/include/all_share.h" 7 #include "../../app-prime-modbus/include/all_share.h"
7 #include "udphandler.h" 8 #include "udphandler.h"
8 #include "oven.h" 9 #include "oven.h"
@@ -160,6 +161,12 @@ typedef union @@ -160,6 +161,12 @@ typedef union
160 }b; 161 }b;
161 }realtime_data; 162 }realtime_data;
162 163
  164 +typedef struct _popup_list_item{
  165 + QString strTitle;
  166 + QString strDesc;
  167 + bool bNeedClear;
  168 +}popup_list_item;
  169 +
163 class OvenStatistics : public QObject 170 class OvenStatistics : public QObject
164 { 171 {
165 Q_OBJECT 172 Q_OBJECT
@@ -219,6 +226,10 @@ private: @@ -219,6 +226,10 @@ private:
219 oven_control_t control; 226 oven_control_t control;
220 oven_state_t state; 227 oven_state_t state;
221 error_item* m_pLastErrItem; 228 error_item* m_pLastErrItem;
  229 + QMap<uint32_t, popup_list_item> m_mapPopupList;
  230 + uint32_t m_nLastPopupidx;
  231 + bool m_bPopupShow;
  232 +
222 233
223 234
224 235
@@ -229,6 +240,7 @@ private: @@ -229,6 +240,7 @@ private:
229 bool bNeedErrorClear; 240 bool bNeedErrorClear;
230 bool bDataRefreshed; 241 bool bDataRefreshed;
231 realtime_data realdata; 242 realtime_data realdata;
  243 +
232 explicit OvenStatistics(QObject* parent); 244 explicit OvenStatistics(QObject* parent);
233 ~OvenStatistics(); 245 ~OvenStatistics();
234 void processSystemError(uint16_t errflag,time_t ltime); 246 void processSystemError(uint16_t errflag,time_t ltime);
@@ -240,6 +252,7 @@ private: @@ -240,6 +252,7 @@ private:
240 public slots: 252 public slots:
241 void onDataChanged(); 253 void onDataChanged();
242 void oneSecTimerFired(void); 254 void oneSecTimerFired(void);
  255 + void onErrorPopupClosed(void);
243 }; 256 };
244 257
245 #endif // OVENSTATICS_H 258 #endif // OVENSTATICS_H
app/gui/oven_control/realtimesensorwindow.cpp
@@ -106,7 +106,7 @@ void RealtimeSensorWindow::reloadUi(void){ @@ -106,7 +106,7 @@ void RealtimeSensorWindow::reloadUi(void){
106 106
107 for(i=0;i<REALSENSOR_CONTROL_LIST_ITEM_MAX;i++){ 107 for(i=0;i<REALSENSOR_CONTROL_LIST_ITEM_MAX;i++){
108 if(m_arrSensorItems[i]->last_high_time !=0){ 108 if(m_arrSensorItems[i]->last_high_time !=0){
109 - timeptr = gmtime(&(m_arrSensorItems[i]->last_high_time)); 109 + timeptr = localtime(&(m_arrSensorItems[i]->last_high_time));
110 strftime(strTime,64,"%y-%m-%d\n%H:%M:%S",timeptr); 110 strftime(strTime,64,"%y-%m-%d\n%H:%M:%S",timeptr);
111 m_arrLbState[3][i]->setText(strTime); 111 m_arrLbState[3][i]->setText(strTime);
112 } 112 }