解决打开/关闭巴斯勒相机失败问题

1600-900
CJ980606 2 years ago
parent 083f23904e
commit 3259939c6f

@ -36,7 +36,7 @@ Global
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
Qt5Version = 5.15.2_msvc2019_64
SolutionGuid = {0AF1A30E-A12C-4014-ACD5-65A1E6D54D46} SolutionGuid = {0AF1A30E-A12C-4014-ACD5-65A1E6D54D46}
Qt5Version = 5.15.2_msvc2019_64
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal

@ -141,6 +141,8 @@ void CaptureThreadBasler::process(void)
#endif #endif
if (m_Timer) delete m_Timer; if (m_Timer) delete m_Timer;
pDev_->StopGrabbing(); pDev_->StopGrabbing();
pDev_->Close();
pDev_->GrabCameraEvents = false;
pDev_->DeregisterConfiguration(&CfgEvent); pDev_->DeregisterConfiguration(&CfgEvent);
pDev_->DeregisterImageEventHandler(&ImageEvent); pDev_->DeregisterImageEventHandler(&ImageEvent);
#ifndef USB_BASLER_NEW_FW #ifndef USB_BASLER_NEW_FW

@ -91,6 +91,7 @@ int g_lst_quantiy; //
int quantity_stop_count; //产量不变的秒数 int quantity_stop_count; //产量不变的秒数
int g_seconds; int g_seconds;
int CurOpLabel; int CurOpLabel;
bool onrestart = false;
VOID BeforeWork(int shoot[]) VOID BeforeWork(int shoot[])
{ {
@ -571,7 +572,7 @@ void Cigarette::Exit()
rThread->stop(); rThread->stop();
delete rThread; delete rThread;
#endif #endif
qDebug() << "Close thread ";; qDebug() << "Close thread ";
if(m_PLCDevice) { if(m_PLCDevice) {
m_PLCDevice->disconnect_plc(); m_PLCDevice->disconnect_plc();
@ -581,6 +582,8 @@ void Cigarette::Exit()
this->close(); this->close();
Pylon::PylonTerminate(); Pylon::PylonTerminate();
} }
//暂停按钮 //暂停按钮
void Cigarette::on_btn_pause_released() void Cigarette::on_btn_pause_released()
@ -688,9 +691,8 @@ void Cigarette::OnOp()
//退出前执行 //退出前执行
void Cigarette::OnExit() void Cigarette::OnExit()
{ {
//emit sengMsgToClog("Close the Application."); emit sengMsgToClog("Close the Application.");
Exit(); Exit();
exit(1);///
} }
void Cigarette::OnRestart() void Cigarette::OnRestart()
@ -2996,11 +2998,11 @@ bool Cigarette::ControlCamOpenOrClose(int Num,bool OpenOrClose)
} }
} }
Pylon::CBaslerUniversalInstantCamera* baslerCamera = BaslerCamHandle[Num]; Pylon::CBaslerUniversalInstantCamera* baslerCamera = BaslerCamHandle[Num];
if(baslerCamera && baslerCamera->IsOpen()) /*if(baslerCamera && baslerCamera->IsOpen())
{ {
baslerCamera->Close(); baslerCamera->Close();
baslerCamera->GrabCameraEvents = false; baslerCamera->GrabCameraEvents = false;
} }*/
DeleteElement(pBaslerCaptureThread[Num]); DeleteElement(pBaslerCaptureThread[Num]);
DeleteElement(pThread[Num]); DeleteElement(pThread[Num]);
SingleCamInfo[Num].IsOpen = false; SingleCamInfo[Num].IsOpen = false;
@ -3643,7 +3645,9 @@ void Cigarette::recMsgFromUdp(QString data)
} }
else if (data == "RESTART") else if (data == "RESTART")
{ {
onrestart = true;
OnRestart(); OnRestart();
onrestart = false;
} }
else if (data == "GETSETTING") else if (data == "GETSETTING")
{ {

@ -19,7 +19,7 @@
//#define CAP_FEED_BACK //拍照时也检测有没有测试结果,有的话就反馈 //#define CAP_FEED_BACK //拍照时也检测有没有测试结果,有的话就反馈
//#define DOUBLE_FEED_BACK //一次ng两次反馈ng信号 //#define DOUBLE_FEED_BACK //一次ng两次反馈ng信号
#endif #endif
#define identify_Hik_YSXID//识别海康相机YSXID //#define identify_Hik_YSXID//识别海康相机YSXID
#define Queue_Size 15 #define Queue_Size 15
#define Unit_Queue_Size Queue_Size*3 #define Unit_Queue_Size Queue_Size*3

Loading…
Cancel
Save