From 0964351ba6d614eca853b258ecdeb626285dcdd4 Mon Sep 17 00:00:00 2001 From: byloveletter Date: Fri, 4 Mar 2022 09:24:58 +0900 Subject: [PATCH] =?UTF-8?q?=EC=8A=A4=ED=8C=80=20=EA=B3=BC=EC=97=B4=20?= =?UTF-8?q?=EC=97=90=EB=9F=AC=20=EB=B0=9C=EC=83=9D=20=EC=8B=9C=20SSV=20?= =?UTF-8?q?=EB=B0=B8=EB=B8=8C=20=EC=9E=90=EB=8F=99=20=EC=97=B4=EA=B8=B0=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/gui/oven_control/define.h | 2 +- app/gui/oven_control/ovenstatics.cpp | 21 ++++++++++++++++++++- app/gui/oven_control/ovenstatics.h | 3 +++ app/gui/oven_control/udphandler.cpp | 31 +++++++++++++++++++++++++++++++ app/gui/oven_control/udphandler.h | 2 ++ 5 files changed, 57 insertions(+), 2 deletions(-) diff --git a/app/gui/oven_control/define.h b/app/gui/oven_control/define.h index 397b1f8..87459fc 100644 --- a/app/gui/oven_control/define.h +++ b/app/gui/oven_control/define.h @@ -5,7 +5,7 @@ #define MAJOR_VER 2 #define MINOR_VER 0 -#define HOTFIX_VER 9 +#define HOTFIX_VER 10 // 0 for normal // 1 for premium diff --git a/app/gui/oven_control/ovenstatics.cpp b/app/gui/oven_control/ovenstatics.cpp index 8b9aed3..32bbf99 100644 --- a/app/gui/oven_control/ovenstatics.cpp +++ b/app/gui/oven_control/ovenstatics.cpp @@ -51,6 +51,7 @@ OvenStatistics::OvenStatistics(QObject* parent) :QObject(parent) m_nLastPopupidx = MAX_ERROR_TYPE_CNT; m_wndSrvpassdlg = NULL; state.firmware_version = 150; + m_bPrevteamTempErr = false; for(i=0;isetInterval(30000); + m_tmrSvoff->setSingleShot(true); + connect(m_tmrSvoff, SIGNAL(timeout()), this, SLOT(onSvOffTimeoutFired())); } OvenStatistics::~OvenStatistics(){ @@ -73,6 +77,7 @@ void OvenStatistics::onDataChanged() time_t ltime=0; uint16_t errstatetemp; uint8_t cookingstate=0; + bool curSteamTempErr = false; udp->fillControl(control); udp->fillData(state); bDataRefreshed = true; @@ -86,6 +91,15 @@ void OvenStatistics::onDataChanged() qDebug() << " Upper RPM : " << m_nUpperRpm << ", Lower Rpm : " << m_nLowerRpm << ", Steam Rpm : " << m_nSteamRpm; } + curSteamTempErr = (state.system_error & MAKE_MASK(SYS_ERR_STAM_TEMP_ALARM)) != 0; + if(curSteamTempErr != m_bPrevteamTempErr){ + m_bPrevteamTempErr = curSteamTempErr; + if(m_bPrevteamTempErr){ + udp->set_steam_high_sv_onoff(true); + if(!m_tmrSvoff->isActive()) m_tmrSvoff->start(); + } + } + if((control.cooking || oven->cooking() || oven->preheating() || oven->cooldown())) cookingstate = 1; else if(state.cleaning_sate != 0 ) cookingstate = 2; @@ -771,3 +785,8 @@ void OvenStatistics::onCommTimeoutFired() dlg->showFullScreen(); } } + +void OvenStatistics::onSvOffTimeoutFired() +{ + udp->set_steam_high_sv_onoff(false); +} diff --git a/app/gui/oven_control/ovenstatics.h b/app/gui/oven_control/ovenstatics.h index c32f5b2..96ca7ef 100644 --- a/app/gui/oven_control/ovenstatics.h +++ b/app/gui/oven_control/ovenstatics.h @@ -499,6 +499,8 @@ private: uint32_t m_nUpperRpm; uint32_t m_nLowerRpm; uint32_t m_nSteamRpm; + bool m_bPrevteamTempErr; + QTimer *m_tmrSvoff; explicit OvenStatistics(QObject* parent); ~OvenStatistics(); @@ -525,6 +527,7 @@ public slots: void onErrorPopupClosed(int erridx); void setWndPassInputNull(void){m_wndSrvpassdlg = NULL;} void onCommTimeoutFired(); + void onSvOffTimeoutFired(); signals: void onErrorFired(int erridx); diff --git a/app/gui/oven_control/udphandler.cpp b/app/gui/oven_control/udphandler.cpp index f6b7ff3..7680366 100644 --- a/app/gui/oven_control/udphandler.cpp +++ b/app/gui/oven_control/udphandler.cpp @@ -21,6 +21,7 @@ UdpHandler::UdpHandler(QObject *parent) : QObject(parent) bzero(&control, sizeof(control)); bzero(&state, sizeof(state)); + m_steamhighctr_enabled = false; emitted = false; emitTimeoutTimer.setSingleShot(true); emitTimeoutTimer.setInterval(COMM_TIMEOUT_SEC * 1000); @@ -40,6 +41,24 @@ bool UdpHandler::init() return true; } +void UdpHandler::set_steam_high_sv_onoff(bool onoff) +{ + if(onoff){ + if(!m_steamhighctr_enabled){ + sendCommand(CMD_ONOFF, TG_MANUAL_RELAY, SWITCH_ON); + sendCommand(CMD_ONOFF, TG_SSV, SWITCH_ON); + m_steamhighctr_enabled = true; + } + } + else{ + if(m_steamhighctr_enabled){ + sendCommand(CMD_ONOFF, TG_SSV, SWITCH_OFF); + sendCommand(CMD_ONOFF, TG_MANUAL_RELAY, SWITCH_OFF); + m_steamhighctr_enabled = false; + } + } +} + void UdpHandler::readPendingDatagrams() { while (sock->hasPendingDatagrams()) { @@ -103,16 +122,28 @@ void UdpHandler::processState(oven_state_t *state) void UdpHandler::turnOn(int target) { + if(m_steamhighctr_enabled){ + sendCommand(CMD_ONOFF, TG_MANUAL_RELAY, SWITCH_OFF); + m_steamhighctr_enabled = false; + } sendCommand(CMD_ONOFF, target, SWITCH_ON); } void UdpHandler::turnOff(int target) { + if(m_steamhighctr_enabled){ + sendCommand(CMD_ONOFF, TG_MANUAL_RELAY, SWITCH_OFF); + m_steamhighctr_enabled = false; + } sendCommand(CMD_ONOFF, target, SWITCH_OFF); } void UdpHandler::set(int target, int value) { + if(m_steamhighctr_enabled){ + sendCommand(CMD_ONOFF, TG_MANUAL_RELAY, SWITCH_OFF); + m_steamhighctr_enabled = false; + } sendCommand(CMD_VALUE, target, value); } diff --git a/app/gui/oven_control/udphandler.h b/app/gui/oven_control/udphandler.h index 23494ea..5f7505f 100644 --- a/app/gui/oven_control/udphandler.h +++ b/app/gui/oven_control/udphandler.h @@ -30,6 +30,7 @@ public: } bool init(); + void set_steam_high_sv_onoff(bool onoff); const oven_control_t &getControl() { return control; } const oven_state_t &getData() { return state; } @@ -101,6 +102,7 @@ private: QUdpSocket *sock; QTimer emitTimeoutTimer; bool emitted; + bool m_steamhighctr_enabled; private slots: void readPendingDatagrams(); -- 2.1.4