From 6e338d03f2e8536ab763af945b6ed75cd4c817c8 Mon Sep 17 00:00:00 2001 From: victor Date: Tue, 11 Jul 2017 16:47:09 +0900 Subject: [PATCH] =?UTF-8?q?=EC=97=B0=EC=86=8C=EA=B0=80=EC=8A=A4=EB=8F=99?= =?UTF-8?q?=EC=9E=91=20=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/functiontestwindow.cpp | 23 +- app/gui/oven_control/functiontestwindow.h | 6 + app/gui/oven_control/functiontestwindow.ui | 190 ++++++++++++-- app/gui/oven_control/gastestwindow.cpp | 285 ++++++++++++++++++++- app/gui/oven_control/gastestwindow.h | 37 ++- app/gui/oven_control/gastestwindow.ui | 382 +++++++++++++++++++++++++++- app/gui/oven_control/udphandler.h | 2 + 7 files changed, 889 insertions(+), 36 deletions(-) diff --git a/app/gui/oven_control/functiontestwindow.cpp b/app/gui/oven_control/functiontestwindow.cpp index 600df62..8302d3a 100644 --- a/app/gui/oven_control/functiontestwindow.cpp +++ b/app/gui/oven_control/functiontestwindow.cpp @@ -25,6 +25,8 @@ FunctionTestWindow::FunctionTestWindow(QWidget *parent) : ui->clockContainer->setParent(ui->upperStack); setAttribute(Qt::WA_DeleteOnClose); + ui->gasTestContainer->hide(); + foreach (QPushButton *button, findChildren()) connect(button, &QPushButton::pressed, SoundPlayer::playClick); @@ -103,8 +105,25 @@ void FunctionTestWindow::on_fanTestButton_clicked() void FunctionTestWindow::on_gasTestButton_clicked() { -// GasTestWindow *w = new GasTestWindow(this, udp); - // w->showFullScreen(); + ui->gasTestContainer->show(); +} + +void FunctionTestWindow::on_upperGasTestButton_clicked() +{ + GasTestWindow *w = new GasTestWindow(GasTestWindow::Upper, this); + w->showFullScreen(); +} + +void FunctionTestWindow::on_lowerGasTestButton_clicked() +{ + GasTestWindow *w = new GasTestWindow(GasTestWindow::Lower, this); + w->showFullScreen(); +} + +void FunctionTestWindow::on_steamGasTestButton_clicked() +{ + GasTestWindow *w = new GasTestWindow(GasTestWindow::Steam, this); + w->showFullScreen(); } void FunctionTestWindow::onEncoderLeft() diff --git a/app/gui/oven_control/functiontestwindow.h b/app/gui/oven_control/functiontestwindow.h index b174f9d..04061aa 100644 --- a/app/gui/oven_control/functiontestwindow.h +++ b/app/gui/oven_control/functiontestwindow.h @@ -33,6 +33,12 @@ private slots: void on_gasTestButton_clicked(); + void on_upperGasTestButton_clicked(); + + void on_lowerGasTestButton_clicked(); + + void on_steamGasTestButton_clicked(); + void on_adjustBlowerFan_clicked(); private: diff --git a/app/gui/oven_control/functiontestwindow.ui b/app/gui/oven_control/functiontestwindow.ui index 1585be6..2cff8a3 100644 --- a/app/gui/oven_control/functiontestwindow.ui +++ b/app/gui/oven_control/functiontestwindow.ui @@ -107,7 +107,7 @@ 127 - 616 + 600 379 70 @@ -138,7 +138,7 @@ QPushButton:pressed, QPushButton:focus { border-image: url(:/images/button/379_o 127 - 710 + 680 379 70 @@ -169,7 +169,7 @@ QPushButton:pressed, QPushButton:focus { border-image: url(:/images/button/379_o 127 - 804 + 760 379 70 @@ -200,7 +200,7 @@ QPushButton:pressed, QPushButton:focus { border-image: url(:/images/button/379_o 127 - 898 + 842 379 70 @@ -231,7 +231,7 @@ QPushButton:pressed, QPushButton:focus { border-image: url(:/images/button/379_o 127 - 992 + 927 379 70 @@ -262,7 +262,7 @@ QPushButton:pressed, QPushButton:focus { border-image: url(:/images/button/379_o 127 - 1086 + 1090 379 70 @@ -501,7 +501,7 @@ QPushButton:pressed, QPushButton:focus { border-image: url(:/images/bottom_bar/b 100 - 651 + 635 30 1 @@ -514,9 +514,9 @@ QPushButton:pressed, QPushButton:focus { border-image: url(:/images/bottom_bar/b 79 - 580 + 571 41 - 631 + 554 @@ -527,7 +527,7 @@ QPushButton:pressed, QPushButton:focus { border-image: url(:/images/bottom_bar/b 100 - 745 + 715 30 1 @@ -540,7 +540,7 @@ QPushButton:pressed, QPushButton:focus { border-image: url(:/images/bottom_bar/b 100 - 839 + 795 30 1 @@ -553,7 +553,7 @@ QPushButton:pressed, QPushButton:focus { border-image: url(:/images/bottom_bar/b 100 - 933 + 877 30 1 @@ -566,7 +566,7 @@ QPushButton:pressed, QPushButton:focus { border-image: url(:/images/bottom_bar/b 100 - 1027 + 962 30 1 @@ -579,7 +579,7 @@ QPushButton:pressed, QPushButton:focus { border-image: url(:/images/bottom_bar/b 100 - 1121 + 1045 30 1 @@ -592,7 +592,7 @@ QPushButton:pressed, QPushButton:focus { border-image: url(:/images/bottom_bar/b 100 - 1209 + 1124 30 1 @@ -605,7 +605,7 @@ QPushButton:pressed, QPushButton:focus { border-image: url(:/images/bottom_bar/b 128 - 1175 + 1010 379 70 @@ -632,8 +632,164 @@ QPushButton:pressed, QPushButton:focus { border-image: url(:/images/button/379_o 송풍기 교정 - line + + + + 90 + 1150 + 521 + 261 + + + + + + 70 + 0 + 41 + 224 + + + + Qt::Vertical + + + + + + 118 + 189 + 379 + 70 + + + + + 0 + 0 + + + + + NanumGothic + 10 + 75 + true + + + + QPushButton { border-image: url(:/images/button/379.png); } +QPushButton:pressed, QPushButton:focus { border-image: url(:/images/button/379_ov.png); } + + + 스팀용송풍기 + + + + + + 119 + 109 + 379 + 70 + + + + + 0 + 0 + + + + + NanumGothic + 10 + 75 + true + + + + QPushButton { border-image: url(:/images/button/379.png); } +QPushButton:pressed, QPushButton:focus { border-image: url(:/images/button/379_ov.png); } + + + 건열부송풍기(하) + + + + + + 118 + 26 + 379 + 70 + + + + + 0 + 0 + + + + + NanumGothic + 10 + 75 + true + + + + QPushButton { border-image: url(:/images/button/379.png); } +QPushButton:pressed, QPushButton:focus { border-image: url(:/images/button/379_ov.png); } + + + 건열부송풍기(상) + + + + + + 91 + 144 + 30 + 1 + + + + Qt::Horizontal + + + + + + 91 + 223 + 30 + 1 + + + + Qt::Horizontal + + + + + + 91 + 61 + 30 + 1 + + + + Qt::Horizontal + + + + gasTestContainer line_2 + line upperStack widget burnerTestButton diff --git a/app/gui/oven_control/gastestwindow.cpp b/app/gui/oven_control/gastestwindow.cpp index 03d649b..60cf980 100644 --- a/app/gui/oven_control/gastestwindow.cpp +++ b/app/gui/oven_control/gastestwindow.cpp @@ -2,26 +2,48 @@ #include "ui_gastestwindow.h" #include +#include #include "soundplayer.h" +#include "config.h" -GasTestWindow::GasTestWindow(QWidget *parent, UdpHandler *udp) : +GasTestWindow::GasTestWindow(Target target, QWidget *parent) : QMainWindow(parent), - ui(new Ui::GasTestWindow), udp(udp) + ui(new Ui::GasTestWindow), target(target) { ui->setupUi(this); ui->clockContainer->setParent(ui->upperStack); setAttribute(Qt::WA_DeleteOnClose); - foreach (QPushButton *button, findChildren()) - connect(button, &QPushButton::pressed, SoundPlayer::playClick); + switch (target) + { + case Upper: + ui->titleLabel->setText(tr("서비스단계(엔지니어모드) > 기능테스트 > 연소가스동작 > 건열송풍기(상)")); + break; + case Lower: + ui->titleLabel->setText(tr("서비스단계(엔지니어모드) > 기능테스트 > 연소가스동작 > 건열송풍기(하)")); + break; + case Steam: + ui->titleLabel->setText(tr("서비스단계(엔지니어모드) > 기능테스트 > 연소가스동작 > 스팀용송풍기")); + break; + } + udp = UdpHandler::getInstance(); + udp->set(TG_OVEN_MODE, 4); connect(udp, SIGNAL(changed()), this, SLOT(onDataChanged())); + + stopTimer.setInterval(60 * 1000); + connect(&stopTimer, SIGNAL(timeout()), SLOT(stop())); + + foreach (QPushButton *button, findChildren()) + connect(button, &QPushButton::pressed, SoundPlayer::playClick); } GasTestWindow::~GasTestWindow() { + stop(); + delete ui; } @@ -60,9 +82,264 @@ void GasTestWindow::keyReleaseEvent(QKeyEvent *event) } } +void GasTestWindow::updateView() +{ + ui->rpmLabel->setText(QString("%1 rpm").arg(currentRpm())); + + switch (phase) + { + case Min: + ui->minButton->setText(isRunning() ? "STOP" : "START"); + ui->maxButton->setText("START"); + break; + case Max: + ui->minButton->setText("START"); + ui->maxButton->setText(isRunning() ? "STOP" : "START"); + break; + default: + ui->minButton->setText("START"); + ui->maxButton->setText("START"); + } +} + void GasTestWindow::onDataChanged() { + switch (phase) + { + case MinStopping: + case MaxStopping: + if (!isRunning()) + phase = Idle; + default: + break; + } + + updateView(); +} + +void GasTestWindow::startMin() +{ + switch (target) + { + case Upper: + runUpper(minRpm()); + break; + case Lower: + runLower(minRpm()); + break; + case Steam: + runSteam(minRpm()); + break; + } + + stopTimer.start(); + + phase = Min; +} + +void GasTestWindow::startMax() +{ + switch (target) + { + case Upper: + runUpper(maxRpm()); + break; + case Lower: + runLower(maxRpm()); + break; + case Steam: + runSteam(maxRpm()); + break; + } + + stopTimer.start(); + + phase = Max; +} + +void GasTestWindow::stop() +{ + if (stopTimer.isActive()) + stopTimer.stop(); + + switch (target) + { + case Upper: + stopUpper(); + break; + case Lower: + stopLower(); + break; + case Steam: + stopSteam(); + break; + } + switch (phase) + { + case Min: + phase = MinStopping; + break; + case Max: + phase = MaxStopping; + break; + default: + break; + } +} + +void GasTestWindow::runUpper(int rpm) +{ + udp->set(TG_BUNNER1_RPM, rpm); + udp->turnOn(TG_BUNNER1_MANUAL); + udp->turnOn(TG_BUNNER1_FAN); + udp->turnOn(TG_MANUAL_BURNER1); + + udp->set(TG_FAN1_DIRECTOIN, 0); + udp->set(TG_FAN1_RPM, 1175); + udp->turnOn(TG_FAN1_MANUAL); + udp->turnOn(TG_MANUAL_FAN1); +} + +void GasTestWindow::runLower(int rpm) +{ + udp->set(TG_BUNNER2_RPM, rpm); + udp->turnOn(TG_BUNNER2_MANUAL); + udp->turnOn(TG_BUNNER2_FAN); + udp->turnOn(TG_MANUAL_BURNER2); + + udp->set(TG_FAN2_DIRECTOIN, 0); + udp->set(TG_FAN2_RPM, 1175); + udp->turnOn(TG_FAN2_MANUAL); + udp->turnOn(TG_MANUAL_FAN2); +} + +void GasTestWindow::runSteam(int rpm) +{ + udp->set(TG_BUNNER3_RPM, rpm); + udp->turnOn(TG_BUNNER3_MANUAL); + udp->turnOn(TG_BUNNER3_FAN); + udp->turnOn(TG_MANUAL_BURNER3); +} + +void GasTestWindow::stopUpper() +{ + udp->turnOff(TG_MANUAL_BURNER1); + udp->turnOff(TG_BUNNER1_MANUAL); + udp->turnOff(TG_BUNNER1_FAN); + + udp->turnOff(TG_MANUAL_FAN1); + udp->turnOff(TG_FAN1_MANUAL); +} + +void GasTestWindow::stopLower() +{ + udp->turnOff(TG_MANUAL_BURNER2); + udp->turnOff(TG_BUNNER2_MANUAL); + udp->turnOff(TG_BUNNER2_FAN); + + udp->turnOff(TG_MANUAL_FAN2); + udp->turnOff(TG_FAN2_MANUAL); +} + +void GasTestWindow::stopSteam() +{ + udp->turnOff(TG_MANUAL_BURNER3); + udp->turnOff(TG_BUNNER3_MANUAL); + udp->turnOff(TG_BUNNER3_FAN); +} + +int GasTestWindow::minRpm() +{ + Config *config = Config::getInstance(); + + switch (target) + { + case Upper: + case Lower: + if (isHalf()) + return config->getConfigValue(Define::config_burner23_pwr1_half_rpm).d32; + else + return config->getConfigValue(Define::config_burner23_pwr1_normal_rpm).d32; + case Steam: + default: + if (isHalf()) + return config->getConfigValue(Define::config_burner1_pwr1_half_rpm).d32; + else + return config->getConfigValue(Define::config_burner1_pwr1_normal_rpm).d32; + } +} + +int GasTestWindow::maxRpm() +{ + Config *config = Config::getInstance(); + + switch (target) + { + case Upper: + case Lower: + if (isHalf()) + return config->getConfigValue(Define::config_burner23_pwr2_half_rpm).d32; + else + return config->getConfigValue(Define::config_burner23_pwr2_normal_rpm).d32; + case Steam: + default: + if (isHalf()) + return config->getConfigValue(Define::config_burner1_pwr2_half_rpm).d32; + else + return config->getConfigValue(Define::config_burner1_pwr2_normal_rpm).d32; + } +} + +bool GasTestWindow::isHalf() +{ + return Config::getInstance()->getConfigValue(Define::config_set_half_energy).d32 > 0; +} + +bool GasTestWindow::isRunning() +{ + switch (target) + { + case Upper: + return udp->burner1() || udp->burnerFan1(); + case Lower: + return udp->burner2() || udp->burnerFan2(); + case Steam: + return udp->burner3() || udp->burnerFan3(); + default: + return false; + } +} + +int GasTestWindow::currentRpm() +{ + switch (target) + { + case Upper: + return udp->getData().burner1_current_rpm; + case Lower: + return udp->getData().burner2_current_rpm; + case Steam: + return udp->getData().burner3_current_rpm; + default: + return 0; + } +} + +void GasTestWindow::on_minButton_clicked() +{ + if (isRunning() && (phase == Min || phase == MinStopping)) + stop(); + else + startMin(); +} + +void GasTestWindow::on_maxButton_clicked() +{ + if (isRunning() && (phase == Max || phase == MaxStopping)) + stop(); + else + startMax(); } void GasTestWindow::on_backButton_clicked() diff --git a/app/gui/oven_control/gastestwindow.h b/app/gui/oven_control/gastestwindow.h index 6c1c6a8..5a80e39 100644 --- a/app/gui/oven_control/gastestwindow.h +++ b/app/gui/oven_control/gastestwindow.h @@ -2,6 +2,7 @@ #define GASTESTWINDOW_H #include +#include #include "udphandler.h" @@ -14,7 +15,17 @@ class GasTestWindow : public QMainWindow Q_OBJECT public: - explicit GasTestWindow(QWidget *parent = 0, UdpHandler *udp = 0); + enum Target { + Upper, Lower, Steam + }; + + enum Phase { + Idle, + Min, MinStopping, + Max, MaxStopping + }; + + explicit GasTestWindow(Target target, QWidget *parent = 0); ~GasTestWindow(); protected: @@ -22,13 +33,37 @@ protected: void keyReleaseEvent(QKeyEvent *event); private slots: + void updateView(); void onDataChanged(); + void startMin(); + void startMax(); + void stop(); + + void runUpper(int rpm); + void runLower(int rpm); + void runSteam(int rpm); + void stopUpper(); + void stopLower(); + void stopSteam(); + int minRpm(); + int maxRpm(); + + bool isHalf(); + bool isRunning(); + int currentRpm(); + + void on_minButton_clicked(); + void on_maxButton_clicked(); void on_backButton_clicked(); + private: Ui::GasTestWindow *ui; UdpHandler *udp; + Target target; + Phase phase = Idle; + QTimer stopTimer; QWidget *pushed = NULL; diff --git a/app/gui/oven_control/gastestwindow.ui b/app/gui/oven_control/gastestwindow.ui index 3ae93cd..de381e7 100644 --- a/app/gui/oven_control/gastestwindow.ui +++ b/app/gui/oven_control/gastestwindow.ui @@ -110,18 +110,18 @@ QPushButton { border-image: url(:/images/bottom_bar/back.png); } -QPushButton:pressed { border-image: url(:/images/bottom_bar/back_ov.png); } +QPushButton:pressed, QPushButton:focus { border-image: url(:/images/bottom_bar/back_ov.png); } - + - 580 - 640 + 697 + 890 184 70 @@ -134,23 +134,379 @@ QPushButton:pressed { border-image: url(:/images/bottom_bar/back_ov.png); } + Roboto + 10 75 true - QPushButton { - border-image: url(:/images/images/config_service/090_set_eng_btn_03.png); -} - -QPushButton:pressed { - border-image: url(:/images/images/config_service/090_set_eng_btn_03_ov.png); -} + QPushButton { border-image: url(:/images/button/184.png); } +QPushButton:pressed, QPushButton:focus { border-image: url(:/images/button/184_ov.png); } START + + + + 55 + 550 + 231 + 70 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 123 + 123 + 123 + + + + + + + + + Malgun Gothic + 12 + + + + RPM + + + + + + 55 + 1020 + 331 + 70 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 123 + 123 + 123 + + + + + + + + + Malgun Gothic + 12 + + + + Max-RPM + + + + + + 55 + 785 + 271 + 70 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 123 + 123 + 123 + + + + + + + + + Malgun Gothic + 12 + + + + Min-RPM + + + + + + 18 + 980 + 863 + 1 + + + + + + + :/images/line/manual_core_temp_horizontal.png + + + + + + 55 + 426 + 845 + 84 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 123 + 123 + 123 + + + + + + + + + Malgun Gothic + 9 + + + + 서비스단계(엔지니어모드) > 기능테스트 > 연소가스동작 > 건열송풍기(상) + + + + + + 697 + 1125 + 184 + 70 + + + + + 0 + 0 + + + + + Roboto + 10 + 75 + true + + + + QPushButton { border-image: url(:/images/button/184.png); } +QPushButton:pressed, QPushButton:focus { border-image: url(:/images/button/184_ov.png); } + + + START + + + + + + 18 + 745 + 863 + 1 + + + + + + + :/images/line/manual_core_temp_horizontal.png + + + + + + 18 + 1215 + 863 + 1 + + + + + + + :/images/line/manual_core_temp_horizontal.png + + + + + + 55 + 610 + 231 + 70 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 123 + 123 + 123 + + + + + + + + + Malgun Gothic + 11 + + + + 0 rpm + + @@ -181,6 +537,8 @@ QPushButton:pressed {
digitalclock.h
- + + + diff --git a/app/gui/oven_control/udphandler.h b/app/gui/oven_control/udphandler.h index 7a70209..272032b 100644 --- a/app/gui/oven_control/udphandler.h +++ b/app/gui/oven_control/udphandler.h @@ -31,6 +31,8 @@ public: bool init(); + const oven_control_t &getControl() { return control; } + const oven_state_t &getData() { return state; } bool burner1() { return (state.onoff_state1 & 0x0001) != 0; } bool burner2() { return (state.onoff_state1 & 0x0002) != 0; } -- 2.1.4