Commit 27e821e2e86e139751698415386399cb77738a53
1 parent
ae83765cfd
Exists in
master
version 1.6.8 Release
Showing
5 changed files
with
60 additions
and
5 deletions
Show diff stats
app/gui/oven_control/define.h
app/gui/oven_control/ovenstatics.cpp
... | ... | @@ -51,6 +51,7 @@ OvenStatistics::OvenStatistics(QObject* parent) :QObject(parent) |
51 | 51 | m_nLastPopupidx = MAX_ERROR_TYPE_CNT; |
52 | 52 | m_wndSrvpassdlg = NULL; |
53 | 53 | state.firmware_version = 150; |
54 | + m_bPrevteamTempErr = false; | |
54 | 55 | |
55 | 56 | for(i=0;i<MAX_LOG_SENSOR;i++){ |
56 | 57 | curSensorValue[i].utemp = 0; |
... | ... | @@ -59,7 +60,10 @@ OvenStatistics::OvenStatistics(QObject* parent) :QObject(parent) |
59 | 60 | curSensorValue[12].itemp = 100; |
60 | 61 | |
61 | 62 | srvdata = new ServiceData(); |
62 | - | |
63 | + m_tmrSvoff = new QTimer(this); | |
64 | + m_tmrSvoff->setInterval(30000); | |
65 | + m_tmrSvoff->setSingleShot(true); | |
66 | + connect(m_tmrSvoff, SIGNAL(timeout()), this, SLOT(onSvOffTimeoutFired())); | |
63 | 67 | } |
64 | 68 | |
65 | 69 | OvenStatistics::~OvenStatistics(){ |
... | ... | @@ -73,6 +77,7 @@ void OvenStatistics::onDataChanged() |
73 | 77 | time_t ltime=0; |
74 | 78 | uint16_t errstatetemp; |
75 | 79 | uint8_t cookingstate=0; |
80 | + bool curSteamTempErr = false; | |
76 | 81 | udp->fillControl(control); |
77 | 82 | udp->fillData(state); |
78 | 83 | bDataRefreshed = true; |
... | ... | @@ -86,6 +91,15 @@ void OvenStatistics::onDataChanged() |
86 | 91 | qDebug() << " Upper RPM : " << m_nUpperRpm << ", Lower Rpm : " << m_nLowerRpm << ", Steam Rpm : " << m_nSteamRpm; |
87 | 92 | } |
88 | 93 | |
94 | + curSteamTempErr = (state.system_error & MAKE_MASK(SYS_ERR_STAM_TEMP_ALARM)) != 0; | |
95 | + if(curSteamTempErr != m_bPrevteamTempErr){ | |
96 | + m_bPrevteamTempErr = curSteamTempErr; | |
97 | + if(m_bPrevteamTempErr){ | |
98 | + udp->set_steam_high_sv_onoff(true); | |
99 | + if(!m_tmrSvoff->isActive()) m_tmrSvoff->start(); | |
100 | + } | |
101 | + } | |
102 | + | |
89 | 103 | if((control.cooking || oven->cooking() || oven->preheating() || oven->cooldown())) cookingstate = 1; |
90 | 104 | else if(state.cleaning_sate != 0 ) cookingstate = 2; |
91 | 105 | |
... | ... | @@ -136,7 +150,7 @@ void OvenStatistics::processSensorError(uint16_t errflag, time_t ltime){ |
136 | 150 | if( control.system==0 && !bCookingState ) state = SYS_OFF_COOK_OFF; |
137 | 151 | else if(control.system !=0 && this->state.cleaning_sate !=0 ) state = SYS_ON_WASH; |
138 | 152 | else if(control.system != 0 && !bCookingState) state = SYS_ON_COOK_OFF; |
139 | - else if(control.system !=0 && bCookingState) state = SYS_ON_COOK_ON; | |
153 | + else if(control.system !=0 && bCookingState) state = SYS_ON_COOK_ON; | |
140 | 154 | else state = SYS_ON_COOK_OFF; |
141 | 155 | |
142 | 156 | if(errflag & MAKE_MASK(SENSOR_ERR_SENSOR_1)){ |
... | ... | @@ -213,7 +227,7 @@ void OvenStatistics::processCommError(uint16_t errflag, time_t ltime){ |
213 | 227 | if( control.system==0 && !bCookingState ) state = SYS_OFF_COOK_OFF; |
214 | 228 | else if(control.system !=0 && this->state.cleaning_sate !=0 ) state = SYS_ON_WASH; |
215 | 229 | else if(control.system != 0 && !bCookingState) state = SYS_ON_COOK_OFF; |
216 | - else if(control.system !=0 && bCookingState) state = SYS_ON_COOK_ON; | |
230 | + else if(control.system !=0 && bCookingState) state = SYS_ON_COOK_ON; | |
217 | 231 | else state = SYS_ON_COOK_OFF; |
218 | 232 | |
219 | 233 | if(errflag & MAKE_MASK(COMM_ERR_BUNNER1)){ |
... | ... | @@ -299,7 +313,7 @@ void OvenStatistics::processSystemError(uint16_t errflag,time_t ltime){ |
299 | 313 | if( control.system==0 && !bCookingState ) state = SYS_OFF_COOK_OFF; |
300 | 314 | else if(control.system !=0 && this->state.cleaning_sate !=0 ) state = SYS_ON_WASH; |
301 | 315 | else if(control.system != 0 && !bCookingState) state = SYS_ON_COOK_OFF; |
302 | - else if(control.system !=0 && bCookingState) state = SYS_ON_COOK_ON; | |
316 | + else if(control.system !=0 && bCookingState) state = SYS_ON_COOK_ON; | |
303 | 317 | else state = SYS_ON_COOK_OFF; |
304 | 318 | |
305 | 319 | if( errflag & MAKE_MASK(SYS_ERR_FIRE_TRIGGER1)){ |
... | ... | @@ -771,3 +785,8 @@ void OvenStatistics::onCommTimeoutFired() |
771 | 785 | dlg->showFullScreen(); |
772 | 786 | } |
773 | 787 | } |
788 | + | |
789 | +void OvenStatistics::onSvOffTimeoutFired() | |
790 | +{ | |
791 | + udp->set_steam_high_sv_onoff(false); | |
792 | +} | ... | ... |
app/gui/oven_control/ovenstatics.h
... | ... | @@ -499,6 +499,8 @@ private: |
499 | 499 | uint32_t m_nUpperRpm; |
500 | 500 | uint32_t m_nLowerRpm; |
501 | 501 | uint32_t m_nSteamRpm; |
502 | + bool m_bPrevteamTempErr; | |
503 | + QTimer *m_tmrSvoff; | |
502 | 504 | |
503 | 505 | explicit OvenStatistics(QObject* parent); |
504 | 506 | ~OvenStatistics(); |
... | ... | @@ -525,6 +527,7 @@ public slots: |
525 | 527 | void onErrorPopupClosed(int erridx); |
526 | 528 | void setWndPassInputNull(void){m_wndSrvpassdlg = NULL;} |
527 | 529 | void onCommTimeoutFired(); |
530 | + void onSvOffTimeoutFired(); | |
528 | 531 | |
529 | 532 | signals: |
530 | 533 | void onErrorFired(int erridx); | ... | ... |
app/gui/oven_control/udphandler.cpp
... | ... | @@ -21,6 +21,7 @@ UdpHandler::UdpHandler(QObject *parent) : QObject(parent) |
21 | 21 | bzero(&control, sizeof(control)); |
22 | 22 | bzero(&state, sizeof(state)); |
23 | 23 | |
24 | + m_steamhighctr_enabled = false; | |
24 | 25 | emitted = false; |
25 | 26 | emitTimeoutTimer.setSingleShot(true); |
26 | 27 | emitTimeoutTimer.setInterval(COMM_TIMEOUT_SEC * 1000); |
... | ... | @@ -40,6 +41,24 @@ bool UdpHandler::init() |
40 | 41 | return true; |
41 | 42 | } |
42 | 43 | |
44 | +void UdpHandler::set_steam_high_sv_onoff(bool onoff) | |
45 | +{ | |
46 | + if(onoff){ | |
47 | + if(!m_steamhighctr_enabled){ | |
48 | + sendCommand(CMD_ONOFF, TG_MANUAL_RELAY, SWITCH_ON); | |
49 | + sendCommand(CMD_ONOFF, TG_SSV, SWITCH_ON); | |
50 | + m_steamhighctr_enabled = true; | |
51 | + } | |
52 | + } | |
53 | + else{ | |
54 | + if(m_steamhighctr_enabled){ | |
55 | + sendCommand(CMD_ONOFF, TG_SSV, SWITCH_OFF); | |
56 | + sendCommand(CMD_ONOFF, TG_MANUAL_RELAY, SWITCH_OFF); | |
57 | + m_steamhighctr_enabled = false; | |
58 | + } | |
59 | + } | |
60 | +} | |
61 | + | |
43 | 62 | void UdpHandler::readPendingDatagrams() |
44 | 63 | { |
45 | 64 | while (sock->hasPendingDatagrams()) { |
... | ... | @@ -103,16 +122,28 @@ void UdpHandler::processState(oven_state_t *state) |
103 | 122 | |
104 | 123 | void UdpHandler::turnOn(int target) |
105 | 124 | { |
125 | + if(m_steamhighctr_enabled){ | |
126 | + sendCommand(CMD_ONOFF, TG_MANUAL_RELAY, SWITCH_OFF); | |
127 | + m_steamhighctr_enabled = false; | |
128 | + } | |
106 | 129 | sendCommand(CMD_ONOFF, target, SWITCH_ON); |
107 | 130 | } |
108 | 131 | |
109 | 132 | void UdpHandler::turnOff(int target) |
110 | 133 | { |
134 | + if(m_steamhighctr_enabled){ | |
135 | + sendCommand(CMD_ONOFF, TG_MANUAL_RELAY, SWITCH_OFF); | |
136 | + m_steamhighctr_enabled = false; | |
137 | + } | |
111 | 138 | sendCommand(CMD_ONOFF, target, SWITCH_OFF); |
112 | 139 | } |
113 | 140 | |
114 | 141 | void UdpHandler::set(int target, int value) |
115 | 142 | { |
143 | + if(m_steamhighctr_enabled){ | |
144 | + sendCommand(CMD_ONOFF, TG_MANUAL_RELAY, SWITCH_OFF); | |
145 | + m_steamhighctr_enabled = false; | |
146 | + } | |
116 | 147 | sendCommand(CMD_VALUE, target, value); |
117 | 148 | } |
118 | 149 | ... | ... |
app/gui/oven_control/udphandler.h
... | ... | @@ -30,6 +30,7 @@ public: |
30 | 30 | } |
31 | 31 | |
32 | 32 | bool init(); |
33 | + void set_steam_high_sv_onoff(bool onoff); | |
33 | 34 | |
34 | 35 | const oven_control_t &getControl() { return control; } |
35 | 36 | const oven_state_t &getData() { return state; } |
... | ... | @@ -101,6 +102,7 @@ private: |
101 | 102 | QUdpSocket *sock; |
102 | 103 | QTimer emitTimeoutTimer; |
103 | 104 | bool emitted; |
105 | + bool m_steamhighctr_enabled; | |
104 | 106 | |
105 | 107 | private slots: |
106 | 108 | void readPendingDatagrams(); | ... | ... |