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 97 item = err_items[m_nCurDpStartPos+i];
98 98 m_ctrlErrBtns[i]->setText(strTemp);
99 99 m_ctrlCountLabels[i] ->setText(strTemp.sprintf("%d",item->fired_cnt));
100   - timeptr = gmtime(&(item->first_fired));
  100 + timeptr = localtime(&(item->first_fired));
101 101 strftime(strTime,64,"%y-%m-%d %H:%M:%S",timeptr);
102 102 m_ctrlFirstTimeLabels[i]->setText(strTime);
103   - timeptr = gmtime(&(item->last_fried));
  103 + timeptr = localtime(&(item->last_fried));
104 104 strftime(strTime,64,"%y-%m-%d %H:%M:%S",timeptr);
105 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 41 curSensorErrorState = 0;
42 42 bDataRefreshed = false;
43 43 realdata.d32 = 0;
  44 + m_bPopupShow = false;
  45 + m_nLastPopupidx = MAX_ERROR_TYPE_CNT;
  46 +
44 47  
45 48 for(i=0;i<MAX_LOG_SENSOR;i++){
46 49 curSensorValue[i].utemp = 0;
... ... @@ -242,7 +245,7 @@ void OvenStatistics::processSystemError(uint16_t errflag,time_t ltime){
242 245 if(errflag & MAKE_MASK(SYS_ERR_FIRE_TRIGGER3)){
243 246 item = &(srvdata->err_log.items.steam_fire_fail);
244 247 strMsg = tr("스팀 버너 착하가 되지 않습니다.");
245   - strMsg = tr("스팀 버너 착하 이상 발생");
  248 + strTitle = tr("스팀 버너 착하 이상 발생");
246 249 processErrorItems(item, sys_err_type_def[state][SYS_ERR_FIRE_TRIGGER3],strMsg,strTitle,ltime);
247 250 }
248 251 if(errflag & MAKE_MASK(SYS_ERR_OVNE_TEMP_ALARM)){
... ... @@ -491,8 +494,8 @@ void OvenStatistics::oneSecTimerFired(void){
491 494 }
492 495  
493 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 499 if(m_pLastErrItem == item ){
497 500 srvdata->err_log.items.repeat_error.fired_cnt =item->fired_cnt;
498 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 508 if(item->first_fired == 0) item->first_fired = ltime;
506 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 525 switch(errtype){
509 526 case error_type_onlypop:
510 527 case error_type_popclr:
511 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 546 break;
516 547 }
517 548 case error_type_engclr:
... ... @@ -525,18 +556,7 @@ void OvenStatistics::processErrorItems(error_item *item, error_exe_type errtype,
525 556 default:
526 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 572 type_temp OvenStatistics::getCurSensorValueByIdx(uint16_t idx){
553 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 3  
4 4 #include <QObject>
5 5 #include <time.h>
  6 +#include <qmap.h>
6 7 #include "../../app-prime-modbus/include/all_share.h"
7 8 #include "udphandler.h"
8 9 #include "oven.h"
... ... @@ -160,6 +161,12 @@ typedef union
160 161 }b;
161 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 170 class OvenStatistics : public QObject
164 171 {
165 172 Q_OBJECT
... ... @@ -219,6 +226,10 @@ private:
219 226 oven_control_t control;
220 227 oven_state_t state;
221 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 240 bool bNeedErrorClear;
230 241 bool bDataRefreshed;
231 242 realtime_data realdata;
  243 +
232 244 explicit OvenStatistics(QObject* parent);
233 245 ~OvenStatistics();
234 246 void processSystemError(uint16_t errflag,time_t ltime);
... ... @@ -240,6 +252,7 @@ private:
240 252 public slots:
241 253 void onDataChanged();
242 254 void oneSecTimerFired(void);
  255 + void onErrorPopupClosed(void);
243 256 };
244 257  
245 258 #endif // OVENSTATICS_H
... ...
app/gui/oven_control/realtimesensorwindow.cpp
... ... @@ -106,7 +106,7 @@ void RealtimeSensorWindow::reloadUi(void){
106 106  
107 107 for(i=0;i<REALSENSOR_CONTROL_LIST_ITEM_MAX;i++){
108 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 110 strftime(strTime,64,"%y-%m-%d\n%H:%M:%S",timeptr);
111 111 m_arrLbState[3][i]->setText(strTime);
112 112 }
... ...