| EdgeInspector_App/Define/Global_Define.h | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| EdgeInspector_App/EdgeInspector_App.rc | 补丁 | 查看 | 原始文档 | blame | 历史 | |
| EdgeInspector_App/MainFrm.cpp | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| EdgeInspector_App/MainFrm.h | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| EdgeInspector_App/View/ViewMain_ScanImage.cpp | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| EdgeInspector_App/View/ViewMain_ScanImage.h | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
EdgeInspector_App/Define/Global_Define.h
@@ -114,10 +114,11 @@ enum Procee_Mode { PROC_MODE_AUTO = 0, PROC_MODE_SIMULATION_SIDERIP, PROC_MODE_SIMULATION_ONESIDE, PROC_MODE_SIMULATION_SIDESHORT, PROC_MODE_SIMULATION_SIDELONG, PROC_MODE_SIMULATION_ALL PROC_MODE_SIMULATION_ALL, }; enum Init_View_Command {VIEW_RECIPE=0,VIEW_SCANIMAGE}; EdgeInspector_App/EdgeInspector_App.rcBinary files differ
EdgeInspector_App/MainFrm.cpp
@@ -359,9 +359,10 @@ switch(iProceMode) { case 0: g_pBase->m_eProcessMode = PROC_MODE_SIMULATION_SIDELONG; break; case 0: g_pBase->m_eProcessMode = PROC_MODE_SIMULATION_SIDERIP; break; case 1: g_pBase->m_eProcessMode = PROC_MODE_SIMULATION_SIDESHORT; break; case 2: g_pBase->m_eProcessMode = PROC_MODE_SIMULATION_ALL; break; case 2: g_pBase->m_eProcessMode = PROC_MODE_SIMULATION_SIDELONG; break; case 3: g_pBase->m_eProcessMode = PROC_MODE_SIMULATION_ALL; break; } AfxBeginThread(ManualInspectProcess,this); @@ -429,26 +430,44 @@ pMain->ScanStartManual(iCam,iScan, TRUE); } break; case PROC_MODE_SIMULATION_SIDERIP: { std::vector<DimensionDir> vecDirs = { DIMENSION_A_RIP, DIMENSION_B_RIP, DIMENSION_C_RIP, DIMENSION_D_RIP }; pMain->Simulate2PhaseScanByDirs(vecDirs, 1000); } break; case PROC_MODE_SIMULATION_SIDESHORT: { pMain->m_GlassData.SetScanStartCount(MAX_CAMERA_COUNT); pMain->SendGlassRecipe(); for(iCam=0;iCam<MAX_CAMERA_COUNT;iCam++) { pMain->ScanStartGrabManual(iCam,0); pMain->ScanStartManual(iCam,0); } //pMain->m_GlassData.SetScanStartCount(MAX_CAMERA_COUNT); //pMain->SendGlassRecipe(); //for(iCam=0;iCam<MAX_CAMERA_COUNT;iCam++) //{ // pMain->ScanStartGrabManual(iCam,0); // pMain->ScanStartManual(iCam,0); //} std::vector<DimensionDir> vecDirs = { DIMENSION_B, DIMENSION_D, DIMENSION_B_DN, DIMENSION_D_DN }; pMain->Simulate2PhaseScanByDirs(vecDirs, 1000); } break; case PROC_MODE_SIMULATION_SIDELONG: { pMain->m_GlassData.SetScanStartCount(MAX_CAMERA_COUNT); pMain->SendGlassRecipe(); for(iCam=0;iCam<MAX_CAMERA_COUNT;iCam++) { pMain->ScanStartGrabManual(iCam,1); pMain->ScanStartManual(iCam,1); } //pMain->m_GlassData.SetScanStartCount(MAX_CAMERA_COUNT); //pMain->SendGlassRecipe(); //for(iCam=0;iCam<MAX_CAMERA_COUNT;iCam++) //{ // pMain->ScanStartGrabManual(iCam,1); // pMain->ScanStartManual(iCam,1); //} std::vector<DimensionDir> vecDirs = { DIMENSION_A, DIMENSION_C, DIMENSION_A_DN, DIMENSION_C_DN }; pMain->Simulate2PhaseScanByDirs(vecDirs, 1000); } break; case PROC_MODE_SIMULATION_ALL: @@ -723,3 +742,107 @@ { WriteLogManager(str); } void CMainFrame::Simulate2PhaseScanByDirs(const std::vector<DimensionDir>& vDirs, int nTimeoutMs /*=0 表示取配方时间*/) { struct SCamScan { int cam; int scan; }; if (vDirs.empty()) { g_pLog->DisplayMessage(_T("No valid directions provided for simulation.")); return; } if (m_pView == NULL) { g_pLog->DisplayMessage(_T("View is not initialized.")); return; } if (m_bManualProcessStart) { g_pLog->DisplayMessage(_T("Manual process is already running.")); return; } std::vector<SCamScan> phase0; // scan == 0 std::vector<SCamScan> phase1; // scan == 1 for (DimensionDir dir : vDirs) { int nCam = m_HardwareRecipe.GetCameraIndexToDimension(dir); if (nCam < 0) { continue; // 未配置该方向 } int nScan = m_HardwareRecipe.GetScanToDimension(dir); if (nScan != 0 && nScan != 1) { continue; // 只支持两相扫描 } if (nScan == 0) { phase0.push_back({ nCam, 0 }); } else if (nScan == 1) { phase1.push_back({ nCam, 1 }); } } SendGlassRecipe(); if (!phase0.empty() && !phase1.empty()) { if (m_pThread_CheckSequence != NULL) { double dOneScanTime = m_GlassRecipe.m_RecieParm.m_dOneScanTime_sec; m_pThread_CheckSequence->AddCheckSeqMSG(CHECKSEQ_GLASS_INSPECTION_OVERTIME, (int)(dOneScanTime * nTimeoutMs), m_HardwareRecipe.GetScanCount() - 1); g_pLog->DisplayMessage(_T("Simulation Time Out Set : %.1f"), dOneScanTime); } // nScan == 0 if (!phase0.empty()) { m_GlassData.SetScanStartCount((int)phase0.size()); for (const auto& cs : phase0) { ScanStartGrabManual(cs.cam, cs.scan); ScanStartManual(cs.cam, cs.scan); } } if (!phase0.empty() && !phase1.empty()) { DWORD sTime = GetTickCount(); while (TRUE) { if (m_GlassData.GetScanEnd(0) == TRUE) { break; } if (GetTickCount() - sTime > 5000) { break; } Sleep(10); } // nScan == 1 if (!phase1.empty()) { m_GlassData.SetScanStartCount((int)phase1.size()); for (const auto& cs : phase1) { ScanStartGrabManual(cs.cam, cs.scan); ScanStartManual(cs.cam, cs.scan); } } } } else { // nScan == 0 if (!phase0.empty()) { m_GlassData.SetScanStartCount((int)phase0.size()); for (const auto& cs : phase0) { ScanStartGrabManual(cs.cam, cs.scan); ScanStartManual(cs.cam, cs.scan); } } // nScan == 1 if (!phase1.empty()) { m_GlassData.SetScanStartCount((int)phase1.size()); for (const auto& cs : phase1) { ScanStartGrabManual(cs.cam, cs.scan); ScanStartManual(cs.cam, cs.scan); } } } } EdgeInspector_App/MainFrm.h
@@ -57,6 +57,7 @@ public: void SetView(CEdgeInspector_AppView *pView); void Simulate2PhaseScanByDirs(const std::vector<DimensionDir>& vDirs, int nTimeoutMs = 0); protected: void KillProcessByName(LPCTSTR lpProcessName); EdgeInspector_App/View/ViewMain_ScanImage.cpp
@@ -10,7 +10,8 @@ enum TYPE_MANUAL_CMD { M_CMD_PROC_SHORT_START = 0, M_CMD_PROC_RIP_START = 0, M_CMD_PROC_SHORT_START, M_CMD_PROC_LONG_START, M_CMD_PROC_ALL_START, M_CMD_IMG_LOAD_ALL, @@ -263,12 +264,10 @@ void CViewMain_ScanImage::OnShowWindow(BOOL bShow, UINT nStatus) { if(bShow == TRUE) { if(bShow == TRUE) { int nSide; CString strTitle; for(int i = 0 ; i < MAX_PANEL_SIDE * UPDN_TYPE; i++) { for(int i = 0 ; i < MAX_PANEL_SIDE * UPDN_TYPE; i++) { nSide = GetSideIdx(i); m_frameImg[i].SetSideIdx(nSide); m_frameImg[i].SetGlassData(m_pGlassData); @@ -278,15 +277,15 @@ m_frameImg[i].Invalidate(); if(m_pHardware != NULL) { CCameraSettings *pCamera = LiveGetSideIdx(i); CCameraSettings *pCamera = GetCameraSettingsByViewIndex(i); if(pCamera != NULL) { double dPixelSizeX = pCamera->m_dConvResolution[0]; double dPixelSizeY = pCamera->m_dScanResolution[0]; m_frameImg[i].SetPixelSize(dPixelSizeX, dPixelSizeY); } strTitle.Format(_T("BORD[%d] CHANNEL[%d]"),pCamera->m_iCamera, 0); m_staticCamInfo[i].SetWindowText(strTitle); } } } @@ -1189,8 +1188,9 @@ CViewMain_ScanImage *pDlg = (CViewMain_ScanImage*)pParam; int i =0; if(pDlg->m_nThreadCmd == M_CMD_PROC_ALL_START || pDlg->m_nThreadCmd == M_CMD_PROC_LONG_START || pDlg->m_nThreadCmd == M_CMD_PROC_SHORT_START || pDlg->m_nThreadCmd == M_CMD_PROC_LONG_START) || pDlg->m_nThreadCmd == M_CMD_PROC_RIP_START) { pDlg->m_IV2M->IV2M_InspectionProcessAll(pDlg->m_nThreadCmd); } @@ -1303,9 +1303,9 @@ ManualThreadStart(M_CMD_PROC_SHORT_START); break; //case 3: // ManualThreadStart(M_CMD_PROC_RIP_START); // break; case 3: ManualThreadStart(M_CMD_PROC_RIP_START); break; } } @@ -1364,32 +1364,30 @@ } } CCameraSettings* CViewMain_ScanImage::LiveGetSideIdx(int nViewIndex) CCameraSettings* CViewMain_ScanImage::GetCameraSettingsByViewIndex(int nViewIndex) { CCameraSettings* pCamera = NULL; if (m_pHardware != nullptr) { int nSide = GetSideIdx(nViewIndex); int nCamera = m_pHardware->GetCameraIndexToDimension((DimensionDir)nSide); if (nViewIndex < MAX_PANEL_SIDE) { // Long side pCamera = m_pHardware->GetCameraSettings(nCamera, 0); } else if (nViewIndex < 2 * MAX_PANEL_SIDE) { // Short side pCamera = m_pHardware->GetCameraSettings(nCamera, 1); } else { // Rip side int nRipIndex = nViewIndex - 2 * MAX_PANEL_SIDE; int nRipCamera = nRipIndex / 2 + MAX_PANEL_SIDE; if (nRipIndex % 2 != 0) { pCamera = m_pHardware->GetCameraSettings(nCamera, 0); } else { pCamera = m_pHardware->GetCameraSettings(nCamera, 1); } } if (nullptr != m_pHardware) { return pCamera; } return pCamera; // ViewIndex -> DimensionDir static const DimensionDir SIDE_MAP[] = { DIMENSION_C, DIMENSION_C_DN, DIMENSION_A, DIMENSION_A_DN, DIMENSION_D, DIMENSION_D_DN, DIMENSION_B, DIMENSION_B_DN, DIMENSION_A_RIP, DIMENSION_B_RIP, DIMENSION_C_RIP, DIMENSION_D_RIP }; if (nViewIndex < 0 || nViewIndex >= _countof(SIDE_MAP)) { AfxMessageBox(_T("GetCameraSettingsByViewIndex: Invalid view index")); return nullptr; } DimensionDir eSide = SIDE_MAP[nViewIndex]; int nScan = m_pHardware->GetScanToDimension(eSide); int nCamera = m_pHardware->GetCameraIndexToDimension(eSide); return pCamera = m_pHardware->GetCameraSettings(nCamera, nScan); } EdgeInspector_App/View/ViewMain_ScanImage.h
@@ -107,7 +107,7 @@ void SaveFullImageAll(); void LayoutCameraGroup(int nStartIdx, int nCount, CPoint& pt, int nImgWidth, int nImgHeight, int nInfo, int nHScroll); void ShowCameraGroup(int nStartIdx, int nCount, BOOL bShow); CCameraSettings* LiveGetSideIdx(int nViewIndex); CCameraSettings* GetCameraSettingsByViewIndex(int nViewIndex); protected: CMFCButton m_btnLoad[MAX_PANEL_SIDE * UPDN_TYPE];