diff --git a/app/gui/oven_control/udphandler.cpp b/app/gui/oven_control/udphandler.cpp index 0a64d99..11d664c 100644 --- a/app/gui/oven_control/udphandler.cpp +++ b/app/gui/oven_control/udphandler.cpp @@ -2,6 +2,8 @@ #include +#include "config.h" + #define IPC_UDP_SYS_HOST "127.0.0.1" #define IPC_UDP_SYS_PORT 4001 #define IPC_UDP_GUI_PORT 4000 @@ -91,10 +93,37 @@ void UdpHandler::processControl(oven_control_t *control) void UdpHandler::processState(oven_state_t *state) { - if (memcmp(&this->state, state, sizeof(this->state))) + Define::config_item item = Config::getInstance()->getConfigValue(Define::config_model); + + bool isElectric = false; + switch (item.d32) { - memcpy(&this->state, state, sizeof(this->state)); - emit changed(); + case Define::model_electric_10: + case Define::model_electric_20: + case Define::model_electric_24: + case Define::model_electric_40: + isElectric = true; + break; + } + + qDebug() << sizeof(this->state); + + if (isElectric) + { + if (memcmp(&this->state, state, 100)) + { + memcpy(&this->state, state, 100); + bzero(((char *) &this->state) + 100, sizeof(this->state) - 100); + emit changed(); + } + } + else + { + if (memcmp(&this->state, state, sizeof(this->state))) + { + memcpy(&this->state, state, sizeof(this->state)); + emit changed(); + } } }