From 3259939c6f7e8e37a097ec81e2434e0d6061de89 Mon Sep 17 00:00:00 2001 From: CJ980606 <805250096@qq.com> Date: Thu, 1 Jun 2023 11:37:02 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E6=89=93=E5=BC=80/=E5=85=B3?= =?UTF-8?q?=E9=97=AD=E5=B7=B4=E6=96=AF=E5=8B=92=E7=9B=B8=E6=9C=BA=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cigarette.sln | 2 +- Cigarette/CaptureThreadBasler.cpp | 2 ++ Cigarette/cigarette.cpp | 14 +++++++++----- Cigarette/common.h | 2 +- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Cigarette.sln b/Cigarette.sln index 5741173..1126f22 100644 --- a/Cigarette.sln +++ b/Cigarette.sln @@ -36,7 +36,7 @@ Global HideSolutionNode = FALSE EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - Qt5Version = 5.15.2_msvc2019_64 SolutionGuid = {0AF1A30E-A12C-4014-ACD5-65A1E6D54D46} + Qt5Version = 5.15.2_msvc2019_64 EndGlobalSection EndGlobal diff --git a/Cigarette/CaptureThreadBasler.cpp b/Cigarette/CaptureThreadBasler.cpp index 3bb6176..4b2ffb3 100644 --- a/Cigarette/CaptureThreadBasler.cpp +++ b/Cigarette/CaptureThreadBasler.cpp @@ -141,6 +141,8 @@ void CaptureThreadBasler::process(void) #endif if (m_Timer) delete m_Timer; pDev_->StopGrabbing(); + pDev_->Close(); + pDev_->GrabCameraEvents = false; pDev_->DeregisterConfiguration(&CfgEvent); pDev_->DeregisterImageEventHandler(&ImageEvent); #ifndef USB_BASLER_NEW_FW diff --git a/Cigarette/cigarette.cpp b/Cigarette/cigarette.cpp index a13b9cf..80bbe50 100644 --- a/Cigarette/cigarette.cpp +++ b/Cigarette/cigarette.cpp @@ -91,6 +91,7 @@ int g_lst_quantiy; // int quantity_stop_count; //产量不变的秒数 int g_seconds; int CurOpLabel; +bool onrestart = false; VOID BeforeWork(int shoot[]) { @@ -571,7 +572,7 @@ void Cigarette::Exit() rThread->stop(); delete rThread; #endif - qDebug() << "Close thread ";; + qDebug() << "Close thread "; if(m_PLCDevice) { m_PLCDevice->disconnect_plc(); @@ -581,6 +582,8 @@ void Cigarette::Exit() this->close(); Pylon::PylonTerminate(); + + } //暂停按钮 void Cigarette::on_btn_pause_released() @@ -688,9 +691,8 @@ void Cigarette::OnOp() //退出前执行 void Cigarette::OnExit() { - //emit sengMsgToClog("Close the Application."); + emit sengMsgToClog("Close the Application."); Exit(); - exit(1);/// } void Cigarette::OnRestart() @@ -2996,11 +2998,11 @@ bool Cigarette::ControlCamOpenOrClose(int Num,bool OpenOrClose) } } Pylon::CBaslerUniversalInstantCamera* baslerCamera = BaslerCamHandle[Num]; - if(baslerCamera && baslerCamera->IsOpen()) + /*if(baslerCamera && baslerCamera->IsOpen()) { baslerCamera->Close(); baslerCamera->GrabCameraEvents = false; - } + }*/ DeleteElement(pBaslerCaptureThread[Num]); DeleteElement(pThread[Num]); SingleCamInfo[Num].IsOpen = false; @@ -3643,7 +3645,9 @@ void Cigarette::recMsgFromUdp(QString data) } else if (data == "RESTART") { + onrestart = true; OnRestart(); + onrestart = false; } else if (data == "GETSETTING") { diff --git a/Cigarette/common.h b/Cigarette/common.h index 0c4f922..9d91cd6 100644 --- a/Cigarette/common.h +++ b/Cigarette/common.h @@ -19,7 +19,7 @@ //#define CAP_FEED_BACK //拍照时也检测有没有测试结果,有的话就反馈 //#define DOUBLE_FEED_BACK //一次ng,两次反馈ng信号 #endif -#define identify_Hik_YSXID//识别海康相机YSXID +//#define identify_Hik_YSXID//识别海康相机YSXID #define Queue_Size 15 #define Unit_Queue_Size Queue_Size*3