From be72a344954f46a40c96848071a10996fc4bf030 Mon Sep 17 00:00:00 2001
From: LWQ <1806950222@qq.com>
Date: 星期三, 13 八月 2025 19:17:08 +0800
Subject: [PATCH] 1.添加侧面检缺陷检测参数到配方

---
 EdgeInspector_App/ViewMain_Recipe.cpp    |   66 ++++++++++++++++++++++
 EdgeInspector_App/Recipe/GlassRecipe.h   |   13 ++++
 EdgeInspector_App/Recipe/GlassRecipe.cpp |   41 +++++++++++++
 EdgeInspector_App/BICommon.h             |    2 
 4 files changed, 119 insertions(+), 3 deletions(-)

diff --git a/EdgeInspector_App/BICommon.h b/EdgeInspector_App/BICommon.h
index 1688d1f..55e9bd0 100644
--- a/EdgeInspector_App/BICommon.h
+++ b/EdgeInspector_App/BICommon.h
@@ -11,7 +11,7 @@
 #define OFFLINE_KEY           1   //OFFLINE_KEY:1鏄绾挎ā寮�;0鏄湪绾挎ā寮�
 #define MINI_LED              0   //Mini杞﹂棿
 #define MINI_NOTCH			  0   //Mini杞﹂棿, 鏄惁浣跨敤鍒绘Ы鍔熻兘
-#define HALCON_VISION_KEY     0   //鏄惁鍚敤HALCON
+#define HALCON_VISION_KEY     1   //鏄惁鍚敤HALCON
 #define USE_WEBSOCKET         0   //鏄惁鍚敤websocket(AI)
 #define USE_AI_DETECT         0   //鏄惁鍚敤AI妫�娴�
 
diff --git a/EdgeInspector_App/Recipe/GlassRecipe.cpp b/EdgeInspector_App/Recipe/GlassRecipe.cpp
index df73d2e..c63c435 100644
--- a/EdgeInspector_App/Recipe/GlassRecipe.cpp
+++ b/EdgeInspector_App/Recipe/GlassRecipe.cpp
@@ -1714,15 +1714,21 @@
 
 void CRIP_THICKNESS_PARM::Reset()
 {
-	m_bUseInspect = FALSE;
+	m_bUseInspect = m_bRipUseInspect= FALSE;
 	m_nLeftThres = m_nRightThres = m_nGlassThres = 0;
 	m_nRipDir = 0;
 	m_nRectLeft = m_nRectRight = 0;
 	m_nTopOffset = m_nBottomOffset = 0;
+	m_nRipInspect_Range_um = m_nRipInspect_SideLine_Offset_um=0;
+	m_nRipMin_Threshold = 0;
+		m_nRipMax_Threshold= 0;
 
 	m_nGlassSizeMin_um = 0;  m_nGlassSizeMax_um = 0;
 	m_nLeftRipSizeMin_um = 0; m_nLeftRipSizeMax_um = 0;
 	m_nRightRipSizeMin_um = 0; m_nRightRipSizeMax_um = 0;
+	m_nRipJudge_Size_Min_X_um = 0; m_nRipJudge_Size_Min_Y_um = 0;
+	m_nRipJudge_Size_Min_OR_AND = 0;
+
 }
 
 BOOL CRIP_THICKNESS_PARM::ReadRecipe(CConfig* pFile, int nSideIdx)
@@ -1754,6 +1760,16 @@
 	pFile->GetItemValue(nSideIdx, k, m_nRectRight, 0);
 	k = _T("RipThk_m_nBottomOffset");
 	pFile->GetItemValue(nSideIdx, k, m_nBottomOffset, 0);
+	k = _T("RipThk_m_bRipUseInspect");
+	pFile->GetItemValue(nSideIdx, k, m_bRipUseInspect, 0);
+	k = _T("RipThk_m_nRipInspect_Range_um");
+	pFile->GetItemValue(nSideIdx, k, m_nRipInspect_Range_um, 0);
+	k = _T("RipThk_m_nRipInspect_SideLine_Offset_um");
+	pFile->GetItemValue(nSideIdx, k, m_nRipInspect_SideLine_Offset_um, 0);
+	k = _T("RipThk_m_nRipMin_Threshold");
+	pFile->GetItemValue(nSideIdx, k, m_nRipMin_Threshold, 20);
+	k = _T("RipThk_m_nRipMax_Threshold");
+	pFile->GetItemValue(nSideIdx, k, m_nRipMax_Threshold, 255);
 	k = _T("RipThk_m_nGlassSizeMin_um");
 	pFile->GetItemValue(nSideIdx, k, m_nGlassSizeMin_um, 0);
 	k = _T("RipThk_m_nGlassSizeMax_um");
@@ -1766,6 +1782,13 @@
 	pFile->GetItemValue(nSideIdx, k, m_nRightRipSizeMin_um, 0);
 	k = _T("RipThk_m_nRightRipSizeMax_um");
 	pFile->GetItemValue(nSideIdx, k, m_nRightRipSizeMax_um, 0);
+	k = _T("RipThk_m_nRipJudge_Size_Min_X_um");
+	pFile->GetItemValue(nSideIdx, k, m_nRipJudge_Size_Min_X_um, 0);
+	k = _T("RipThk_m_nRipJudge_Size_Min_Y_um");
+	pFile->GetItemValue(nSideIdx, k, m_nRipJudge_Size_Min_Y_um, 0);
+	k = _T("RipThk_m_nRipJudge_Size_Min_OR_AND");
+	pFile->GetItemValue(nSideIdx, k, m_nRipJudge_Size_Min_OR_AND, 0);
+	
 
 	return TRUE;
 }
@@ -1799,6 +1822,16 @@
 	pFile->SetItemValue(nSideIdx, k, m_nRectRight);
 	k = _T("RipThk_m_nBottomOffset");
 	pFile->SetItemValue(nSideIdx, k, m_nBottomOffset);
+	k = _T("RipThk_m_bRipUseInspect");
+	pFile->SetItemValue(nSideIdx, k, m_bRipUseInspect);
+	k = _T("RipThk_m_nRipInspect_Range_um");
+	pFile->SetItemValue(nSideIdx, k, m_nRipInspect_Range_um);
+	k = _T("RipThk_m_nRipInspect_SideLine_Offset_um");
+	pFile->SetItemValue(nSideIdx, k, m_nRipInspect_SideLine_Offset_um);
+	k = _T("RipThk_m_nRipMin_Threshold");
+	pFile->SetItemValue(nSideIdx, k, m_nRipMin_Threshold);
+	k = _T("RipThk_m_m_nRipMax_Threshold");
+	pFile->SetItemValue(nSideIdx, k, m_nRipMax_Threshold);
 	k = _T("RipThk_m_nGlassSizeMin_um");
 	pFile->SetItemValue(nSideIdx, k, m_nGlassSizeMin_um);
 	k = _T("RipThk_m_nGlassSizeMax_um");
@@ -1811,6 +1844,12 @@
 	pFile->SetItemValue(nSideIdx, k, m_nRightRipSizeMin_um);
 	k = _T("RipThk_m_nRightRipSizeMax_um");
 	pFile->SetItemValue(nSideIdx, k, m_nRightRipSizeMax_um);
+	k = _T("RipThk_m_nRipJudge_Size_Min_X_um");
+	pFile->SetItemValue(nSideIdx, k, m_nRipJudge_Size_Min_X_um);
+	k = _T("RipThk_m_nRipJudge_Size_Min_Y_um");
+	pFile->SetItemValue(nSideIdx, k, m_nRipJudge_Size_Min_Y_um);
+	k = _T("RipThk_m_nRipJudge_Size_Min_OR_AND");
+	pFile->SetItemValue(nSideIdx, k, m_nRipJudge_Size_Min_OR_AND);
 
 	return TRUE;
 }
\ No newline at end of file
diff --git a/EdgeInspector_App/Recipe/GlassRecipe.h b/EdgeInspector_App/Recipe/GlassRecipe.h
index 925e993..b1de367 100644
--- a/EdgeInspector_App/Recipe/GlassRecipe.h
+++ b/EdgeInspector_App/Recipe/GlassRecipe.h
@@ -322,6 +322,7 @@
 struct CRIP_THICKNESS_PARM
 {
 	// Inspect
+	//RIP measure of precision
 	BOOL m_bUseInspect = FALSE;
 	int  m_nLeftThres = 0;
 	int  m_nRightThres = 0;
@@ -331,7 +332,14 @@
 	int  m_nTopOffset = 0;			// Inspect Top Offset
 	int  m_nRectRight = 0;			// Inspect Rect R
 	int  m_nBottomOffset = 0;       // Inspect Bottom Offset
-
+	// RIP chip detection
+	BOOL	m_bRipUseInspect = FALSE;
+	int		m_nRipInspect_Range_um=0;
+	int		m_nRipInspect_SideLine_Offset_um=0;
+	int		m_nRipMin_Threshold = 0;
+	int		m_nRipMax_Threshold = 0;
+	
+	
 	// Judgement
 	int  m_nGlassSizeMin_um = 0;
 	int  m_nGlassSizeMax_um = 0;
@@ -339,6 +347,9 @@
 	int  m_nLeftRipSizeMax_um = 0;
 	int  m_nRightRipSizeMin_um = 0;
 	int  m_nRightRipSizeMax_um = 0;
+	int	 m_nRipJudge_Size_Min_X_um = 0;
+	int	 m_nRipJudge_Size_Min_Y_um = 0;
+	int	 m_nRipJudge_Size_Min_OR_AND = 0;// 0 : No Use, 1 : OR, 2 : AND
 
 	void Reset();
 	BOOL ReadRecipe(CConfig* pFile, int nSideIdx);
diff --git a/EdgeInspector_App/ViewMain_Recipe.cpp b/EdgeInspector_App/ViewMain_Recipe.cpp
index 454f6e0..334aef1 100644
--- a/EdgeInspector_App/ViewMain_Recipe.cpp
+++ b/EdgeInspector_App/ViewMain_Recipe.cpp
@@ -2607,6 +2607,31 @@
 				m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
 				strTemp.Format(_T("%d"), rip.m_nBottomOffset);
 				m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
+
+				// 10.  RIP Inspect Use
+				m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
+				strTemp.Format(_T("%d"), rip.m_bRipUseInspect);
+				m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
+
+				// 11.  RIP Inspect Range
+				m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
+				strTemp.Format(_T("%d"), rip.m_nRipInspect_Range_um);
+				m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
+
+				// 12.  RIP Inspect SideLine Offset
+				m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
+				strTemp.Format(_T("%d"), rip.m_nRipInspect_SideLine_Offset_um);
+				m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
+
+				// 13.  RIP Min Threshold
+				m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
+				strTemp.Format(_T("%d"), rip.m_nRipMin_Threshold);
+				m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
+
+				// 14.  RIP Min Threshold
+				m_SideInspectInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
+				strTemp.Format(_T("%d"), rip.m_nRipMax_Threshold);
+				m_SideInspectInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
 			}
 		}
 
@@ -2815,6 +2840,26 @@
 				// 9. B Offset
 				strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
 				rip.m_nBottomOffset = _wtoi(strTemp);
+
+				// 10.  RIP Inspect Use
+				strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
+				rip.m_bRipUseInspect = _wtoi(strTemp);
+
+				// 11.  RIP Inspect Range
+				strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
+				rip.m_nRipInspect_Range_um = _wtoi(strTemp);
+
+				// 12.  RIP Inspect SideLine Offset
+				strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
+				rip.m_nRipInspect_SideLine_Offset_um = _wtoi(strTemp);
+
+				// 13.  RIP Min Threshold
+				strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
+				rip.m_nRipMin_Threshold = _wtoi(strTemp);
+
+				// 14.  RIP Min Threshold
+				strTemp = m_SideInspectInfo.GetItemText(nRowIdx++, nColIdx);
+				rip.m_nRipMax_Threshold = _wtoi(strTemp);
 			}
 		}
 	}
@@ -3000,6 +3045,18 @@
 				m_JudgementInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
 				strTemp.Format(_T("%d"), rip.m_nRightRipSizeMax_um);
 				m_JudgementInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
+				// 7. Rip chip Size Min um
+				m_JudgementInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
+				strTemp.Format(_T("%d"), rip.m_nRipJudge_Size_Min_X_um);
+				m_JudgementInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
+				// 8. Rip chip Size Max um
+				m_JudgementInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
+				strTemp.Format(_T("%d"), rip.m_nRipJudge_Size_Min_Y_um);
+				m_JudgementInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
+				// 9. Rip chip OR/AND
+				m_JudgementInfo.GetCell(nRowIdx, nColIdx)->SetBackClr(uCellColor);
+				strTemp.Format(_T("%d"), rip.m_nRipJudge_Size_Min_OR_AND);
+				m_JudgementInfo.SetItemText(nRowIdx++, nColIdx, strTemp);
 			}
 		}
 
@@ -3144,6 +3201,15 @@
 				// 6. Right Rip Size Max um
 				strTemp = m_JudgementInfo.GetItemText(nRowIdx++, nColIdx);
 				rip.m_nRightRipSizeMax_um = _wtoi(strTemp);
+				// 7. Rip chip Size Min um
+				strTemp = m_JudgementInfo.GetItemText(nRowIdx++, nColIdx);
+				rip.m_nRipJudge_Size_Min_X_um = _wtoi(strTemp);
+				// 8. Rip chip Size Max um
+				strTemp = m_JudgementInfo.GetItemText(nRowIdx++, nColIdx);
+				rip.m_nRipJudge_Size_Min_Y_um = _wtoi(strTemp);
+				// 9. Rip chip OR/AND
+				strTemp = m_JudgementInfo.GetItemText(nRowIdx++, nColIdx);
+				rip.m_nRipJudge_Size_Min_OR_AND = _wtoi(strTemp);
 			}
 		}
 	}

--
Gitblit v1.9.3