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") { /// 是否自动打开相机:0否;1是 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; //错位行为,1:NG,0:ok int save_days; ///照片保存天数 int freesize; /// 设定清理图片最小空间 + std::string ComPort; ///COM口 int auto_open; //是否自动打开相机,0否,1是 int auto_work; //是否自动开始工作,0否,1是 int auto_shift; //是否自动换班,0否,1是 @@ -66,13 +67,14 @@ public: //MonitorPort+NumberOfSupportedCameras为图像端口 //MonitorPort+NumberOfSupportedCameras*2为发送命令端口,也就是FeedbackPort //MonitorPort+NumberOfSupportedCameras*2+1为接受命令端口 - + SysConf() { save=0; //图片是否保存,0不保存,1保存NG, 2全部保存 MisMatchAct=1; //错位行为,1:NG,0:ok save_days = 1; ///照片保存天数 freesize = 10; + ComPort = "COM1"; auto_open=1; //是否自动打开相机,0否,1是 auto_work=1; //是否自动开始工作,0否,1是 auto_shift=0; //是否自动换班,0否,1是 @@ -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