From dedc5eee3fddb292d7e3dca26925bc0ad497d086 Mon Sep 17 00:00:00 2001 From: victor Date: Wed, 26 Apr 2017 10:49:40 +0900 Subject: [PATCH] =?UTF-8?q?=ED=94=84=EB=A1=9C=ED=86=A0=EC=BD=9C=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=20=EB=B0=98=EC=98=81=20=20-=20=EC=9A=94?= =?UTF-8?q?=EB=A6=AC=20=EB=AA=A8=EB=93=9C=20=EC=84=A4=EC=A0=95=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/app-prime-modbus/rs485_serial.c | 1 + app/app-prime-modbus/include/all_share.h | 3 ++- app/gui/oven_control/oven.cpp | 14 ++++++++++++++ app/gui/oven_control/oven.h | 4 +++- app/gui/oven_control/ovencontroller.cpp | 22 ++++++++++++++++++++++ app/gui/oven_control/ovencontroller.h | 1 + 6 files changed, 43 insertions(+), 2 deletions(-) diff --git a/app/app-prime-modbus/app/app-prime-modbus/rs485_serial.c b/app/app-prime-modbus/app/app-prime-modbus/rs485_serial.c index 59d8111..d178f3f 100644 --- a/app/app-prime-modbus/app/app-prime-modbus/rs485_serial.c +++ b/app/app-prime-modbus/app/app-prime-modbus/rs485_serial.c @@ -225,6 +225,7 @@ static void set_value( command_t *pcmd){ case TG_TIME : addr = 0x0b; break; case TG_CONV_RPM : addr = 0x0f; break; case TG_INNER_TEMP : addr = 0x11; break; + case TG_COOK_MODE : addr = 0x13; break; case TG_CLEAN_TYPE : addr = 0x14; break; case TG_BUNNER1_RPM : addr = 0x1a; break; case TG_BUNNER2_RPM : addr = 0x1b; break; diff --git a/app/app-prime-modbus/include/all_share.h b/app/app-prime-modbus/include/all_share.h index 1b86790..6577855 100644 --- a/app/app-prime-modbus/include/all_share.h +++ b/app/app-prime-modbus/include/all_share.h @@ -37,6 +37,7 @@ enum target_value_t { TG_TIME, TG_CONV_RPM, TG_INNER_TEMP, + TG_COOK_MODE, TG_CLEAN_TYPE, TG_BUNNER1_RPM, TG_BUNNER2_RPM, @@ -127,7 +128,7 @@ typedef struct { U16 cooldown; // 10 I16 inner_temp; // 11 U16 reserved12; // 12 - U16 reserved13; // 13 + U16 cook_mode; // 13 U16 clean_type; // 14 U16 clean_total; // 15 U16 clean_step; // 16 diff --git a/app/gui/oven_control/oven.cpp b/app/gui/oven_control/oven.cpp index 2daf051..2a1e69c 100644 --- a/app/gui/oven_control/oven.cpp +++ b/app/gui/oven_control/oven.cpp @@ -72,6 +72,20 @@ bool Oven::setMode_(Mode mode) if (mode != mode_) { mode_ = mode; + + switch (mode) + { + case HeatMode: + interface->setMode(Define::DryMode); + break; + case SteamMode: + interface->setMode(Define::SteamMode); + break; + case CombinationMode: + interface->setMode(Define::CombiMode); + break; + } + return true; } diff --git a/app/gui/oven_control/oven.h b/app/gui/oven_control/oven.h index 8224a6d..7e57093 100644 --- a/app/gui/oven_control/oven.h +++ b/app/gui/oven_control/oven.h @@ -5,6 +5,8 @@ #include #include +#include "define.h" + class OvenInterface : public QObject { Q_OBJECT @@ -22,7 +24,7 @@ signals: void doorClosed(); public slots: -// virtual void setMode(Oven::Mode mode) = 0; + virtual void setMode(Define::Mode mode) = 0; virtual void setHumidity(int percentage) = 0; virtual void setTemp(int celsius) = 0; virtual void setTime(int secs) = 0; diff --git a/app/gui/oven_control/ovencontroller.cpp b/app/gui/oven_control/ovencontroller.cpp index 5181fd0..b246c62 100644 --- a/app/gui/oven_control/ovencontroller.cpp +++ b/app/gui/oven_control/ovencontroller.cpp @@ -57,6 +57,28 @@ bool OvenController::door() return state.door_state != 0; } +void OvenController::setMode(Define::Mode mode) +{ + int m; + switch (mode) + { + case Define::SteamMode: + m = 2; + break; + case Define::DryMode: + m = 0; + break; + case Define::CombiMode: + m = 1; + break; + default: + return; + } + + qDebug() << "Set Mode" << m; + udp->set(TG_COOK_MODE, m); +} + void OvenController::setHumidity(int percentage) { qDebug() << "Set Humidity" << percentage; diff --git a/app/gui/oven_control/ovencontroller.h b/app/gui/oven_control/ovencontroller.h index 7b5f1dc..1b8632b 100644 --- a/app/gui/oven_control/ovencontroller.h +++ b/app/gui/oven_control/ovencontroller.h @@ -24,6 +24,7 @@ public: bool door(); public slots: + void setMode(Define::Mode mode); void setHumidity(int percentage); void setTemp(int celsius); void setTime(int secs); -- 2.1.4