8c2952457
김태훈
응용 프로그램 추가
|
1
2
3
4
|
#include "burnertestwindow.h"
#include "ui_burnertestwindow.h"
#include <QTimer>
|
66e60ceb5
김태훈
모든 버튼에 음향 효과 추가
|
5
|
#include "soundplayer.h"
|
538041ab9
김태훈
소스 코드 구조 개선
|
6
|
BurnerTestWindow::BurnerTestWindow(QWidget *parent) :
|
8c2952457
김태훈
응용 프로그램 추가
|
7
|
QMainWindow(parent),
|
538041ab9
김태훈
소스 코드 구조 개선
|
8
|
ui(new Ui::BurnerTestWindow)
|
8c2952457
김태훈
응용 프로그램 추가
|
9
10
|
{
ui->setupUi(this);
|
6f96c947a
김태훈
GUI 0.1.4
|
11
|
|
8c2952457
김태훈
응용 프로그램 추가
|
12
|
ui->clockContainer->setParent(ui->upperStack);
|
6f96c947a
김태훈
GUI 0.1.4
|
13
|
setAttribute(Qt::WA_DeleteOnClose);
|
8c2952457
김태훈
응용 프로그램 추가
|
14
|
|
66e60ceb5
김태훈
모든 버튼에 음향 효과 추가
|
15
16
|
foreach (QPushButton *button, findChildren<QPushButton *>())
connect(button, &QPushButton::pressed, SoundPlayer::playClick);
|
538041ab9
김태훈
소스 코드 구조 개선
|
17
|
udp = UdpHandler::getInstance();
|
8c2952457
김태훈
응용 프로그램 추가
|
18
19
20
21
22
23
24
25
26
27
28
|
steamTimer.setInterval(5 * 60 * 1000);
upperTimer.setInterval(5 * 60 * 1000);
lowerTimer.setInterval(5 * 60 * 1000);
connect(&steamTimer, SIGNAL(timeout()), this, SLOT(steamOff()));
connect(&upperTimer, SIGNAL(timeout()), this, SLOT(upperOff()));
connect(&lowerTimer, SIGNAL(timeout()), this, SLOT(lowerOff()));
connect(this->udp, SIGNAL(changed()), this, SLOT(onDataChanged()));
udp->set(TG_OVEN_MODE, 4);
|
8c2952457
김태훈
응용 프로그램 추가
|
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
udp->turnOn(TG_MANUAL_BURNER1);
udp->turnOn(TG_MANUAL_BURNER2);
udp->turnOn(TG_MANUAL_BURNER3);
onDataChanged();
}
BurnerTestWindow::~BurnerTestWindow()
{
delete ui;
}
void BurnerTestWindow::onDataChanged()
{
oven_state_t oven;
udp->fillData(oven);
int steam = oven.onoff_state1 & 0x0004;
int upper = oven.onoff_state1 & 0x0001;
int lower = oven.onoff_state1 & 0x0002;
if (steam)
ui->steamBurnerButton->setText("STOP");
else
ui->steamBurnerButton->setText("START");
if (upper)
ui->upperBurnerButton->setText("STOP");
else
ui->upperBurnerButton->setText("START");
if (lower)
ui->lowerBurnerButton->setText("STOP");
else
ui->lowerBurnerButton->setText("START");
QString buf;
ui->t1->setText(buf.sprintf("%d℃", oven.sensor1));
ui->t5->setText(buf.sprintf("%d℃", oven.sensor5));
if (steam && oven.curr_humidity >= 100)
{
steamTimer.stop();
steamOff();
}
if ((upper || lower) && oven.curr_heat >= 150)
{
upperTimer.stop();
lowerTimer.stop();
upperOff();
lowerOff();
}
}
void BurnerTestWindow::on_steamBurnerButton_clicked()
{
oven_state_t oven;
udp->fillData(oven);
int sw = oven.onoff_state1 & 0x0004;
if (sw)
{
steamTimer.stop();
steamOff();
}
else
{
steamTimer.start();
steamOn();
}
}
void BurnerTestWindow::on_upperBurnerButton_clicked()
{
oven_state_t oven;
udp->fillData(oven);
int sw = oven.onoff_state1 & 0x0001;
if (sw)
{
upperTimer.stop();
upperOff();
}
else
{
upperTimer.start();
upperOn();
}
}
void BurnerTestWindow::on_lowerBurnerButton_clicked()
{
oven_state_t oven;
udp->fillData(oven);
int sw = oven.onoff_state1 & 0x0002;
if (sw)
{
lowerTimer.stop();
lowerOff();
}
else
{
lowerTimer.start();
lowerOn();
}
}
void BurnerTestWindow::on_backButton_clicked()
{
udp->turnOff(TG_BUNNER1_MANUAL);
udp->turnOff(TG_BUNNER2_MANUAL);
udp->turnOff(TG_BUNNER3_MANUAL);
udp->turnOff(TG_MANUAL_BURNER1);
udp->turnOff(TG_MANUAL_BURNER2);
udp->turnOff(TG_MANUAL_BURNER3);
|
8c2952457
김태훈
응용 프로그램 추가
|
146
|
|
6f96c947a
김태훈
GUI 0.1.4
|
147
|
close();
|
8c2952457
김태훈
응용 프로그램 추가
|
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
|
}
void BurnerTestWindow::steamOn()
{
udp->turnOn(TG_BUNNER3_MANUAL);
}
void BurnerTestWindow::steamOff()
{
udp->turnOff(TG_BUNNER3_MANUAL);
}
void BurnerTestWindow::upperOn()
{
udp->turnOn(TG_BUNNER1_MANUAL);
}
void BurnerTestWindow::upperOff()
{
udp->turnOff(TG_BUNNER1_MANUAL);
}
void BurnerTestWindow::lowerOn()
{
udp->turnOn(TG_BUNNER2_MANUAL);
}
void BurnerTestWindow::lowerOff()
{
udp->turnOff(TG_BUNNER2_MANUAL);
}
|