From 39fec1254e007f607eb12a4d9378e821ed43cc54 Mon Sep 17 00:00:00 2001 From: victor Date: Thu, 13 Jun 2019 12:36:16 +0900 Subject: [PATCH] =?UTF-8?q?=EC=9A=94=EC=B2=AD=20=EC=82=AC=ED=95=AD=20?= =?UTF-8?q?=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - HACCP 기록 항목 추가 - 설정 습도, 설정 온도, 설정 시간 - 수위 상태, 급수 밸브, 히터 상태 --- .../app/app-prime-modbus/rs485_serial.c | 1 - app/app-prime-modbus/include/all_share.h | 8 +-- app/gui/oven_control/haccp.cpp | 58 ++++++++++++++++++---- app/gui/oven_control/ovenstatics.cpp | 4 +- app/gui/oven_control/udphandler.h | 10 +++- 5 files changed, 64 insertions(+), 17 deletions(-) diff --git a/app/app-prime-modbus/app/app-prime-modbus/rs485_serial.c b/app/app-prime-modbus/app/app-prime-modbus/rs485_serial.c index 929029f..61b1dc4 100644 --- a/app/app-prime-modbus/app/app-prime-modbus/rs485_serial.c +++ b/app/app-prime-modbus/app/app-prime-modbus/rs485_serial.c @@ -502,7 +502,6 @@ static void on_rcv_status( void){ printf( "onoff_state1 = 0x%04x\n", oven.state.onoff_state1); printf( "onoff_state2 = 0x%04x\n", oven.state.onoff_state2); - printf( "onoff_realy_load = 0x%04x\n", oven.state.onoff_relay_load); // GUI로 전송 gui_send_data_to_gui( ( char *)&oven, sizeof( gui_oven_state_t)); diff --git a/app/app-prime-modbus/include/all_share.h b/app/app-prime-modbus/include/all_share.h index 04ada15..2f94808 100644 --- a/app/app-prime-modbus/include/all_share.h +++ b/app/app-prime-modbus/include/all_share.h @@ -186,7 +186,7 @@ typedef struct { U16 cleaning_sec; // 0E U16 cleaning_min; // 0F U16 door_state; // 10 - U16 reserved11; // 11 + U16 water_level; // 11 U16 burner1_rpm; // 12 U16 burner2_rpm; // 13 U16 burner3_rpm; // 14 @@ -212,9 +212,9 @@ typedef struct { I16 sensor14; // 28 U16 sensor15; // 29 U16 sensor16; // 2A - U16 onoff_relay_load; // 2B - U16 reserved2c; // 2C - U16 reserved2d; // 2D + U16 onoff_relay_load1; // 2B + U16 onoff_relay_load2; // 2C + U16 onoff_relay_load3; // 2D U16 system_error; // 2E U16 communication_error; // 2F U16 sensor_error; // 30 diff --git a/app/gui/oven_control/haccp.cpp b/app/gui/oven_control/haccp.cpp index 1d082cd..49426ce 100644 --- a/app/gui/oven_control/haccp.cpp +++ b/app/gui/oven_control/haccp.cpp @@ -10,6 +10,7 @@ #include "stringer.h" #include "oven.h" #include "config.h" +#include "udphandler.h" namespace { @@ -19,11 +20,23 @@ enum Type { Invalid, Manual, Auto, Multi, Wash, Engineering }; struct Stamp { QDateTime time; - int temp; + int remainingTime; + + int targetTemp; + int curTemp; + int targetCoreTemp; int curCoreTemp; - bool door; + + int targetHumidity; + + int waterLevel; + int heater; + QString caption; + + bool door; + bool ssv; }; struct AutoCookConfig @@ -386,10 +399,14 @@ void stamp(QString caption) return; Oven *oven = Oven::getInstance(); + UdpHandler *udp = UdpHandler::getInstance(); Stamp s; s.time = QDateTime::currentDateTime(); - s.temp = oven->currentTemp(); + s.remainingTime = oven->time(); + + s.targetTemp = oven->temp(); + s.curTemp = oven->currentTemp(); if (oven->interTempEnabled()) { @@ -402,9 +419,15 @@ void stamp(QString caption) s.curCoreTemp = 0; } + s.targetHumidity = oven->humidity(); + s.door = oven->door(); s.caption = caption; + s.waterLevel = udp->waterLevel(); + s.ssv = udp->ssv(); + s.heater = udp->heater(); + data.records.append(s); lastDoor = oven->door(); @@ -519,11 +542,17 @@ void saveData() << "#2,Inner Tank Temp\n" << "#3,Food Temp (Target)\n" << "#4,Food Temp\n" - << "#5,Door Open / Closed\n"; + << "#5,Door Open / Closed\n" + << "#6,Humidity (Target)\n" + << "#7,Temp (Target)\n" + << "#8,Time (Target)\n" + << "#9,Water Level\n" + << "#10,Valve\n" + << "#11,Heater\n"; stream << "\n"; - stream << "#1,#2,#3,#4,#5\n"; + stream << "#1,#2,#3,#4,#5,#6,#7,#8,#9,#10,#11\n"; for (int i = 0; i < data.records.size(); i++) { const Stamp &s = data.records.at(i); @@ -534,7 +563,7 @@ void saveData() int secs = data.startedAt.secsTo(s.time); int nextSecs = data.startedAt.secsTo(n.time); if (secs == nextSecs - && s.temp == n.temp + && s.curTemp == n.curTemp && s.targetCoreTemp == n.targetCoreTemp && s.curCoreTemp == n.curCoreTemp && s.door == n.door) @@ -552,10 +581,21 @@ void saveData() stream << s.caption << "\n"; stream << Stringer::timeSecs(data.startedAt.secsTo(s.time)) << "," - << s.temp << "," + << s.curTemp << "," << s.targetCoreTemp << "," << s.curCoreTemp << "," - << (s.door ? "O\n" : "C\n"); + << (s.door ? "O," : "C,") + << s.targetHumidity << "," + << s.targetTemp << "," + << Stringer::timeSecs(s.remainingTime) << "," + << (s.waterLevel == 3 ? "H," : + s.waterLevel == 1 ? "C," : + s.waterLevel == 0 ? "L," : "E,") + << (s.ssv ? "O," : "C,") + << (s.heater & 0x01 ? "1" : "0") + << (s.heater & 0x02 ? "1" : "0") + << (s.heater & 0x04 ? "1" : "0") + << (s.heater & 0x08 ? "1" : "0") << "\n"; } if (!data.autoConfig.isEmpty()) @@ -620,7 +660,7 @@ void check() if (oven->door() != lastDoor) stamp(); - if (lastStampedTime.elapsed() > 60 * 1000 - 100) + if (lastStampedTime.elapsed() > 30 * 1000 - 100) stamp(); } diff --git a/app/gui/oven_control/ovenstatics.cpp b/app/gui/oven_control/ovenstatics.cpp index 3e8a836..61ce2c4 100644 --- a/app/gui/oven_control/ovenstatics.cpp +++ b/app/gui/oven_control/ovenstatics.cpp @@ -542,8 +542,8 @@ void OvenStatistics::oneSecTimerFired(void){ realdata.b.wsv_open = (state.onoff_state2&LOAD_STATE2_WSV)==0?0:1; realdata.b.ssv_open = (state.onoff_state2&LOAD_STATE2_SSV)==0?0:1; - if( (state.reserved11&0x0018) == 0x0018) realdata.b.water_level = water_level_high; - else if( (state.reserved11&0x0018) == 0x0000) realdata.b.water_level = water_level_low; + if( (state.water_level&0x0018) == 0x0018) realdata.b.water_level = water_level_high; + else if( (state.water_level&0x0018) == 0x0000) realdata.b.water_level = water_level_low; else realdata.b.water_level = water_level_normal; if(srvdata->sensor_log.items.B1.high_temp.itemp < state.sensor1 ){ diff --git a/app/gui/oven_control/udphandler.h b/app/gui/oven_control/udphandler.h index 61dd783..caeb2a3 100644 --- a/app/gui/oven_control/udphandler.h +++ b/app/gui/oven_control/udphandler.h @@ -55,7 +55,15 @@ public: bool unp() { return (state.onoff_state2 & 0x0200) != 0; } bool hdm() { return (state.onoff_state2 & 0x0400) != 0; } bool sgnv() { return (state.onoff_state2 & 0x0800) != 0; } - bool inv() {return (state.onoff_state2 & 0x1000) !=0; } + bool inv() { return (state.onoff_state2 & 0x1000) !=0; } + + // 3: H, 2: Error, 1: C, 0: L + int waterLevel() { + return ((state.water_level & 0x08) >> 2) + | ((state.water_level & 0x10) >> 4); + } + + int heater() { return (state.onoff_relay_load2 & 0x0F); } signals: void changed(); -- 2.1.4