From 3876b4db1cb7f41966af1aecf0d8a20f07714dfd Mon Sep 17 00:00:00 2001 From: CJ980606 <805250096@qq.com> Date: Tue, 6 Jun 2023 09:49:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=85=8D=E7=BD=AECOM?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cigarette/CaptureThreadBasler.h | 2 +- Cigarette/PLC/PLCDevice.cpp | 8 +++- Cigarette/cigarette.cpp | 5 +++ Cigarette/common.h | 5 ++- Cigarette/threadSend.h | 4 +- Cigarette/workthread.cpp | 6 +-- conf/conf.txt | 69 +++++++++++++++++---------------- conf/modbus.txt | 12 ++++-- conf/plc.txt | 42 +++++++++++--------- conf/rotate.txt | 2 +- conf/说明.txt | 1 + 11 files changed, 92 insertions(+), 64 deletions(-) create mode 100644 conf/说明.txt diff --git a/Cigarette/CaptureThreadBasler.h b/Cigarette/CaptureThreadBasler.h index d8ccbcc..aa5129b 100644 --- a/Cigarette/CaptureThreadBasler.h +++ b/Cigarette/CaptureThreadBasler.h @@ -129,7 +129,7 @@ private: QMutex lock_; }; //----------------------------------------------------------------------------- -class CSampleConfigurationEventHandler : public Pylon::CBaslerUniversalConfigurationEventHandler +class CSampleConfigurationEventHandler : public Pylon::CBaslerUniversalConfigurationEventHandler //CConfigurationEventHandler { public: int channel_; diff --git a/Cigarette/PLC/PLCDevice.cpp b/Cigarette/PLC/PLCDevice.cpp index 6bbe89b..661f147 100644 --- a/Cigarette/PLC/PLCDevice.cpp +++ b/Cigarette/PLC/PLCDevice.cpp @@ -2,13 +2,19 @@ #include "PLCDevice.h" #include "modbus.h" #include +#include +#include + +extern SysConf g_sys_conf; modbus_t * g_modbus; //Modbus TCP bool PLCDevice::init_plc(PLCDevice* PLCptr) { + const char* comport= g_sys_conf.ComPort.data(); + qDebug() << "COM:" << comport; //连接PLC - g_modbus = modbus_new_rtu("COM1", 9600, 'N', 8, 1); + g_modbus = modbus_new_rtu(comport, 9600, 'N', 8, 1); modbus_set_debug(g_modbus, 0); modbus_set_response_timeout(g_modbus, 1, 0); diff --git a/Cigarette/cigarette.cpp b/Cigarette/cigarette.cpp index 80bbe50..cce6c7d 100644 --- a/Cigarette/cigarette.cpp +++ b/Cigarette/cigarette.cpp @@ -1928,6 +1928,11 @@ bool Cigarette::read_sys_config(SysConf &conf) /// ͼƬ趨Сռֵ conf.freesize = atoi(line.substr(pos + 1).c_str()); } + else if (tmp_key == "ComPort") + {/// COM + conf.ComPort = line.substr(pos + 1); + } + else if (tmp_key == "AUTO_OPEN") { /// ǷԶ01 conf.auto_open = atoi(line.substr(pos + 1).c_str()); diff --git a/Cigarette/common.h b/Cigarette/common.h index 9d91cd6..1cc62d8 100644 --- a/Cigarette/common.h +++ b/Cigarette/common.h @@ -41,6 +41,7 @@ public: int MisMatchAct; //λΪ1NG,0ok int save_days; ///Ƭ int freesize; /// 趨ͼƬСռ + std::string ComPort; ///COM int auto_open; //ǷԶ01 int auto_work; //ǷԶʼ01 int auto_shift; //ǷԶ࣬01 @@ -66,13 +67,14 @@ public: //MonitorPort+NumberOfSupportedCamerasΪͼ˿ //MonitorPort+NumberOfSupportedCameras*2Ϊ˿,ҲFeedbackPort //MonitorPort+NumberOfSupportedCameras*2+1Ϊ˿ - + SysConf() { save=0; //ͼƬǷ񱣴棬0棬1NG, 2ȫ MisMatchAct=1; //λΪ1NG,0ok save_days = 1; ///Ƭ freesize = 10; + ComPort = "COM1"; auto_open=1; //ǷԶ01 auto_work=1; //ǷԶʼ01 auto_shift=0; //ǷԶ࣬01 @@ -97,6 +99,7 @@ public: } MonitorIP = "192.168.10.1"; FeedbackPort = MonitorPort + NumberOfSupportedCameras*2; + } }; diff --git a/Cigarette/threadSend.h b/Cigarette/threadSend.h index b7c8924..fa52929 100644 --- a/Cigarette/threadSend.h +++ b/Cigarette/threadSend.h @@ -11,8 +11,8 @@ #include -#define image_width 80 -#define image_heigh 60 +#define image_width 160 +#define image_heigh 120 #define info_frame 1 #define speed_frame 2 diff --git a/Cigarette/workthread.cpp b/Cigarette/workthread.cpp index 1eeb335..b3874fc 100644 --- a/Cigarette/workthread.cpp +++ b/Cigarette/workthread.cpp @@ -141,7 +141,7 @@ void WorkThread::run() "/" + QString::number(local_camera_number + 1) + "/ALL/" + now_ts.toString("yyyy-MM-dd_HH-mm-ss_zzz_") + QString::number(local_camera_number + 1) + - "#" + "_" + QString::number(index + 1) + ".jpg"; + "#" + "_" + QString::number(index + 1) + ".bmp"; g_save_queue->put(std::make_pair(file_name.toStdString(), m)); } } @@ -182,7 +182,7 @@ void WorkThread::run() now_ts.toString("yyyy-MM-dd") + "/" + QString::number(local_camera_number + 1) + "/ng/" + QString::number(index)+ "/" + - now_ts.toString("yyyy-MM-dd_HH-mm-ss_zzz_") + "_" + QString::number(index) + ".jpg"; + now_ts.toString("yyyy-MM-dd_HH-mm-ss_zzz_") + "_" + QString::number(index) + ".bmp"; g_save_queue->put(std::make_pair(file_name.toStdString(), m)); m = vec_out[index].clone(); @@ -190,7 +190,7 @@ void WorkThread::run() now_ts.toString("yyyy-MM-dd") + "/" + QString::number(local_camera_number + 1) + "/ng_result/" + QString::number(index)+ "/" + - now_ts.toString("yyyy-MM-dd_HH-mm-ss_zzz_") + "_" + QString::number(index) + ".jpg"; + now_ts.toString("yyyy-MM-dd_HH-mm-ss_zzz_") + "_" + QString::number(index) + ".bmp"; g_save_queue->put(std::make_pair(file_name.toStdString(), m)); } } diff --git a/conf/conf.txt b/conf/conf.txt index 22faff8..eb21086 100644 --- a/conf/conf.txt +++ b/conf/conf.txt @@ -2,73 +2,74 @@ SAVE=0 MISMATCHACT=1 SAVE_DAYS=1 FREESIZE=10 +ComPort=COM2 AUTO_OPEN=1 AUTO_WORK=1 AUTO_SHIFT=0 TIMING_SHIFT=0 SHIFT_BYHAND=1 -SHIFT_A=0|0 -SHIFT_B=0|0 -SHIFT_C=0|0 -LOCATION=TESTTESTTEST -MODELPATH=D:/cameras8/0413/cigarette-8cameras/model/jd.weights -JPGPATH=D:/cigarette-8cameras/Cigarette/alg_jd.jpg +SHIFT_A=1|0 +SHIFT_B=2|0 +SHIFT_C=3|0 +LOCATION=CDTHV1.0 +MODELPATH=D:/model/jd.weights +JPGPATH=D:/Release455/alg_jd.jpg ***************************************** -EXPO1=2500 +EXPO1=500 GAIN1=0 FILTER1=500 USERID1=0 -NO1=1|1|1 -SHOOT1=3 +NO1=3|0|0 +SHOOT1=1 ***************************************** -EXPO2=2000 +EXPO2=500 GAIN2=0 FILTER2=500 USERID2=1 -NO2=1|1|1 -SHOOT2=3 +NO2=2|1|0 +SHOOT2=1 ***************************************** -EXPO3=2000 +EXPO3=500 GAIN3=0 FILTER3=500 USERID3=2 -NO3=1|1|1 -SHOOT3=3 +NO3=2|1|0 +SHOOT3=1 ***************************************** -EXPO4=2000 +EXPO4=500 GAIN4=0 FILTER4=500 USERID4=3 -NO4=1|1|1 -SHOOT4=3 +NO4=0|0|0 +SHOOT4=1 ***************************************** -EXPO5=2000 +EXPO5=555 GAIN5=0 FILTER5=500 -USERID5=255 +USERID5=4 NO5=0|0|0 -SHOOT5=3 +SHOOT5=1 ***************************************** -EXPO6=2000 +EXPO6=555 GAIN6=0 FILTER6=500 -USERID6=255 +USERID6=5 NO6=0|0|0 -SHOOT6=3 +SHOOT6=1 ***************************************** -EXPO7=2000 +EXPO7=555 GAIN7=0 FILTER7=500 -USERID7=255 +USERID7=6 NO7=0|0|0 -SHOOT7=3 +SHOOT7=1 ***************************************** -EXPO8=2000 -GAIN8=0 -FILTER8=500 -USERID8=255 +EXPO8=555 +GAIN8=2 +FILTER8=666 +USERID8=7 NO8=0|0|0 -SHOOT8=3 +SHOOT8=1 ***************************************** -MonitorIP=192.168.10.139 -MonitorPort=3000 +MonitorIP=192.168.1.118 +MonitorPort=1234 diff --git a/conf/modbus.txt b/conf/modbus.txt index d8abd67..2085fa2 100644 --- a/conf/modbus.txt +++ b/conf/modbus.txt @@ -1,9 +1,15 @@ -KICK1=46006 -KICK2=46006 +KICK1=46112 +KICK2=46114 +KICK3=46116 +KICK4=46118 +KICK5=46120 +KICK6=46122 +KICK7=46124 +KICK8=46126 QUANTITY=46008 SHIFT=30100 WORK=30101 -NO_KICK=30102 +NO_KICK=37102 DEBUG=30103 RESET=30104 ALARM=46018 \ No newline at end of file diff --git a/conf/plc.txt b/conf/plc.txt index a6c6edf..72a2925 100644 --- a/conf/plc.txt +++ b/conf/plc.txt @@ -1,21 +1,27 @@ +ʵʹ|0|0|******************** +ٶ|46712|6000|Χ0Hz~200KHz +УON|47000|450| +УOFF|47002|900|½ +1#1ON|47004|500| +1#1OFF|47006|520|½ +1#2ON|47008|1650| +1#2OFF|47010|1670|½ +1#3ON|47012|1800| +1#3OFF|47014|1820|½ +ֳ޸|0|0|******************** ʼ/ͣ|30101|0|1ʼ0ͣ |46018|0|0ޱο -|46008|0|Сģʽ +|46008|0| +޳|46004|0|NG |30100|0|д1 -1#޳|46006|0|1#޳ -1#У|47000|450| -1#У|47002|510|½ -1#1|47004|550| -1#1|47006|620|½ -1#2|47008|700| -1#2|47010|800|½ -1#3|47012|820| -1#3|47014|880|½ -2#У|47100|450| -2#У|47102|510|½ -2#1|47104|550| -2#1|47106|620|½ -2#2|47108|700| -2#2|47110|800|½ -2#3|47112|820| -2#3|47114|880|½ +ͣ|46718|20|NG +ӲԼ쿪|37105|0|д1ر/0򿪣һĶ +|37106|1|д1ر/0򿪣 +⿪|37107|1|д1ر/0򿪣 +Դʱ|46710|50|Ĭ5 +ԴͨѶ|30160|0|д1ͨѶ +1ͨ|46600|80|Χ0~255 +2ͨ|46610|80|Χ0~255 +3ͨ|46620|111|Χ0~255 +4ͨ|46630|111|Χ0~255 + diff --git a/conf/rotate.txt b/conf/rotate.txt index ee1035c..ac242eb 100644 --- a/conf/rotate.txt +++ b/conf/rotate.txt @@ -1 +1 @@ -0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3, \ No newline at end of file +1,2,1,3,1,2,1,0,1,3,1,3,1,3,1,3, \ No newline at end of file diff --git a/conf/说明.txt b/conf/说明.txt new file mode 100644 index 0000000..8c5146e --- /dev/null +++ b/conf/说明.txt @@ -0,0 +1 @@ +此文件夹文件请根据现场情况进行更改 \ No newline at end of file