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