This commit is contained in:
rci
2024-10-11 10:07:08 +08:00
parent d86f8e86e3
commit 70ce6af45b
25 changed files with 5081 additions and 211 deletions
@@ -21,6 +21,7 @@ bool Logic_camera_thread::setModule( QString station_name,MyModule module,QJsonO
m_name = obj.value("相机key").toString();
m_type = "camera";// camera_obj.value("camera_type").toString();
getImgTimeout = obj.value("取图超时").toString().toInt();
maxCheckTime = obj.value("拍照信号-检查完成的时间").toString().toDouble();
if (m_name.isEmpty() || m_type.isEmpty())
{
qCritical() << "[Error] " << " camera_key or camera_type is null";
@@ -76,6 +77,7 @@ void Logic_camera_thread::set_m_stoprun(bool val)
QMutexLocker locker(ifMissImage_mutex); // 加锁
m_stoprun = val;
}
clock_t maxTime_start, maxTime_stop;
void Logic_camera_thread::run()
{
while (ifRun)
@@ -86,7 +88,7 @@ void Logic_camera_thread::run()
m_stoprun = false;
getImg_faileNums = 0;
ifsaveImage = false;
//set_ifMissImage(false);
set_ifMissImage(false);
cu_runNum = 0;
int last_addImageNums = addImageNums;
maxTime_start = clock();
@@ -288,14 +290,9 @@ bool Logic_camera_thread::runCameraModule()
//QMutexLocker locker(ifMissImage_mutex); // 加锁
QByteArray task_name;
std::vector<cv::Mat> camera_mat;
if (CommunicationProcessLevel == 2 && waitenum++%100==0)
{
//missImgae_addImage(camera_mat);
qCritical() << __FUNCTION__ << " line:" << __LINE__ << " m_name:" << m_name << " waite trigger!"<< waitenum;
}
if (CommunicationProcessLevel == 2 && maxTime_stop - maxTime_start > maxCheckTime)
{
qCritical() << __FUNCTION__ << " line:" << __LINE__ << "maxCheckTime! add img, hardware" << m_Module.module_key;
qCritical() << __FUNCTION__ << " line:" << __LINE__ << " m_name:" << m_name << " maxTime_stop - maxTime_start > maxCheckTime,missImgae_addImage!";
missImgae_addImage(camera_mat);
}
else
@@ -306,16 +303,8 @@ bool Logic_camera_thread::runCameraModule()
{
Sleep(10);
qApp->processEvents();
myTime += 10;
if (myTime % 1000 == 0)
{
if (CommunicationProcessLevel == 2)
{
//missImgae_addImage(camera_mat);
qCritical() << __FUNCTION__ << " line:" << __LINE__ << " m_name:" << m_name << " waite trigger!";
}
}
if (myTime > maxCheckTime)
maxTime_stop = clock();
if (maxTime_stop - maxTime_start > getImgTimeout)
{
if (CommunicationProcessLevel == 2)
{
@@ -488,12 +477,12 @@ void Logic_camera_thread::setMutex(QMutex *mutex)
m_mutex = new QMutex;// mutex;
}
bool Logic_camera_thread::sendDataCommond( QString m_type,cv::Mat mat,QByteArray byteArray )
bool Logic_camera_thread::sendDataCommond( QString m_type,cv::Mat mat,QByteArray byteArray)
{
QMutexLocker locker(m_mutex);
dataPack m_pack;
m_pack.mat = mat;
m_pack.byteArray = byteArray;
m_pack.byteArray = byteArray;
m_pack.retFlag = m_type;
m_pack.cameraName = m_name;