Commit e77a367ac9fd59deacc15206fa7777e8bbadae89

Authored by 김태훈
1 parent 4fc65fb819
Exists in master and in 2 other branches fhd, fhd-demo

모드버스 주소 설명 추가

Showing 1 changed file with 17 additions and 4 deletions   Show diff stats
app/gui/packet/mainwindow.cpp
... ... @@ -14,6 +14,8 @@ MainWindow::MainWindow(QWidget *parent) :
14 14 if (!sock->bind(4000))
15 15 exit(EXIT_FAILURE);
16 16  
  17 + bzero(&control, sizeof(control));
  18 + bzero(&state, sizeof(state));
17 19  
18 20 connect(sock, SIGNAL(readyRead()), this, SLOT(readPendingDatagrams()));
19 21  
... ... @@ -84,6 +86,12 @@ MainWindow::MainWindow(QWidget *parent) :
84 86 ui->controlTable->setItem(0x0F, 3, new QTableWidgetItem("Convection RPM"));
85 87 ui->controlTable->setItem(0x10, 3, new QTableWidgetItem("Cool Down On/Off"));
86 88 ui->controlTable->setItem(0x11, 3, new QTableWidgetItem("InterTemp"));
  89 +// ui->controlTable->setItem(0x12, 3, new QTableWidgetItem("InterTemp"));
  90 +// ui->controlTable->setItem(0x13, 3, new QTableWidgetItem("InterTemp"));
  91 + ui->controlTable->setItem(0x14, 3, new QTableWidgetItem("Wash Type"));
  92 + ui->controlTable->setItem(0x15, 3, new QTableWidgetItem("Wash Total"));
  93 + ui->controlTable->setItem(0x16, 3, new QTableWidgetItem("Wash Steps"));
  94 + ui->controlTable->setItem(0x17, 3, new QTableWidgetItem("Wash Step Type"));
87 95  
88 96 ui->stateTable->setItem(0x00, 3, new QTableWidgetItem("Firmware V"));
89 97 ui->stateTable->setItem(0x01, 3, new QTableWidgetItem("Firmware Y"));
... ... @@ -97,8 +105,8 @@ MainWindow::MainWindow(QWidget *parent) :
97 105 ui->stateTable->setItem(0x09, 3, new QTableWidgetItem("Current Humidity"));
98 106 ui->stateTable->setItem(0x0A, 3, new QTableWidgetItem("Current Time"));
99 107 ui->stateTable->setItem(0x0B, 3, new QTableWidgetItem("Wash State"));
100   -// ui->stateTable->setItem(0x0C, 3, new QTableWidgetItem("Oven Mode"));
101   -// ui->stateTable->setItem(0x0D, 3, new QTableWidgetItem("Oven Mode"));
  108 + ui->stateTable->setItem(0x0C, 3, new QTableWidgetItem("Wash Type"));
  109 + ui->stateTable->setItem(0x0D, 3, new QTableWidgetItem("Wash Steps"));
102 110 // ui->stateTable->setItem(0x0E, 3, new QTableWidgetItem("Oven Mode"));
103 111 // ui->stateTable->setItem(0x0F, 3, new QTableWidgetItem("Oven Mode"));
104 112 ui->stateTable->setItem(0x10, 3, new QTableWidgetItem("Door Open/Close"));
... ... @@ -161,12 +169,15 @@ void MainWindow::processDatagram(QByteArray &datagram)
161 169 switch (packet->header)
162 170 {
163 171 case HDR_OVEN_CONTROL:
  172 + qDebug() << "Received Control";
164 173 processControl((oven_control_t *) packet->body);
165 174 break;
166 175 case HDR_OVEN_STATE:
  176 + qDebug() << "Received State";
167 177 processState((oven_state_t *) packet->body);
168 178 break;
169 179 case HDR_ERROR_CODE:
  180 + qDebug() << "Received Error";
170 181 break;
171 182 }
172 183 }
... ... @@ -189,6 +200,7 @@ void MainWindow::updateControl(oven_control_t *control)
189 200 U16 *operand = (U16 *) control;
190 201 for (int row = 0; row < ui->controlTable->rowCount(); row++)
191 202 {
  203 + qDebug() << "Diff";
192 204 U16 b = *(base + row);
193 205 U16 o = *(operand + row);
194 206 if (b != o)
... ... @@ -225,7 +237,8 @@ void MainWindow::updateState(oven_state_t *state)
225 237  
226 238 void MainWindow::on_pushControlButton_clicked()
227 239 {
228   - U16 *base = (U16 *) &this->control;
  240 + oven_control_t control = this->control;
  241 + U16 *base = (U16 *) &control;
229 242 for (int row = 0; row < ui->controlTable->rowCount(); row++)
230 243 {
231 244 QTableWidgetItem *val = (QTableWidgetItem *) ui->controlTable->item(row, 4);
... ... @@ -235,7 +248,7 @@ void MainWindow::on_pushControlButton_clicked()
235 248  
236 249 gui_oven_control_t c;
237 250 c.header = HDR_OVEN_CONTROL;
238   - memcpy(&c.control, &this->control, sizeof(this->control));
  251 + memcpy(&c.control, &control, sizeof(this->control));
239 252  
240 253 QByteArray datagram = QByteArray::fromRawData((char *) &c, sizeof(c));
241 254 sock->writeDatagram(datagram, QHostAddress("192.168.10.139"), 4000);
... ...