V20251206-2.3.0

修复从missionResultHandle调用sql数据时异常的bug。
添加当存图线程缓存超过1g时会新开存图线程,上限8个。
修改操作detdata的图片容器时需要加锁。
This commit is contained in:
2025-12-06 15:13:39 +08:00
parent b17e09fe2d
commit 43538697ba
103 changed files with 1787 additions and 13174 deletions
@@ -19,7 +19,7 @@ int imgIndex = 0;
int getImageTimeOut = 3000;
QString lastError;
QMutex* m_mutex = nullptr;
std::mutex bufferMutex;
QMutex* bufferMutex = nullptr;
QQueue< cv::Mat> heightMatS;//高度图
QQueue<cv::Mat> luminanceMatS;//灰度图
//data == "rest_newProductIn"时要结束run;机台报警,取图超时,复位后重新拍的情况。
@@ -58,7 +58,7 @@ void myCallbackFunc(LJX8IF_PROFILE_HEADER* pProfileHeaderArray, WORD* pHeightPro
{
return;
}*/
std::lock_guard<std::mutex> lock(bufferMutex);
QMutexLocker lock(bufferMutex);
if (dwCount == 0)
{
return;
@@ -202,6 +202,7 @@ void destory(Hd_CameraModule_3DKeyence * ptr)
Hd_CameraModule_3DKeyence::Hd_CameraModule_3DKeyence()
{
m_mutex = new QMutex;
bufferMutex = new QMutex;
}
@@ -267,6 +268,11 @@ Hd_CameraModule_3DKeyence::~Hd_CameraModule_3DKeyence()
delete m_mutex;
m_mutex = nullptr;
}
if (bufferMutex)
{
delete bufferMutex;
bufferMutex = nullptr;
}
qDebug() << __FUNCTION__ << "line:" << __LINE__ << " delete success!";
}
@@ -423,7 +429,7 @@ bool Hd_CameraModule_3DKeyence::initParas(QByteArray& initData)
// Initialize
if (!InitHighSpeed()){
qDebug() << __FUNCTION__ << " line:" << __LINE__ << " InitHighSpeed error! " ;
lastError = "初始化高速通讯失败!";
lastError = "InitHighSpeed ERROR";
return false;
}
return true;
@@ -471,6 +477,8 @@ bool Hd_CameraModule_3DKeyence::InitHighSpeed()
}
bool Hd_CameraModule_3DKeyence::run()
{
@@ -488,23 +496,22 @@ bool Hd_CameraModule_3DKeyence::run()
while (imgTakeNum != imgTarget)
{
int sleepMs = 10;
int cnt = 0;
int timeoutCnt = getImageTimeOut / sleepMs;
while (_imageAvailable[deviceId] != 1 )
int cnt = 0;
while (_imageAvailable[deviceId] != 1 && cnt++ < timeoutCnt)
{
QThread::msleep(10);
if (cnt++ >= timeoutCnt)
{
heightMatS.push_back(cv::Mat(1000, 1000, CV_8UC1, cv::Scalar(0)));
luminanceMatS.push_back(cv::Mat(1000, 1000, CV_8UC1, cv::Scalar(0)));
imgTakeNum++;
qDebug() << "imgGetERROR insert blank img cameraID:" << camera_name;
continue;
}
QThread::msleep(sleepMs);
}
if (cnt >= timeoutCnt)
{
heightMatS.push_back(cv::Mat(1000, 1000, CV_8UC1, cv::Scalar(0)));
luminanceMatS.push_back(cv::Mat(1000, 1000, CV_8UC1, cv::Scalar(0)));
imgTakeNum++;
qDebug() << "insertBlack:" << camera_name;
continue;
}
std::lock_guard<std::mutex> lock(bufferMutex);
QMutexLocker lock(bufferMutex);
_getParam[deviceId].luminance_enabled = profileInfo_ptr->byLuminanceOutput;
_getParam[deviceId].x_pointnum = profileInfo_ptr->wProfileDataCount;
_getParam[deviceId].y_linenum_acquired = _lastImageSizeHeight[deviceId];