Commit 89f0ad175e1fff383158ab2303e40e364d14a954

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

전기식일 땐 모드버스 테이블을 작게 인식하도록 수정 (전기식 메인 보드에 최신 프로토콜이 구현되지 않았음)

Showing 1 changed file with 32 additions and 3 deletions   Show diff stats
app/gui/oven_control/udphandler.cpp
... ... @@ -2,6 +2,8 @@
2 2  
3 3 #include <QtDebug>
4 4  
  5 +#include "config.h"
  6 +
5 7 #define IPC_UDP_SYS_HOST "127.0.0.1"
6 8 #define IPC_UDP_SYS_PORT 4001
7 9 #define IPC_UDP_GUI_PORT 4000
... ... @@ -91,10 +93,37 @@ void UdpHandler::processControl(oven_control_t *control)
91 93  
92 94 void UdpHandler::processState(oven_state_t *state)
93 95 {
94   - if (memcmp(&this->state, state, sizeof(this->state)))
  96 + Define::config_item item = Config::getInstance()->getConfigValue(Define::config_model);
  97 +
  98 + bool isElectric = false;
  99 + switch (item.d32)
95 100 {
96   - memcpy(&this->state, state, sizeof(this->state));
97   - emit changed();
  101 + case Define::model_electric_10:
  102 + case Define::model_electric_20:
  103 + case Define::model_electric_24:
  104 + case Define::model_electric_40:
  105 + isElectric = true;
  106 + break;
  107 + }
  108 +
  109 + qDebug() << sizeof(this->state);
  110 +
  111 + if (isElectric)
  112 + {
  113 + if (memcmp(&this->state, state, 100))
  114 + {
  115 + memcpy(&this->state, state, 100);
  116 + bzero(((char *) &this->state) + 100, sizeof(this->state) - 100);
  117 + emit changed();
  118 + }
  119 + }
  120 + else
  121 + {
  122 + if (memcmp(&this->state, state, sizeof(this->state)))
  123 + {
  124 + memcpy(&this->state, state, sizeof(this->state));
  125 + emit changed();
  126 + }
98 127 }
99 128 }
100 129  
... ...