#include "StdAfx.h"
|
#include <math.h>
|
#include "crtdbg.h"
|
#include <experimental/filesystem>
|
|
#include "ReviewInterface.h"
|
#include "MainFrm.h"
|
#include "CHReviewSetting/SystemInfo.h"
|
#include "CHReviewSetting/Sys_SystemManager.h"
|
#include "CHReviewSetting/Sys_GlassTypeManager.h"
|
#include "CHReviewSetting/Sys_AlignManager.h"
|
#include "CHReviewSetting/Sys_SignalManager.h"
|
#include "CHReviewSetting/Sys_MotorManager.h"
|
#include "CHReviewSetting/Sys_NetworkManager.h"
|
#include "CHReviewRecipe/Rcp_RsReviewManager.h"
|
#include "CHReviewRecipe/Rcp_RsMeasureManager.h"
|
#include "CHReviewRecipe/Rcp_RsAlignManager.h"
|
#include "CHReviewRecipe/Rcp_RsDefectFindManager.h"
|
|
#include "CHLightControls/LightControl_PlusTek_PLK2CHR.h"
|
#include "CHLightControls/LightControl_ShinHan_FLS2CHR.h"
|
#include "CHLightControls/LightControl_PlusTek_STB64C.h"
|
#include "CHLightControls/LightControl_KSVision_PDSeries.h"
|
#include "CHLightControls/LightControl_Simulation.h"
|
#include "CHLightControls/LightControl_Byon_ERI2.h"
|
#include "CHLightControls/LightControl_ALT_2RSD.h"
|
#include "CHLightControls/LightControl_ALT_8RSDF.h"
|
#include "CHLightControls/LightControl_Shinhan_TCP.h"
|
#include "CHLightControls/LightControl_LFusion_PDSeries.h"
|
|
#include "CHLensChangeControls/LensChangeControl_LinearTurret.h"
|
#include "CHLensChangeControls/LensChangeControl_Nikon.h"
|
#include "CHLensChangeControls/LensChangeControl_DualTube.h"
|
#include "CHLensChangeControls/LensChangeControl_Simulation.h"
|
|
#include "CHAfmControls/AFMControl_DIT.h"
|
#include "CHAfmControls/AFMControl_Wegu.h"
|
#include "CHAfmControls/AFMControl_Msg.h"
|
#include "CHAfmControls/AFMControl_Simulation.h"
|
|
#include "CHMotorControls/MotorControl_eXcom.h"
|
#include "CHMotorControls/MotorControl_PowerPmac.h"
|
#include "CHMotorControls/MotorControl_Simulation.h"
|
#include "CHMotorControls/MotorControl_PowerPmacCmd.h"
|
#include "CHMotorControls/MotorControl_Acs.h"
|
|
#include "CHSignalControls/SignalControl_Simulation.h"
|
#include "CHSignalControls/SignalControl_MxComponent.h"
|
#include "CHSignalControls/SignalControl_DitSharedMemorySync.h"
|
|
#include "ReviewProcessor_CPJT.h"
|
#include "SequenceProcessor_CPJT.h"
|
|
//#include "CHWsiControls/WsiControl_Simulation.h"
|
#include "CHWsiControls/WsiControl_Dit.h"
|
|
#include "CHImageControls/CHImageProcess.h"
|
#include "CHPathScheduler/PathScheduler_TSP.h"
|
#include "CHPathScheduler/PathScheduler_Dual_Active_TSP.h"
|
|
#include "CHReviewPrioritySorter/PrioritySorter_CPJT.h"
|
#include "CHReviewPrioritySorter/PrioritySorter_Aps.h"
|
|
#include "CHDefectPicker/DefectPicker_Range.h"
|
|
//#include "akIPCNetAOISystem.h"
|
#include "akAOISharedSystem.h"
|
#include "DlgModuleInfo.h"
|
|
using namespace CHReviewResult;
|
using namespace CHImageControls;
|
|
CReviewInterface::CReviewInterface(void)
|
{
|
// pointer
|
m_pDoc = NULL;
|
m_pView = NULL;
|
|
// system value
|
m_bChangeSysConfig = FALSE;
|
|
// single control
|
m_pSignalControl = NULL; // Signal Control
|
m_pMotorControl = NULL; // Motor Control
|
m_pAlignServerControl = NULL; // Align Server Control
|
m_pAlignCameraControl = NULL; // Align Camera Control
|
m_pVCRControl = NULL; // VCR Control
|
m_pReviewProcessor = NULL; // Review Processor
|
m_pSequenceProcessor = NULL; // sequence processor
|
m_pPrioritySorter = NULL; // Review Priority Sorter
|
m_pDefectPicker = NULL; // Review Defect Picker
|
m_pReviewScheduler = NULL; // Review Scheduler
|
// m_pMeasureScheduler = NULL; // Measure Scheduler
|
m_pCoordCalibrator = NULL; // coordination calibrator
|
m_pSharedImageData = NULL; // shared image data
|
m_pResultServerControl = NULL; // Send Result to Server Control
|
m_pEdgeRecipeManager = NULL;
|
m_pVirtualGlassMap = NULL;
|
m_pTotalPitchMeasure = NULL;
|
m_pDiagnosisManager = NULL;
|
|
// multi control
|
m_vecReviewLightControl.clear(); // Review Light Control vector
|
m_vecAlignLightControl.clear(); // Align Light Control vector
|
m_vecRevolverControl.clear(); // Revolver Control vector
|
m_vecAFMControl.clear(); // AFM Control vector
|
m_vecWSIControl.clear(); // WSI Control vector
|
m_vecVCRControl.clear(); // VCR Control vector
|
m_vecReviewCameraControl.clear(); // Review Camera control vector
|
m_vecMotorCalibrator.clear(); // motor calibrator
|
|
// single variable
|
m_strProgramVersion = _T(""); // program version
|
m_ProcessTimer.End(); // process timer
|
|
// multi variable
|
m_vecModuleStatus.clear(); // Review Module Status Vector
|
|
// init Log
|
new CDisplayMessage(_REVIEW_SERVER_LOG_PATH_);
|
g_pLog->SetDM2P(static_cast<IDisplayMessage2Parent*>(this));
|
|
m_nCurrentWsiMode = 0;
|
m_bIsOffSetOn = 0;
|
m_bIsSimulation = 0;
|
|
m_bFirstReviewLeft = 0;
|
m_bFirstReviewRight = 0;
|
|
// cs init
|
InitializeCriticalSection(&m_csReviewResult);
|
InitializeCriticalSection(&m_csReviewSignal);
|
}
|
|
CReviewInterface::~CReviewInterface(void)
|
{
|
// cs deinit
|
DeleteCriticalSection(&m_csReviewSignal);
|
DeleteCriticalSection(&m_csReviewResult);
|
}
|
|
// Initialize
|
BOOL CReviewInterface::InitReviewInterface()
|
{
|
if (m_pDoc==NULL) return FALSE;
|
|
CreateDirectory(_REVIEW_SERVER_BASE_PATH_, NULL);
|
CreateDirectory(_REVIEW_SERVER_LOG_PATH_, NULL);
|
CreateDirectory(_REVIEW_SERVER_CONFIG_PATH_, NULL);
|
//LYW_#3344_CF AOI Review Config File 백업 기능 개선 ADD START
|
//시작할때 다 지우고 다시 복사가 필요할지
|
//std::experimental::filesystem::remove_all(_REVIEW_SERVER_SYSTEM_SETTING_BACKUP_PATH_CPJT);
|
//std::experimental::filesystem::remove_all(_REVIEW_RECIPE_BACKUP_PATH_CPJT);
|
ISP2P_CopyFolder(_REVIEW_SERVER_CONFIG_PATH_, _REVIEW_SERVER_SYSTEM_SETTING_BACKUP_PATH_CPJT);
|
ISP2P_CopyFolder(_REVIEW_RECIPE_PATH_, _REVIEW_RECIPE_BACKUP_PATH_CPJT);
|
//LYW_#3344_CF AOI Review Config File 백업 기능 개선 ADD END
|
SetProgramVersion();
|
|
// init review data
|
if (m_pDoc->InitReviewData()==FALSE)
|
{
|
AfxMessageBox(_T("SystemSetting File Read Error!"));
|
return FALSE;
|
}
|
|
// 시스템 세팅값 읽기
|
const CSystemInfo* pSystemInfo = m_pDoc->System_GetSystemInfo();
|
if(pSystemInfo==NULL)
|
{
|
AfxMessageBox(_T("SystemSetting is NULL!"));
|
return FALSE;
|
}
|
|
// live image
|
InitSharedImage();
|
|
// dialog
|
if(m_pView)
|
{
|
m_pView->CreateDialogs(pSystemInfo->m_nLineType, pSystemInfo->m_nMachineType, pSystemInfo->m_bUseVisionAlign);
|
}
|
|
// system type log : SW Version 추가
|
g_pLog->DisplayMessage(_T("Starting ReviewSystem Program! (%s)"), m_strProgramVersion);
|
|
CString strMessage = _T("");
|
switch(pSystemInfo->m_nLineType)
|
{
|
case SystemLine_CPJT:
|
strMessage += _T("Line: CPJT , ");
|
switch(pSystemInfo->m_nMachineType)
|
{
|
case SystemMachine_CPJT_QD:
|
strMessage += _T("System: CPJT QD");
|
break;
|
case SystemMachine_CPJT_RGB:
|
strMessage += _T("System: CPJT RGB1");
|
break;
|
case SystemMachine_CPJT_BANK:
|
strMessage += _T("System: CPJT BANK");
|
break;
|
case SystemMachine_CPJT_OC:
|
strMessage += _T("System: CPJT OC");
|
break;
|
case SystemMachine_CPJT_BDI:
|
strMessage += _T("System: CPJT BDI");
|
break;
|
case SystemMachine_CPJT_CS:
|
strMessage += _T("System: CPJT CS");
|
break;
|
default:
|
strMessage += _T("System: N/A");
|
break;
|
}
|
break;
|
default:
|
strMessage += _T("Line: N/A, ");
|
break;
|
}
|
|
g_pLog->DisplayMessage(strMessage);
|
|
// review camera control
|
m_ProcessTimer.Start();
|
if (InitReviewCamera())
|
{
|
ConnectReviewCamera();
|
}
|
m_ProcessTimer.End();
|
g_pLog->DisplayMessage(_T("ReviewCamera Init Time : %f ms"), m_ProcessTimer.GetDurationMilliSecond());
|
|
//-------------------------------------------------------------------------------------------------
|
// [2018/10/15 09:54:55 by jylee] related AOI Shared Memory
|
m_ProcessTimer.Start();
|
//InitAOISharedMemory();
|
m_ProcessTimer.End();
|
g_pLog->DisplayMessage(_T("AOI Shared Memory Init Time : %f ms"), m_ProcessTimer.GetDurationMilliSecond());
|
//-------------------------------------------------------------------------------------------------
|
|
// virtual glass map
|
InitVirtualGlassMap();
|
|
|
// AutoDiagnosis Manager
|
m_ProcessTimer.Start();
|
InitDiagnosisManager();
|
m_ProcessTimer.End();
|
g_pLog->DisplayMessage(_T("DiagnosisManager Init Time : %f ms"), m_ProcessTimer.GetDurationMilliSecond());
|
|
|
// Dialog AutoDiagnosis
|
InitDlgDiagnosis();
|
|
// review light control
|
m_ProcessTimer.Start();
|
InitReviewLightControl();
|
m_ProcessTimer.End();
|
g_pLog->DisplayMessage(_T("ReviewLight Init Time : %f ms"), m_ProcessTimer.GetDurationMilliSecond());
|
|
// revolver control
|
m_ProcessTimer.Start();
|
InitRevolverControl();
|
m_ProcessTimer.End();
|
g_pLog->DisplayMessage(_T("Revolver Init Time : %f ms"), m_ProcessTimer.GetDurationMilliSecond());
|
|
// afm control
|
m_ProcessTimer.Start();
|
InitAFMControl();
|
m_ProcessTimer.End();
|
g_pLog->DisplayMessage(_T("AFM Init Time : %f ms"), m_ProcessTimer.GetDurationMilliSecond());
|
|
// align server control
|
m_ProcessTimer.Start();
|
InitAlignServerControl();
|
m_ProcessTimer.End();
|
g_pLog->DisplayMessage(_T("AlignServer Init Time : %f ms"), m_ProcessTimer.GetDurationMilliSecond());
|
|
// align camera control
|
m_ProcessTimer.Start();
|
InitAlignCamera();
|
m_ProcessTimer.End();
|
g_pLog->DisplayMessage(_T("AlignCamera Init Time : %f ms"), m_ProcessTimer.GetDurationMilliSecond());
|
|
// align light control
|
m_ProcessTimer.Start();
|
InitAlignLightControl();
|
m_ProcessTimer.End();
|
g_pLog->DisplayMessage(_T("AlignLight Init Time : %f ms"), m_ProcessTimer.GetDurationMilliSecond());
|
|
// CoordCalibrator
|
InitCoordCalibrator();
|
|
// sequence processor
|
InitSequenceProcessor();
|
|
// review processor
|
InitReviewProcessor();
|
|
// review priority sorter
|
InitPrioritySorter();
|
|
// review defect picker
|
InitDefectPicker();
|
|
// review scheduler
|
InitReviewScheduler();
|
|
// Measure Scheduler
|
// InitMeasureScheduler();
|
|
// motor calibrator
|
InitMotorCalibrator();
|
|
// Result Server Control
|
// InitResultServerControl();
|
|
// edge triangle manager
|
InitEdgeRecipeManager();
|
|
// set default value
|
SetDefaultValue();
|
|
// create system directory
|
CreateSystemDirectory();
|
|
// signal control
|
m_ProcessTimer.Start();
|
InitSignalControl();
|
m_ProcessTimer.End();
|
g_pLog->DisplayMessage(_T("Signal Init Time : %f ms"), m_ProcessTimer.GetDurationMilliSecond());
|
|
// motor control
|
m_ProcessTimer.Start();
|
InitMotorControl();
|
m_ProcessTimer.End();
|
g_pLog->DisplayMessage(_T("Motor Conection Time : %f ms"), m_ProcessTimer.GetDurationMilliSecond());
|
|
// wsi control
|
m_ProcessTimer.Start();
|
InitWSIController();
|
m_ProcessTimer.End();
|
g_pLog->DisplayMessage(_T("WSI Init Time : %f ms"), m_ProcessTimer.GetDurationMilliSecond());
|
|
|
//totalpitch measure
|
InitTotalPitchMeasure();
|
|
UpdateConnectionStatus(m_pDoc->Etc_GetConnectionStatus());
|
|
if(pSystemInfo->m_bLongRun)
|
{
|
if(m_pView)
|
{
|
m_pView->CreateLongRunDialog();
|
}
|
}
|
|
return TRUE;
|
}
|
|
void CReviewInterface::DeinitReviewInterface()
|
{
|
TRACE(_T("[A2E]DeinitReviewInterface 시작\n"));
|
|
if (m_pView)
|
{
|
m_pView->DeleteDialogs();
|
}
|
|
ClearAllObserverVector();
|
g_pLog->DisplayMessage(_T("Clear all Observer Vectors"));
|
::Sleep(400);
|
|
m_ProcessTimer.Start();
|
DisconnectReviewCamera();
|
DeinitReviewCamera();
|
m_ProcessTimer.End();
|
g_pLog->DisplayMessage(_T("ReviewCamera Deinit Time : %f ms"), m_ProcessTimer.GetDurationMilliSecond());
|
|
m_ProcessTimer.Start();
|
DeinitAlignCamera();
|
m_ProcessTimer.End();
|
g_pLog->DisplayMessage(_T("AlignCamera Deinit Time : %f ms"), m_ProcessTimer.GetDurationMilliSecond());
|
|
m_ProcessTimer.Start();
|
DeinitAlignLightControl();
|
m_ProcessTimer.End();
|
g_pLog->DisplayMessage(_T("AlignLight Deinit Time : %f ms"), m_ProcessTimer.GetDurationMilliSecond());
|
|
m_ProcessTimer.Start();
|
DeinitReviewLightControl();
|
m_ProcessTimer.End();
|
g_pLog->DisplayMessage(_T("ReviewLight Deinit Time : %f ms"), m_ProcessTimer.GetDurationMilliSecond());
|
|
m_ProcessTimer.Start();
|
DeinitRevolverControl();
|
m_ProcessTimer.End();
|
g_pLog->DisplayMessage(_T("Revolver Deinit Time : %f ms"), m_ProcessTimer.GetDurationMilliSecond());
|
|
m_ProcessTimer.Start();
|
DeinitAFMControl();
|
m_ProcessTimer.End();
|
g_pLog->DisplayMessage(_T("AFM Deinit Time : %f ms"), m_ProcessTimer.GetDurationMilliSecond());
|
|
m_ProcessTimer.Start();
|
DeinitWSIController();
|
m_ProcessTimer.End();
|
g_pLog->DisplayMessage(_T("WSI Deinit Time : %f ms"), m_ProcessTimer.GetDurationMilliSecond());
|
|
DeinitAlignServerControl();
|
g_pLog->DisplayMessage(_T("Deinit Align Server Control"));
|
|
DeinitResultServerControl();
|
g_pLog->DisplayMessage(_T("Deinit Result Server Control"));
|
|
Sleep(500);
|
|
m_ProcessTimer.Start();
|
DeinitMotorControl();
|
m_ProcessTimer.End();
|
g_pLog->DisplayMessage(_T("Motor Deinit Time : %f ms"), m_ProcessTimer.GetDurationMilliSecond());
|
|
m_ProcessTimer.Start();
|
DeinitSignalControl();
|
m_ProcessTimer.End();
|
g_pLog->DisplayMessage(_T("Signal Deinit Time : %f ms"), m_ProcessTimer.GetDurationMilliSecond());
|
|
DeinitCoordCalibrator();
|
g_pLog->DisplayMessage(_T("Deinit Coord Calibrator"));
|
|
// [2018/10/15 09:56:10 by jylee] related AOI Shared Memory
|
// DeinitAOISharedMemory();
|
g_pLog->DisplayMessage(_T("Deinit AOI Shared Memory"));
|
|
DeinitMotorCalibrator();
|
g_pLog->DisplayMessage(_T("Deinit Motor Calibrator"));
|
|
DeinitReviewScheduler();
|
g_pLog->DisplayMessage(_T("Deinit Review Scheduler"));
|
|
// DeinitMeasureScheduler();
|
// g_pLog->DisplayMessage(_T("Deinit Measure Scheduler"));
|
|
DeinitDefectPicker();
|
g_pLog->DisplayMessage(_T("Deinit Review Defect Picker"));
|
|
DeinitPrioritySorter();
|
g_pLog->DisplayMessage(_T("Deinit Priority Sorter"));
|
|
DeinitReviewProcessor();
|
g_pLog->DisplayMessage(_T("Deinit Review Processor"));
|
|
DeinitSequenceProcessor();
|
g_pLog->DisplayMessage(_T("Deinit Seqeunce Processor"));
|
|
DeinitEdgeRecipeManager();
|
g_pLog->DisplayMessage(_T("Deinit EdgeTriangle Manager"));
|
|
DeinitVirtualGlassMap();
|
g_pLog->DisplayMessage(_T("Deinit Virtual Glass Map"));
|
|
DeinitDlgDiagnosis();
|
g_pLog->DisplayMessage(_T("Deinit Dialog Diagnosis"));
|
|
DeinitDiagnosisManager();
|
g_pLog->DisplayMessage(_T("Deinit DiagnosisManager"));
|
|
DeinitSharedImage();
|
g_pLog->DisplayMessage(_T("Deinit Shared Image"));
|
|
|
|
DeinitTotalPitchMeasure();
|
g_pLog->DisplayMessage(_T("Deinit TotalPitch Measure"));
|
|
// system log : SW Version 추가
|
g_pLog->DisplayMessage(_T("Exit! ReviewSystem Program! (%s)"), m_strProgramVersion);
|
|
TRACE(_T("[A2E]DeinitReviewInterface Exit!\n"));
|
}
|
|
void CReviewInterface::SetDefaultValue()
|
{
|
if (m_pDoc==NULL) return;
|
|
const CGlassTypeInfo* pGlassTypeInfo = m_pDoc->System_GetStandardGlassTypeInfo();
|
const CMotorControlInfo* pMotorInfo = m_pDoc->System_GetMotorInfo();
|
|
//기본 글라스 타입 적용
|
if(pGlassTypeInfo && pMotorInfo && m_pCoordCalibrator)
|
{
|
int nDirectionX = CSequenceProcessor::GetDirectionX(pGlassTypeInfo->m_nOriginDirection, pMotorInfo->GetOriginDirection());
|
int nDirectionY = CSequenceProcessor::GetDirectionY(pGlassTypeInfo->m_nOriginDirection, pMotorInfo->GetOriginDirection());
|
|
//좌표계 설정
|
m_pCoordCalibrator->SetTransDirection(nDirectionX, nDirectionY);
|
m_pCoordCalibrator->SetOriginMotorPosition(pGlassTypeInfo->m_dOriginMotorX, pGlassTypeInfo->m_dOriginMotorY);
|
|
if (fabs(pGlassTypeInfo->m_dAlignAngle) > 0.0000001)
|
{
|
m_pCoordCalibrator->SetRotationInfo(pGlassTypeInfo->m_dFirstAlignMotorX, pGlassTypeInfo->m_dFirstAlignMotorY,
|
pGlassTypeInfo->m_dFirstAlignGlassX, pGlassTypeInfo->m_dFirstAlignGlassY, pGlassTypeInfo->m_dAlignAngle);
|
}
|
|
int nTotalCount = 0;
|
CGlassResult* pGlassResult = m_pDoc->GlassResult_GetNewGlassResult(nTotalCount);
|
if(pGlassResult)
|
{
|
pGlassResult->SetGlassSize(pGlassTypeInfo->m_nGlassSizeX * 1000, pGlassTypeInfo->m_nGlassSizeY * 1000);
|
pGlassResult->SetGlassOriginDirection(pGlassTypeInfo->m_nOriginDirection);
|
pGlassResult->SetCornerCutDirection(pGlassTypeInfo->m_nCornerCutDirection);
|
|
if(m_pView)
|
{
|
m_pView->SetDefaultGlassType(pGlassResult);
|
m_pView->SetAlignResult(Align_None, pGlassTypeInfo->m_dOriginMotorX, pGlassTypeInfo->m_dOriginMotorY, pGlassTypeInfo->m_dAlignAngle);
|
}
|
}
|
}
|
|
//디폴트 기준 겐트리 카메라 선택
|
const CSystemInfo* pSystemInfo = m_pDoc->System_GetSystemInfo();
|
if(pSystemInfo)
|
{
|
int nModuleIdx = -1;
|
for(int nGantryIdx = 0; nGantryIdx < pSystemInfo->GetGantryInfoCount(); nGantryIdx++)
|
{
|
const CGantryInfo* pGantryInfo = pSystemInfo->GetGantryInfo(nGantryIdx);
|
|
if (pGantryInfo==NULL) continue;
|
if (pGantryInfo->m_bStandardGantry==FALSE) continue;
|
|
for (int nHeaderIdx=0; nHeaderIdx<pGantryInfo->GetHeaderInfoCount(); nHeaderIdx++)
|
{
|
nModuleIdx++;
|
|
const CHeaderInfo *pHeaderInfo = pGantryInfo->GetHeaderInfo(nHeaderIdx);
|
if (pHeaderInfo==NULL) continue;
|
if (pHeaderInfo->m_bStandardHeader==FALSE) continue;
|
|
DMI2P_SetSelectedModuleIndex(nModuleIdx);
|
}
|
break;
|
}
|
}
|
|
// 조명 기본값
|
|
// 얼라인 조명 기본값
|
|
// 리볼버 기본값
|
Revolver_SetRevolverLevel(0, 0);
|
|
// AFM 기본값
|
AFM_SetAFMZoomLevel(0, 0);
|
}
|
|
|
void CReviewInterface::SetProgramVersion()
|
{
|
BOOL bReturn;
|
CFileFind finder;
|
CTime timeLastWrite;
|
TCHAR currentPath[MAX_PATH];
|
|
::GetModuleFileName( AfxGetInstanceHandle(), currentPath, MAX_PATH);
|
|
bReturn = finder.FindFile(currentPath);
|
|
while(bReturn)
|
{
|
bReturn = finder.FindNextFile();
|
|
if(finder.IsDots()) continue;
|
if(finder.IsDirectory()) continue;
|
|
finder.GetLastWriteTime(timeLastWrite);
|
m_strProgramVersion.Format(_T("Build[ %04d.%02d.%02d %02d:%02d ]"),
|
timeLastWrite.GetYear(), timeLastWrite.GetMonth(), timeLastWrite.GetDay(), timeLastWrite.GetHour(), timeLastWrite.GetMinute());
|
}
|
|
finder.Close();
|
}
|
|
void CReviewInterface::CreateSystemDirectory()
|
{
|
if (m_pDoc==NULL) return;
|
|
const CNetworkInfo *pNetworkInfo = m_pDoc->System_GetNetworkInfo();
|
if (pNetworkInfo==NULL) return;
|
|
CString strPath = _T("");
|
strPath.Format(_T("%s"), pNetworkInfo->m_strLocalRawPath);
|
if(strPath.IsEmpty() == FALSE)
|
{
|
ISP2P_MakeDirectory(strPath);
|
strPath.Format(_T("%s\\Backup"), pNetworkInfo->m_strLocalRawPath);
|
CreateDirectory(strPath, NULL);
|
}
|
|
strPath.Format(_T("%s"), pNetworkInfo->m_strLocalImagePath);
|
if(strPath.IsEmpty() == FALSE)
|
{
|
ISP2P_MakeDirectory(strPath);
|
}
|
|
strPath.Format(_T("%s"), pNetworkInfo->m_strAlignImagePath);
|
if(strPath.IsEmpty() == FALSE)
|
{
|
ISP2P_MakeDirectory(strPath);
|
}
|
|
strPath.Format(_T("%s"), pNetworkInfo->m_strUploadRawPath);
|
if(strPath.IsEmpty() == FALSE)
|
{
|
ISP2P_MakeDirectory(strPath);
|
}
|
|
strPath.Format(_T("%s"), pNetworkInfo->m_strUploadImagePath);
|
if(strPath.IsEmpty() == FALSE)
|
{
|
ISP2P_MakeDirectory(strPath);
|
}
|
strPath.Format(_T("%s"), pNetworkInfo->m_strUploadDefectMapImagePath);
|
if(strPath.IsEmpty() == FALSE)
|
{
|
ISP2P_MakeDirectory(strPath);
|
}
|
}
|
|
BOOL CReviewInterface::InitMotorCalibrator()
|
{
|
BOOL bFRet, bBRet;
|
CString strDesignPos, strMotorPos;
|
|
m_vecMotorCalibrator.clear();
|
|
for (int i=0; i<Module_GetModuleStatusCount(); i++)
|
{
|
CMotorCalibrator calibrator(i);
|
|
strDesignPos.Format(_T("%s\\designpos_%02d.csv"), _REVIEW_SERVER_CONFIG_PATH_, i);
|
strMotorPos.Format(_T("%s\\motorpos_%02d.csv"), _REVIEW_SERVER_CONFIG_PATH_, i);
|
|
bFRet = calibrator.LoadDesignPosition(strDesignPos);
|
bBRet = calibrator.LoadMotorPosition(strMotorPos);
|
|
if(bFRet && bBRet)
|
{
|
if (calibrator.CalculateCoefficient()==0)
|
{
|
m_vecMotorCalibrator.push_back(calibrator);
|
g_pLog->DisplayMessage(_T("Gantry[%d] MotorCalibrator Apply!"), i);
|
}
|
}
|
}
|
|
return (int) m_vecMotorCalibrator.size();
|
}
|
|
void CReviewInterface::DeinitMotorCalibrator()
|
{
|
m_vecMotorCalibrator.clear();
|
}
|
|
// shared image
|
int CReviewInterface::InitSharedImage()
|
{
|
if (m_pSharedImageData)
|
{
|
delete m_pSharedImageData;
|
m_pSharedImageData = NULL;
|
}
|
|
m_pSharedImageData = new CSharedImageData();
|
if (m_pSharedImageData==NULL)
|
{
|
return 0;
|
}
|
|
if (m_pSharedImageData->CreateMemory(4)==FALSE)
|
{
|
return 0;
|
}
|
|
return 1;
|
}
|
|
// [2018/10/15 08:45:01 by jylee] related AOI Shared Memory
|
int CReviewInterface::InitAOISharedMemory()
|
{
|
if( m_AOISharedMemory.Create(NULL,CakAOISharedSystem::ST_Review) == FALSE )
|
return 0;
|
|
m_AOISharedMemory.SetINA2P(this);
|
|
_ProtocolReview* pProtocolReview = ISP2P_GetAoiMemoryProtocol();
|
if (pProtocolReview==NULL) return 0;
|
|
pProtocolReview->SetModuleNum(Module_GetModuleStatusCount());
|
for(int i=0; i<Module_GetModuleStatusCount(); i++ )
|
{
|
_ProtocalReviewModlueData* pModule = pProtocolReview->GetModuleData(i);;
|
pModule->m_nPlanDefectCount = 0;
|
pModule->m_nReviewedDefectCount = 0;
|
}
|
|
|
return 1;
|
}
|
|
void CReviewInterface::DeinitAOISharedMemory()
|
{
|
|
}
|
void CReviewInterface::INA2P_RecvSignal(int nSystemType, int nSignal, int nParam1, int nParam2)
|
{
|
if(nSystemType == 0/*akIPCNetAOISystem::ST_AOI*/ && nSignal == 10) //Motor Go Command From AOI
|
{
|
if(IsManualProcessMode())
|
{
|
double dGlassX = (double)nParam1/1000.0;
|
double dGlassY = (double)nParam2/1000.0;
|
Motor_CameraGo(0, dGlassX, dGlassY,0,0,0);
|
}
|
}
|
}
|
|
|
int CReviewInterface::InitAlignServerControl()
|
{
|
if (m_pAlignServerControl)
|
{
|
delete m_pAlignServerControl;
|
m_pAlignServerControl = NULL;
|
}
|
|
m_pAlignServerControl = new CAlignServerControl();
|
if (m_pAlignServerControl==NULL)
|
{
|
return 0;
|
}
|
|
return 1;
|
}
|
|
void CReviewInterface::DeinitAlignServerControl()
|
{
|
if (m_pAlignServerControl)
|
{
|
delete m_pAlignServerControl;
|
m_pAlignServerControl = NULL;
|
}
|
}
|
|
|
void CReviewInterface::DeinitSharedImage()
|
{
|
if (m_pSharedImageData)
|
{
|
m_pSharedImageData->DeleteMemory();
|
delete m_pSharedImageData;
|
m_pSharedImageData = NULL;
|
}
|
}
|
|
// Result Server Control
|
int CReviewInterface::InitResultServerControl()
|
{
|
if (m_pResultServerControl)
|
{
|
delete m_pResultServerControl;
|
m_pResultServerControl = NULL;
|
}
|
|
m_pResultServerControl = new CResultServerControl();
|
|
if (m_pResultServerControl == NULL)
|
return 0;
|
|
return 1;
|
}
|
|
void CReviewInterface::DeinitResultServerControl()
|
{
|
if (m_pResultServerControl)
|
{
|
delete m_pResultServerControl;
|
m_pResultServerControl = NULL;
|
}
|
}
|
|
// edge triangle manger
|
int CReviewInterface::InitEdgeRecipeManager()
|
{
|
if (m_pEdgeRecipeManager)
|
{
|
delete m_pEdgeRecipeManager;
|
}
|
m_pEdgeRecipeManager = NULL;
|
|
CString strTriangleFile;
|
strTriangleFile = TRIANGLE_RECIPE_PATH;
|
strTriangleFile += TRIANGLE_RECIPE_INFO;
|
|
//m_pEdgeRecipeManager = new CRecipeManager(TRIANGLE_RECIPE_PATH + TRIANGLE_RECIPE_INFO);
|
|
m_pEdgeRecipeManager = new CRecipeManager(strTriangleFile);
|
if (m_pEdgeRecipeManager==NULL) return 0;
|
|
return 1;
|
}
|
|
void CReviewInterface::DeinitEdgeRecipeManager()
|
{
|
if (m_pEdgeRecipeManager)
|
{
|
delete m_pEdgeRecipeManager;
|
}
|
m_pEdgeRecipeManager = NULL;
|
}
|
|
// virtual glass map
|
int CReviewInterface::InitVirtualGlassMap()
|
{
|
|
//return -1;
|
if (m_pVirtualGlassMap)
|
{
|
delete m_pVirtualGlassMap;
|
m_pVirtualGlassMap = NULL;
|
}
|
|
m_pVirtualGlassMap = new CVirtualGlassMap();
|
|
if (m_pVirtualGlassMap==NULL) return 0;
|
|
if (m_pDoc)
|
{
|
const CMotorControlInfo *pMotorInfo = m_pDoc->System_GetMotorInfo();
|
if (pMotorInfo)
|
{
|
m_pVirtualGlassMap->SetMotorOriginDir(pMotorInfo->GetOriginDirection());
|
}
|
|
const CGlassTypeInfo *pGlassInfo = m_pDoc->System_GetStandardGlassTypeInfo();
|
if (pGlassInfo)
|
{
|
m_pVirtualGlassMap->SetGlassOriginDir(pGlassInfo->m_nOriginDirection);
|
}
|
}
|
|
//m_pVirtualGlassMap->SetGlassTilt(0.0, 0.0, 0.01);
|
|
return 1;
|
}
|
|
void CReviewInterface::DeinitVirtualGlassMap()
|
{
|
if (m_pVirtualGlassMap)
|
{
|
delete m_pVirtualGlassMap;
|
m_pVirtualGlassMap = NULL;
|
}
|
}
|
|
|
int CReviewInterface::InitDiagnosisManager()
|
{
|
if (m_pDiagnosisManager)
|
{
|
delete m_pDiagnosisManager;
|
m_pDiagnosisManager = NULL;
|
}
|
|
m_pDiagnosisManager = new CDiagnosisManager();
|
if (m_pDiagnosisManager == NULL) return 0;
|
|
m_pDiagnosisManager->SetDP2P(static_cast<IDiagnosisProcessor2Parent*>(this));
|
|
return 1;
|
}
|
|
void CReviewInterface::DeinitDiagnosisManager()
|
{
|
/*if (m_pDiagnosisManager)
|
{
|
delete m_pDiagnosisManager;
|
|
m_pDiagnosisManager = NULL;
|
}*/
|
}
|
|
int CReviewInterface::InitDlgDiagnosis()
|
{
|
m_pDlgDiagnosis = new CDlgSelfDiagnosis(m_pDiagnosisManager);
|
m_pDlgDiagnosis->Create(IDD_DLG_SELF_DIAGNOSIS);
|
m_pDlgDiagnosis->ShowWindow(SW_HIDE);
|
|
if (m_pDlgDiagnosis == NULL) return 0;
|
|
|
return 1;
|
}
|
|
void CReviewInterface::DeinitDlgDiagnosis()
|
{
|
if (m_pDlgDiagnosis)
|
{
|
delete m_pDlgDiagnosis;
|
m_pDlgDiagnosis = NULL;
|
}
|
}
|
|
void CReviewInterface::CIV2P_GetImagePathName(CString& strFilename)
|
{
|
if (m_pDoc==NULL) return;
|
|
const CNetworkInfo* pNetworkInfo = m_pDoc->System_GetNetworkInfo();
|
if (pNetworkInfo==NULL) return;
|
|
CString strPathName = pNetworkInfo->m_strLocalImagePath;
|
|
int nModuleIndex = 0;
|
for (VectorModuleStatusIt it=m_vecModuleStatus.begin(); it!=m_vecModuleStatus.end(); it++)
|
{
|
if (it->GetModuleIndex() != nModuleIndex) continue;
|
|
SMotorPosition *pPos = it->GetMotorPosition();
|
if (pPos==NULL) continue;
|
|
strFilename.Format(_T("\\%d_%d.jpg"), int(pPos->dGlassPosX*1000.0), int(pPos->dGlassPosY*1000.0));
|
strFilename = strPathName + strFilename;
|
return;
|
}
|
}
|
|
#include "LineChecker/LineChecker.h"
|
|
void CReviewInterface::CIV2P_ManualSimulation( CCHImageData* pImageData )
|
{
|
//if (pImageData==NULL) return;
|
|
CWsiControl *pWsiControl = IRP2P_GetWSIControl(0);
|
if (pWsiControl==NULL) return;
|
|
m_nSimualData[1] = rand()%1500000;
|
m_nSimualData[2] = rand()%1200000;
|
pWsiControl->SetWsiMotionEnd(m_nSimualData[0], m_nSimualData[1], m_nSimualData[2]);
|
}
|
|
int CReviewInterface::InitReviewCamera()
|
{
|
if (m_pDoc==NULL) return 0;
|
|
const CSystemInfo *pSystemInfo = m_pDoc->System_GetSystemInfo();
|
if(pSystemInfo == NULL) return 0;
|
|
int nModuleIdx = 0;
|
|
// Gantry
|
for (int nGantryIdx=0; nGantryIdx<pSystemInfo->GetGantryInfoCount(); nGantryIdx++)
|
{
|
const CGantryInfo* pGantryInfo = pSystemInfo->GetGantryInfo(nGantryIdx);
|
if (pGantryInfo==NULL) continue;
|
// Header
|
for (int nHeaderIdx=0; nHeaderIdx<pGantryInfo->GetHeaderInfoCount(); nHeaderIdx++)
|
{
|
const CHeaderInfo* pHeaderInfo = pGantryInfo->GetHeaderInfo(nHeaderIdx);
|
if(pHeaderInfo == NULL) continue ;
|
|
CCameraControlReview* pCameraControlReview = new CCameraControlReview(nModuleIdx, pHeaderInfo->m_nLensType);
|
if (pCameraControlReview)
|
{
|
m_vecReviewCameraControl.push_back(pCameraControlReview);
|
nModuleIdx++;
|
}
|
else
|
{
|
delete pCameraControlReview;
|
pCameraControlReview = NULL;
|
}
|
}
|
}
|
|
return nModuleIdx;
|
}
|
|
|
int CReviewInterface::ConnectReviewCamera()
|
{
|
if (m_pDoc==NULL) return 0;
|
|
const CSystemInfo *pSystemInfo = m_pDoc->System_GetSystemInfo();
|
if(pSystemInfo == NULL) return 0;
|
|
const CMotorControlInfo *pMotorInfo = m_pDoc->System_GetMotorInfo();
|
if (pMotorInfo==NULL) return 0;
|
|
CConnectionStatus *pConnectionStatus = m_pDoc->Etc_GetConnectionStatus();
|
if (pConnectionStatus==NULL) return 0;
|
|
int nModuleIndex = 0;
|
// Gantry
|
for (int nGantryIdx=0; nGantryIdx<pSystemInfo->GetGantryInfoCount(); nGantryIdx++)
|
{
|
const CGantryInfo* pGantryInfo = pSystemInfo->GetGantryInfo(nGantryIdx);
|
if (pGantryInfo==NULL) continue;
|
|
// Header
|
for (int nHeaderIdx=0; nHeaderIdx<pGantryInfo->GetHeaderInfoCount(); nHeaderIdx++)
|
{
|
const CHeaderInfo* pHeaderInfo = pGantryInfo->GetHeaderInfo(nHeaderIdx);
|
if (pHeaderInfo==NULL) continue;
|
|
// camera control
|
CCameraControlReview *pCameraControlReview = ISP2P_GetReviewCameraControl(nModuleIndex);
|
if (pCameraControlReview==NULL) continue;
|
|
// module status
|
CModuleStatus moduleStatus(pHeaderInfo->m_nModuleType, pHeaderInfo->m_nLensType, nModuleIndex, nGantryIdx, nHeaderIdx);
|
SAxisIndex* pAxisIndex = moduleStatus.GetAxisIndex();
|
SCoordInfo* pCoordInfo = moduleStatus.GetCoordInfo();
|
|
// external index
|
SExternalIndex* pExternalIndex = moduleStatus.GetExternalIndex();
|
pExternalIndex->nLight_Index = pHeaderInfo->m_nLightIndex;
|
pExternalIndex->nLight_Channel = pHeaderInfo->m_nLightChannel;
|
pExternalIndex->nRevolver_Index = pHeaderInfo->m_nRevolverIndex;
|
pExternalIndex->nRevolver_Channel = pHeaderInfo->m_nRevolverChannel;
|
pExternalIndex->nAFM_Index = pHeaderInfo->m_nAFMIndex;
|
pExternalIndex->nAFM_Channel = pHeaderInfo->m_nAFMChannel;
|
pExternalIndex->nWSI_Index = pHeaderInfo->m_nWSIIndex;
|
pExternalIndex->nWSI_Channel = pHeaderInfo->m_nWSIChannel;
|
|
// motor axis index
|
for(int nMotorGantryIdx = 0; nMotorGantryIdx<pMotorInfo->GetMotorGantryAddrCount(); nMotorGantryIdx++)
|
{
|
const CMotorGantryAddr* pGantryAddr = pMotorInfo->GetMotorGantryAddr(nMotorGantryIdx);
|
if (pGantryAddr==NULL) continue;
|
int nMotorAxisCount = pGantryAddr->GetMotorAxisAddrCount();
|
|
for(int nMotorAxisIdx=0; nMotorAxisIdx<pGantryAddr->GetMotorAxisAddrCount(); nMotorAxisIdx++)
|
{
|
const CMotorAxisAddr* pAxisAddr = pGantryAddr->GetMotorAxisAddr(nMotorAxisIdx);
|
if (pAxisAddr==NULL) continue;
|
|
if(pGantryInfo->m_strXAxisName.Compare(pAxisAddr->m_strName) == 0)
|
{
|
pAxisIndex->nAxisIndexX = nMotorGantryIdx * nMotorAxisCount + nMotorAxisIdx;
|
}
|
if(pHeaderInfo->m_strYAxisName.Compare(pAxisAddr->m_strName) == 0)
|
{
|
pAxisIndex->nAxisIndexY = nMotorGantryIdx * nMotorAxisCount + nMotorAxisIdx;
|
}
|
if(pHeaderInfo->m_strZAxisName.Compare(pAxisAddr->m_strName) == 0)
|
{
|
pAxisIndex->nAxisIndexSx = nMotorGantryIdx * nMotorAxisCount + nMotorAxisIdx;
|
}
|
}
|
}
|
|
// camera info
|
VectorCameraControlInfo vectorCaemraControlInfo;
|
|
for(int nCameraIdx=0; nCameraIdx<pHeaderInfo->GetCameraInfoCount(); nCameraIdx++)
|
{
|
const CCameraControlInfo_Plus *pCameraInfo = pHeaderInfo->GetCameraInfo(nCameraIdx);
|
if (pCameraInfo==NULL) continue;
|
|
vectorCaemraControlInfo.push_back(*pCameraInfo);
|
|
//181128
|
CGlassTypeInfo pGlassTypeInfo;
|
pGlassTypeInfo.m_dMotorOffsetX = pGlassTypeInfo.GetMotorOffsetX();
|
pGlassTypeInfo.m_dMotorOffsetY = pGlassTypeInfo.GetMotorOffsetY();
|
|
SCameraInfo sCameraInfo; //수정할 부분
|
sCameraInfo.nFrameWidth = pCameraInfo->GetFrameWidth();
|
sCameraInfo.nFrameHeight = pCameraInfo->GetFrameHeight();
|
|
sCameraInfo.dOffsetX = pCameraInfo->GetCameraOffsetX();
|
sCameraInfo.dOffsetY = pCameraInfo->GetCameraOffsetY();
|
|
sCameraInfo.nFrameChannels = pCameraInfo->GetFrameChannels();
|
sCameraInfo.dResolution = pCameraInfo->GetPixelResolution();
|
sCameraInfo.dTriangleGab = (nCameraIdx==0) ? 50: 10.0;
|
|
sCameraInfo.nDirectionX = pCameraInfo->GetAxisDirectionX();
|
sCameraInfo.nDirectionY = pCameraInfo->GetAxisDirectionY();
|
|
// add camera info
|
moduleStatus.AddCameraInfo(sCameraInfo);
|
|
if (pGantryInfo->m_bStandardGantry && pHeaderInfo->m_bStandardHeader && pCameraInfo->GetStandardCamera())
|
{
|
pCoordInfo->bStandard = pCameraInfo->GetStandardCamera();
|
}
|
|
if (pCameraInfo->GetAxisDirectionX() == CAMERA_DIRECTION_FORWARD)
|
{
|
pCoordInfo->nDirectionX = COORDINATE_DIRECTION_FORWARD;
|
}
|
else
|
{
|
pCoordInfo->nDirectionX = COORDINATE_DIRECTION_BACKWARD;
|
}
|
|
if(pCameraInfo->GetAxisDirectionY() == CAMERA_DIRECTION_FORWARD)
|
{
|
pCoordInfo->nDirectionY = COORDINATE_DIRECTION_FORWARD;
|
}
|
else
|
{
|
pCoordInfo->nDirectionY = COORDINATE_DIRECTION_BACKWARD;
|
}
|
|
pCoordInfo->dDistanceX = pCameraInfo->GetCameraDistanceX();
|
pCoordInfo->dDistanceY = pCameraInfo->GetCameraDistanceY();
|
pCoordInfo->dOffsetX = pCameraInfo->GetCameraOffsetX(); //카메라 오프셋
|
pCoordInfo->dOffsetY = pCameraInfo->GetCameraOffsetY();
|
|
//181128
|
pCoordInfo->dOffsetX = pGlassTypeInfo.GetMotorOffsetX();//수정할 부분
|
pCoordInfo->dOffsetY = pGlassTypeInfo.GetMotorOffsetY();
|
}
|
|
// magnific info
|
for(int nMagIdx=0; nMagIdx<pHeaderInfo->GetMagnificInfoCount(); nMagIdx++)
|
{
|
const CMagnificInfo *pMagInfo = pHeaderInfo->GetMagnificInfo(nMagIdx);
|
if (pMagInfo==NULL) continue;
|
|
SMagnificInfo sMagInfo;
|
sMagInfo.strMagnificName = pMagInfo->m_strMagnificName;
|
sMagInfo.dMagnification = pMagInfo->m_dMagnification;
|
sMagInfo.dMagnificOffsetX = pMagInfo->m_dMagnificOffsetX; //배율 오프셋
|
sMagInfo.dMagnificOffsetY = pMagInfo->m_dMagnificOffsetY;
|
|
//sMagInfo.dTestOffsetX = pMagInfo->m_dTestOffsetX; //배율 오프셋 cmark
|
//sMagInfo.dTestOffsetY = pMagInfo->m_dTestOffsetY;
|
|
sMagInfo.nMsgHomePosition = pMagInfo->m_nMsgHomePosition;
|
|
moduleStatus.AddMagnificInfo(sMagInfo);
|
}
|
|
// connect camera control
|
int nResizeWidth = 2464;
|
int nResizeHeight = 2056;
|
CRect rtSubRect = CRect(738,619,1718,1439);
|
pCameraControlReview->SetDigitalZoomInfo(rtSubRect, nResizeWidth, nResizeHeight);
|
|
if(pCameraControlReview->ConnectCamera(vectorCaemraControlInfo))
|
{
|
pCameraControlReview->SetRCCP(static_cast<IReviewCameraControl2Parent*>(this));
|
|
// process status observer
|
AddObserverUpdateProcessStatus(static_cast<IUpdateProcessStatus*>(pCameraControlReview));
|
|
// camera status observer
|
AddObserverUpdateCameraControl(static_cast<IUpdateCameraControl*>(pCameraControlReview));
|
|
// review process status
|
AddObserverUpdateReviewProcessStatus(static_cast<IUpdateReviewProcessStatus*>(pCameraControlReview));
|
|
SCameraControl *pCameraControl = moduleStatus.GetCameraControl();
|
SCameraInfo* pCameraInfo = moduleStatus.GetCameraInfo(0);
|
UpdateCameraControl(nModuleIndex, pCameraControl, pCameraInfo);
|
}
|
|
// data push back
|
m_vecModuleStatus.push_back(moduleStatus);
|
|
BOOL bConnection = pCameraControlReview->GetConnected();
|
pConnectionStatus->m_vecReviewCameraStatus.push_back(bConnection);
|
|
nModuleIndex++; // module status++
|
} // for HeaderIdx
|
} // for nGantryIdx
|
|
|
// set selected ModuleiNDEX
|
if (nModuleIndex>0)
|
{
|
DMI2P_SetSelectedModuleIndex(0, TRUE);
|
}
|
|
return 1;
|
}
|
|
void CReviewInterface::DisconnectReviewCamera()
|
{
|
int nCount = (int)m_vecReviewCameraControl.size();
|
for (VectorCameraControlReviewIt it=m_vecReviewCameraControl.begin(); it!=m_vecReviewCameraControl.end(); it++)
|
{
|
(*it)->DisconnectCamera();
|
Sleep(50);
|
}
|
|
TRACE(_T("[A2E]CReviewInterface::DisconnectReviewCamera()\n"));
|
}
|
|
void CReviewInterface::DeinitReviewCamera()
|
{
|
for (VectorCameraControlReviewIt it=m_vecReviewCameraControl.begin(); it!=m_vecReviewCameraControl.end(); it++)
|
{
|
CCameraControlReview *pNode = static_cast<CCameraControlReview*>(*it);
|
delete pNode;
|
pNode = NULL;
|
}
|
m_vecReviewCameraControl.clear();
|
}
|
|
int CReviewInterface::InitAlignCamera()
|
{
|
if (m_pDoc == NULL) return 0;
|
CConnectionStatus *pConnectionStatus = m_pDoc->Etc_GetConnectionStatus();
|
if (pConnectionStatus == NULL) return 0;
|
|
const CSystemInfo *pSystemInfo = m_pDoc->System_GetSystemInfo();
|
if (pSystemInfo==NULL) return 0;
|
|
// get camera conn param
|
VectorCameraControlInfo vectorCaemraControlInfo;
|
|
int nCameraInfoCount = 2;
|
|
for (int nCameraIdx=0; nCameraIdx<nCameraInfoCount; nCameraIdx++)
|
{
|
const CAlignCameraInfo* pCameraInfo = m_pDoc->System_GetAlignCameraInfo(nCameraIdx);
|
if (pCameraInfo==NULL) continue;
|
vectorCaemraControlInfo.push_back(*pCameraInfo->GetCameraControlInfo());
|
}
|
|
if (vectorCaemraControlInfo.size()<1) return 0;
|
|
if (m_pAlignCameraControl)
|
{
|
delete m_pAlignCameraControl;
|
m_pAlignCameraControl = NULL;
|
}
|
|
pConnectionStatus->ResizeAlignCameraStatus((int) vectorCaemraControlInfo.size());
|
|
m_pAlignCameraControl = new CCameraControlAlign();
|
if (m_pAlignCameraControl==NULL) return 0;
|
|
// set system type
|
m_pAlignCameraControl->SetSystemType(pSystemInfo->m_nLineType, pSystemInfo->m_nMachineType);
|
|
const CAlignCameraInfo* pCamInfo = ISP2P_System_GetAlignCameraInfo(0);// chm 190623 얼라인 프레임 레이트
|
|
if(pCamInfo->GetAlignCameraFrameRateApply() !=0)
|
{
|
|
m_pAlignCameraControl->SetFrameRateApply(pCamInfo->GetAlignCameraFrameRateApply());
|
}
|
|
else
|
{
|
|
m_pAlignCameraControl->SetFrameRateApply(0);
|
}
|
|
|
if (m_pAlignCameraControl->ConnectCamera(vectorCaemraControlInfo))
|
{
|
m_pAlignCameraControl->SetACCP(static_cast<IAlignCameraControl2Parent*>(this));
|
//m_pAlignCameraControl->Camera_Control(CameraControlLive);
|
|
// process status observer
|
AddObserverUpdateProcessStatus(static_cast<IUpdateProcessStatus*>(m_pAlignCameraControl));
|
|
/*m_pAlignCameraControl->Camera_Control(CameraControlLive);*/ // 210805 Align Camera Sequence 변경
|
}
|
else
|
{
|
delete m_pAlignCameraControl;
|
m_pAlignCameraControl = NULL;
|
}
|
|
// connect status
|
int nCameraCount = 0;
|
if (m_pAlignCameraControl)
|
{
|
nCameraCount = m_pAlignCameraControl->GetCameraCount();
|
for(int nCameraIdx = 0; nCameraIdx < nCameraCount; nCameraIdx++)
|
{
|
if (m_pAlignCameraControl->GetConnected(nCameraIdx))
|
{
|
pConnectionStatus->m_vecAlignCameraStatus[nCameraIdx] = TRUE;
|
}
|
}
|
}
|
|
return nCameraCount;
|
}
|
|
void CReviewInterface::DeinitAlignCamera()
|
{
|
if (m_pAlignCameraControl)
|
{
|
m_pAlignCameraControl->DisconnectCamera();
|
|
delete m_pAlignCameraControl;
|
}
|
|
m_pAlignCameraControl = NULL;
|
}
|
|
int CReviewInterface::InitMotorControl()
|
{
|
if(m_pDoc == NULL) return 0;
|
|
CConnectionStatus *pConnectionStatus = m_pDoc->Etc_GetConnectionStatus();
|
if (pConnectionStatus == NULL) return 0;
|
|
const CMotorControlInfo *pMotorInfo = m_pDoc->System_GetMotorInfo();
|
if(pMotorInfo == NULL) return 0;
|
|
if (m_pMotorControl!=NULL)
|
{
|
delete m_pMotorControl;
|
m_pMotorControl = NULL;
|
}
|
|
switch(pMotorInfo->GetControllerType())
|
{
|
case MotorController_eXcom:
|
m_pMotorControl = new CMotorControl_eXcom(0, 50); //스레드 타이머
|
break;
|
case MotorController_PowerPmac:
|
m_pMotorControl = new CMotorControl_PowerPmac(0, 50);
|
break;
|
case MotorController_PowerPmacCmd:
|
m_pMotorControl = new CMotorControl_PowerPmacCmd(0, 100);
|
break;
|
case MotorController_ACS:
|
m_pMotorControl = new CMotorControl_Acs(0,50);
|
break;
|
case MotorController_Simulation:
|
m_pMotorControl = new CMotorControl_Simulation(0, 50,2);
|
break;
|
}
|
|
if (m_pMotorControl==NULL) return 0;
|
|
int nCount = 0;
|
if(m_pMotorControl->Connect(pMotorInfo) == 1)
|
{
|
m_pMotorControl->SetMC2P(static_cast<IMotorControl2Parent*>(this));
|
m_pMotorControl->StartThread();
|
pConnectionStatus->m_bMotorStatus = TRUE;
|
nCount++;
|
}
|
else
|
{
|
pConnectionStatus->m_bMotorStatus = FALSE;
|
}
|
|
return nCount;
|
}
|
|
void CReviewInterface::DeinitMotorControl()
|
{
|
if (m_pMotorControl==NULL) return;
|
|
m_pMotorControl->StopThread();
|
|
m_pMotorControl->Disconnect();
|
|
if (m_pMotorControl)
|
{
|
//delete m_pMotorControl; // 20160823
|
}
|
|
m_pMotorControl = NULL;
|
}
|
|
// Signal Control
|
int CReviewInterface::InitSignalControl()
|
{
|
if(m_pDoc == NULL) return 0;
|
CConnectionStatus *pConnectionStatus = m_pDoc->Etc_GetConnectionStatus();
|
if (pConnectionStatus == NULL) return 0;
|
|
const CSignalControlInfo* pControlInfo = m_pDoc->System_GetSignalInfo();
|
if (pControlInfo==NULL) return 0;
|
|
if (m_pSignalControl!=NULL)
|
{
|
delete m_pSignalControl;
|
m_pSignalControl = NULL;
|
}
|
|
switch(pControlInfo->GetControllerType())
|
{
|
case SignalConnectType_Simulation:
|
m_pSignalControl = new CSignalControl_Simulation(0, pControlInfo->GetMSPeriod());
|
break;
|
case SignalConnectType_Plc:
|
m_pSignalControl = new CSignalControl_MxComponent(0, 100);
|
break;
|
case SignalConnectType_Dit_PcControl:
|
m_pSignalControl = new CSignalControl_DitSharedMemorySync(0, pControlInfo->GetMSPeriod());
|
break;
|
|
default:
|
break;
|
}
|
|
if (m_pSignalControl==NULL) return 0;
|
|
if(m_pSignalControl->Connect(pControlInfo) < 0) return 0;
|
|
m_pSignalControl->SetSC2P(static_cast<ISignalControl2Parnet*>(this));
|
BOOL bResult = m_pSignalControl->StartThread();
|
pConnectionStatus->m_bSignalStatus = TRUE;
|
|
return 1;
|
}
|
|
void CReviewInterface::DeinitSignalControl()
|
{
|
if (m_pSignalControl==NULL) return;
|
|
m_pSignalControl->StopThread();
|
|
m_pSignalControl->Disconnect();
|
|
//delete m_pSignalControl; // 20160823
|
|
m_pSignalControl = NULL;
|
}
|
|
int CReviewInterface::InitReviewLightControl()
|
{
|
if(m_pDoc == NULL) return 0;
|
CConnectionStatus *pConnectionStatus = m_pDoc->Etc_GetConnectionStatus();
|
if (pConnectionStatus == NULL) return 0;
|
|
const CSystemInfo *pSystemInfo = m_pDoc->System_GetSystemInfo();
|
if(pSystemInfo == NULL) return 0;
|
|
int nLightContolCount = 0;
|
int nGantryCount = pSystemInfo->GetGantryInfoCount();
|
|
for(int nGantryIdx = 0; nGantryIdx < nGantryCount; nGantryIdx++)
|
{
|
const CGantryInfo *pGantryInfo = pSystemInfo->GetGantryInfo(nGantryIdx);
|
if (pGantryInfo==NULL) continue;
|
|
int nHeaderCount = pGantryInfo->GetHeaderInfoCount();
|
for(int nHeaderIdx = 0; nHeaderIdx < nHeaderCount; nHeaderIdx++)
|
{
|
const CHeaderInfo *pHeaderInfo = pGantryInfo->GetHeaderInfo(nHeaderIdx);
|
if (pHeaderInfo==NULL) continue;
|
|
int nLightCount = pHeaderInfo->GetLightInfoCount();
|
pConnectionStatus->ResizeReviewLightStatus(nLightCount);
|
|
for(int nLightIdx = 0; nLightIdx < nLightCount; nLightIdx++)
|
{
|
const CLightControlInfo* pLightInfo = pHeaderInfo->GetLightInfo(nLightIdx);
|
if (pLightInfo==NULL) continue;
|
|
CLightControl* pLightControl = NULL;
|
switch(pLightInfo->GetControllerType())
|
{
|
case LightController_Simulation:
|
pLightControl = new CLightControl_Simulation(nLightIdx);
|
break;
|
|
case LightController_ShinHan:
|
pLightControl = new CLightControl_ShinHan_FLS2CHR(nLightIdx);
|
break;
|
|
case LightController_KSVision:
|
pLightControl = new CLightControl_KSVision_PDSeries(nLightIdx);
|
break;
|
|
case LightController_PlusTek:
|
pLightControl = new CLightControl_PlusTek_STB64C(nLightIdx);
|
break;
|
|
case LightController_Byon_ERI2 :
|
pLightControl = new CLightControl_Byon_ERI2(nLightIdx);
|
break;
|
|
case LightController_ALT_2RSD:
|
pLightControl = new CLightControl_ALT_2RSD(nLightIdx);
|
break;
|
|
case LightController_ALT_8RSDF:
|
pLightControl = new CLightControl_ALT_8RSDF(nLightIdx);
|
break;
|
|
case LightControl_LFusion_PDSeries:
|
pLightControl = new CLightControl_LFusion_PDSeries(nLightIdx);
|
break;
|
|
case LightController_ShinHan_TCP:
|
pLightControl = new CLightControl_Shinhan_TCP(nLightIdx);
|
break;
|
}
|
|
if (pLightControl==NULL) continue;
|
if(pLightControl->Connect(*pLightInfo)==FALSE)
|
{
|
delete pLightControl;
|
g_pLog->DisplayMessage(_T("[Review Light] %d is Disconnected"),nLightIdx);
|
continue;
|
}
|
|
pLightControl->SetLightLevel(pLightInfo->GetDefaultValue());
|
pLightControl->SetLC2P(static_cast<ILightControl2Parent*>(this));
|
m_vecReviewLightControl.push_back(pLightControl);
|
|
pConnectionStatus->m_vecReviewLightStatus[nLightIdx] = TRUE;
|
|
nLightContolCount++;
|
}
|
}
|
}
|
|
return nLightContolCount;
|
}
|
|
void CReviewInterface::DeinitReviewLightControl()
|
{
|
for (VectorLightControlIt it=m_vecReviewLightControl.begin(); it!=m_vecReviewLightControl.end(); it++)
|
{
|
CLightControl *pNode = static_cast<CLightControl*>(*it);
|
pNode->Disconnect();
|
delete pNode;
|
pNode = NULL;
|
}
|
|
m_vecReviewLightControl.clear();
|
}
|
|
int CReviewInterface::InitRevolverControl()
|
{
|
if(m_pDoc == NULL) return 0;
|
CConnectionStatus *pConnectionStatus = m_pDoc->Etc_GetConnectionStatus();
|
if (pConnectionStatus == NULL) return 0;
|
|
const CSystemInfo *pSystemInfo = m_pDoc->System_GetSystemInfo();
|
if(pSystemInfo == NULL) return 0;
|
|
int nRevolverContolCount = 0;
|
int nGantryCount = pSystemInfo->GetGantryInfoCount();
|
|
for(int nGantryIdx = 0; nGantryIdx < nGantryCount; nGantryIdx++)
|
{
|
const CGantryInfo *pGantryInfo = pSystemInfo->GetGantryInfo(nGantryIdx);
|
if (pGantryInfo==NULL) continue;
|
|
int nHeaderCount = pGantryInfo->GetHeaderInfoCount();
|
for(int nHeaderIdx = 0; nHeaderIdx < nHeaderCount; nHeaderIdx++)
|
{
|
const CHeaderInfo *pHeaderInfo = pGantryInfo->GetHeaderInfo(nHeaderIdx);
|
if (pHeaderInfo==NULL) continue;
|
|
int nRevolverCount = pHeaderInfo->GetRevolverInfoCount();
|
pConnectionStatus->ResizeReviewRevolverStatus(nRevolverCount);
|
|
for(int nRevolverIdx = 0; nRevolverIdx < nRevolverCount; nRevolverIdx++)
|
{
|
const CLensChangeControlInfo* pRevolverInfo = pHeaderInfo->GetRevolverInfo(nRevolverIdx);
|
if (pRevolverInfo==NULL) continue;
|
|
//enum RevolverConnectionType {RC_LINEAR_TURRET = 0, RC_DUAL_TUBE};
|
|
CLensChangeControl *pRevolverControl = NULL;
|
switch(pRevolverInfo->GetControllerType())
|
{
|
case LensChangeController_Linear:
|
pRevolverControl = new CLensChangeControl_LinearTurret(nGantryIdx);
|
break;
|
|
case LensChangeController_Nikon:
|
pRevolverControl = new CLensChangeControl_Nikon(nGantryIdx);
|
break;
|
|
case LensChangeController_DualTube:
|
pRevolverControl = new CLensChangeControl_DualTube(nGantryIdx);
|
break;
|
|
case LensChangeController_Simulation:
|
pRevolverControl = new CLensChangeControl_Simulation(nGantryIdx);
|
break;
|
}
|
|
if (pRevolverControl==NULL) continue;
|
|
if(pRevolverControl->Connect(*pRevolverInfo)==FALSE)
|
{
|
delete pRevolverControl;
|
g_pLog->DisplayMessage(_T("[Revolver] %d is Disconnected"), nRevolverIdx);
|
continue;
|
}
|
|
pRevolverControl->SetPosition(pRevolverInfo->GetDefaultLevel()+1);
|
pRevolverControl->SetRC2P(static_cast<ILensChangeControl2Parent*>(this));
|
m_vecRevolverControl.push_back(pRevolverControl);
|
|
pConnectionStatus->m_vecReviewRevolverStatus[nRevolverIdx] = TRUE;
|
|
nRevolverContolCount++;
|
}
|
}
|
}
|
|
return nRevolverContolCount;
|
}
|
|
void CReviewInterface::DeinitRevolverControl()
|
{
|
for (VectorLensChangeControlIt it=m_vecRevolverControl.begin(); it!=m_vecRevolverControl.end(); it++)
|
{
|
CLensChangeControl *pNode = static_cast<CLensChangeControl*>(*it);
|
pNode->Disconnect();
|
delete pNode;
|
pNode = NULL;
|
}
|
|
m_vecRevolverControl.clear();
|
}
|
|
int CReviewInterface::InitAlignLightControl()
|
{
|
if(m_pDoc == NULL) return 0;
|
CConnectionStatus *pConnectionStatus = m_pDoc->Etc_GetConnectionStatus();
|
if (pConnectionStatus == NULL) return 0;
|
|
int nLightControlCount = 0;
|
int nLightInfoCount = 2;
|
|
pConnectionStatus->ResizeAlignLightStatus(nLightInfoCount);
|
|
for (int nLightIdx=0; nLightIdx<nLightInfoCount; nLightIdx++)
|
{
|
const CAlignCameraInfo *pAlignCameraInfo = m_pDoc->System_GetAlignCameraInfo(nLightIdx);
|
if (pAlignCameraInfo==NULL) continue;
|
|
CLightControl* pLightControl = NULL;
|
|
const CLightControlInfo* pLightControlInfo = pAlignCameraInfo->GetLightContorlInfo();
|
if(pLightControlInfo == NULL) continue;
|
|
switch(pAlignCameraInfo->GetLightContorlInfo()->GetControllerType())
|
{
|
case LightController_Simulation:
|
pLightControl = new CLightControl_Simulation(nLightIdx);
|
break;
|
|
case LightController_ShinHan:
|
pLightControl = new CLightControl_ShinHan_FLS2CHR(nLightIdx);
|
break;
|
|
case LightController_KSVision:
|
pLightControl = new CLightControl_KSVision_PDSeries(nLightIdx);
|
break;
|
|
case LightController_PlusTek:
|
pLightControl = new CLightControl_PlusTek_STB64C(nLightIdx);
|
break;
|
|
case LightController_Byon_ERI2:
|
pLightControl = new CLightControl_Byon_ERI2(nLightIdx);
|
break;
|
|
case LightController_ALT_2RSD:
|
pLightControl = new CLightControl_ALT_2RSD(nLightIdx);
|
break;
|
|
case LightController_ALT_8RSDF:
|
pLightControl = new CLightControl_ALT_8RSDF(nLightIdx);
|
break;
|
|
case LightControl_LFusion_PDSeries:
|
pLightControl = new CLightControl_LFusion_PDSeries(nLightIdx);
|
break;
|
|
case LightController_ShinHan_TCP:
|
pLightControl = new CLightControl_Shinhan_TCP(nLightIdx);
|
break;
|
|
}
|
|
if(pLightControl == NULL) continue;
|
|
if(!pLightControl->Connect(*pLightControlInfo))
|
{
|
delete pLightControl;
|
continue;
|
}
|
|
pLightControl->SetLC2P(static_cast<ILightControl2Parent*>(this));
|
|
pLightControl->SetLightLevel(pLightControlInfo->GetDefaultValue(), pLightControlInfo->GetChannel());
|
|
m_vecAlignLightControl.push_back(pLightControl);
|
pConnectionStatus->m_vecAlignLightStatus[nLightIdx] = TRUE;
|
|
nLightControlCount++;
|
}
|
|
return nLightControlCount;
|
}
|
|
void CReviewInterface::DeinitAlignLightControl()
|
{
|
for (VectorLightControlIt it=m_vecAlignLightControl.begin(); it!=m_vecAlignLightControl.end(); it++)
|
{
|
CLightControl *pNode = static_cast<CLightControl*>(*it);
|
if(pNode == NULL) continue;
|
|
pNode->Disconnect();
|
delete pNode;
|
pNode = NULL;
|
}
|
|
m_vecAlignLightControl.clear();
|
}
|
|
// WSI Control
|
int CReviewInterface::InitWSIController()
|
{
|
if(m_pDoc == NULL) return 0;
|
|
const CSystemInfo *pSystemInfo = m_pDoc->System_GetSystemInfo();
|
if(pSystemInfo == NULL) return 0;
|
|
int nWSIContolCount = 0;
|
int nGantryCount = pSystemInfo->GetGantryInfoCount();
|
|
int nModuleIdx = 0;
|
|
CWsiControl *pWsicon =NULL;
|
|
for(int nGantryIdx = 0; nGantryIdx < nGantryCount; nGantryIdx++)
|
{
|
const CGantryInfo *pGantryInfo = pSystemInfo->GetGantryInfo(nGantryIdx);
|
if (pGantryInfo==NULL) continue;
|
|
int nHeaderCount = pGantryInfo->GetHeaderInfoCount();
|
for(int nHeaderIdx = 0; nHeaderIdx < nHeaderCount; nHeaderIdx++)
|
{
|
const CHeaderInfo *pHeaderInfo = pGantryInfo->GetHeaderInfo(nHeaderIdx);
|
if (pHeaderInfo==NULL) continue;
|
|
int nWSICount = pHeaderInfo->GetWsiInfoCount();
|
for(int nWSIIdx = 0; nWSIIdx < nWSICount; nWSIIdx++)
|
{
|
const CWsiControlInfo* pWSIInfo = pHeaderInfo->GetWsiInfo(nWSIIdx);
|
if(pWSIInfo == NULL) continue;
|
|
// WSI Offset 적용.
|
SMotorPosition *pPosition = Module_GetMotorPosition(nModuleIdx++);
|
|
if (pPosition)
|
{
|
pPosition->bUseWSI = TRUE;
|
pPosition->dWSIOffsetX = pWSIInfo->GetOffsetX();
|
pPosition->dWSIOffsetY = pWSIInfo->GetOffsetY();
|
}
|
|
CWsiControl *pWsiControl = NULL;
|
|
pWsiControl = new CWsiControl_Dit(nWSIContolCount);
|
|
if (pWsiControl==NULL) continue;
|
|
pWsiControl->SetWC2P(static_cast<IWsiControl2Parnet*>(this));
|
|
if (pWsiControl->Connect(*pWSIInfo)!=1)
|
{
|
delete pWsiControl;
|
continue;
|
}
|
pWsicon = pWsiControl;
|
m_vecWSIControl.push_back(pWsiControl);
|
|
nWSIContolCount++;
|
|
}
|
}
|
}
|
|
if(nWSIContolCount>=1)
|
{
|
//20190801 chm
|
//WsiAliveCheckThread(); //WSI ALIVE
|
//g_pLog->DisplayMessage(_T("[ReviewInterface] WsiAliveCheckThread Start"));
|
|
}
|
|
|
|
return nWSIContolCount;
|
}
|
|
void CReviewInterface::DeinitWSIController()
|
{
|
for (VectorWsiControlIt it=m_vecWSIControl.begin(); it!=m_vecWSIControl.end(); it++)
|
{
|
CWsiControl *pNode = static_cast<CWsiControl*>(*it);
|
pNode->Disconnect();
|
delete pNode;
|
pNode = NULL;
|
}
|
|
m_vecWSIControl.clear();
|
}
|
|
int CReviewInterface::InitAFMControl()
|
{
|
if(m_pDoc == NULL) return 0;
|
CConnectionStatus *pConnectionStatus = m_pDoc->Etc_GetConnectionStatus();
|
if (pConnectionStatus == NULL) return 0;
|
|
const CSystemInfo *pSystemInfo = m_pDoc->System_GetSystemInfo();
|
if(pSystemInfo == NULL) return 0;
|
|
int nAFMContolCount = 0;
|
int nGantryCount = pSystemInfo->GetGantryInfoCount();
|
|
for(int nGantryIdx = 0; nGantryIdx < nGantryCount; nGantryIdx++)
|
{
|
const CGantryInfo *pGantryInfo = pSystemInfo->GetGantryInfo(nGantryIdx);
|
if (pGantryInfo==NULL) continue;
|
|
int nHeaderCount = pGantryInfo->GetHeaderInfoCount();
|
for(int nHeaderIdx = 0; nHeaderIdx < nHeaderCount; nHeaderIdx++)
|
{
|
const CHeaderInfo *pHeaderInfo = pGantryInfo->GetHeaderInfo(nHeaderIdx);
|
if (pHeaderInfo==NULL) continue;
|
|
int nAFMCount = pHeaderInfo->GetAFMInfoCount();
|
pConnectionStatus->ResizeReviewAFMStatus(nAFMCount);
|
|
for(int nAFMIdx = 0; nAFMIdx < nAFMCount; nAFMIdx++)
|
{
|
const CAfmControlInfo* pAFMInfo = pHeaderInfo->GetAFMInfo(nAFMIdx);
|
if (pAFMInfo==NULL) continue;
|
|
/*SAFMConnParam connParam;*/
|
CAfmControl *pAFMControl = NULL;
|
|
switch(pAFMInfo->GetControllerType())
|
{
|
case AfmController_Wegu:
|
pAFMControl = new CAfmControl_Wegu(nAFMIdx);
|
break;
|
case AfmController_Dit:
|
pAFMControl = new CAfmControl_Dit(nAFMIdx);
|
break;
|
case AfmController_MsgLaf:
|
pAFMControl = new CAfmControl_Msg(nAFMIdx);
|
break;
|
case AfmController_Simulation:
|
pAFMControl = new CAfmControl_Simulation(nAFMIdx);
|
break;
|
}
|
/* AFMControl Test Code
|
if (pAFMControl==NULL) continue;
|
int code = 0;
|
CString msg = _T("");
|
pAFMControl->GetStatus(code, msg);
|
*/
|
|
if (pAFMControl==NULL) continue;
|
|
pAFMControl->SetIndex(nAFMContolCount);
|
|
if(pAFMControl->Connect(*pAFMInfo)==FALSE)
|
{
|
delete pAFMControl;
|
g_pLog->DisplayMessage(_T("[AFM] %d is Not Connected"),nAFMContolCount);
|
AfxMessageBox(_T("AFM Connect Fail"));
|
continue;
|
}
|
|
g_pLog->DisplayMessage(_T("[AFM] %d is connected"),nAFMContolCount);
|
|
pAFMControl->SetAFC2P(static_cast<IAfmControl2Parent*>(this));
|
|
m_vecAFMControl.push_back(pAFMControl);
|
|
pConnectionStatus->m_vecReviewAFMStatus[nAFMIdx] = TRUE;
|
|
nAFMContolCount++;
|
}
|
}
|
}
|
|
return nAFMContolCount;
|
|
}
|
|
void CReviewInterface::DeinitAFMControl()
|
{
|
for (VectorAfmControlIt it=m_vecAFMControl.begin(); it!=m_vecAFMControl.end(); it++)
|
{
|
CAfmControl *pNode = static_cast<CAfmControl*>(*it);
|
pNode->SetTracking(0);
|
pNode->Disconnect();
|
delete pNode;
|
pNode = NULL;
|
Sleep(100);
|
}
|
|
m_vecAFMControl.clear();
|
}
|
|
// sequence process
|
int CReviewInterface::InitSequenceProcessor()
|
{
|
if (m_pSequenceProcessor)
|
{
|
delete m_pSequenceProcessor;
|
m_pSequenceProcessor = NULL;
|
}
|
|
const CSystemInfo* pSystemInfo = m_pDoc->System_GetSystemInfo();
|
if(pSystemInfo==NULL) return 0;
|
|
m_pSequenceProcessor = NULL;
|
switch(pSystemInfo->m_nLineType)
|
{
|
case SystemLine_CPJT:
|
m_pSequenceProcessor = new CSequenceProcessor_CPJT();
|
break;
|
|
default:
|
m_pSequenceProcessor = new CSequenceProcessor_CPJT();
|
break;
|
}
|
|
if (m_pSequenceProcessor==NULL) return 0;
|
|
m_pSequenceProcessor->SetSP2P(static_cast<ISequenceProcessor2Parent*>(this));
|
m_pSequenceProcessor->SetLineMachineType(pSystemInfo->m_nLineType, pSystemInfo->m_nMachineType, pSystemInfo->m_strEqpID);
|
|
return 1;
|
}
|
|
void CReviewInterface::DeinitSequenceProcessor()
|
{
|
if(m_pSequenceProcessor)
|
{
|
delete m_pSequenceProcessor;
|
m_pSequenceProcessor = NULL;
|
TRACE(_T("[A2E]DeinitSequenceProcessor\n"));
|
}
|
}
|
|
int CReviewInterface::InitReviewProcessor()
|
{
|
if (m_pDoc==NULL) return 0;
|
|
const CNetworkInfo *pNetworkInfo = m_pDoc->System_GetNetworkInfo();
|
if(pNetworkInfo == NULL) return 0;
|
|
const CSystemInfo *pSystemInfo = m_pDoc->System_GetSystemInfo();
|
if(pSystemInfo == NULL) return 0;
|
|
int nCount = 0;
|
if (m_pReviewProcessor)
|
{
|
delete m_pReviewProcessor;
|
m_pReviewProcessor = NULL;
|
}
|
|
int nThreadCount = 10;
|
switch(pSystemInfo->m_nLineType)
|
{
|
case SystemLine_CPJT:
|
m_pReviewProcessor = new CReviewProcessor_CPJT(nThreadCount);
|
break;
|
|
default:
|
m_pReviewProcessor = new CReviewProcessor_CPJT(nThreadCount);
|
break;
|
}
|
|
if (m_pReviewProcessor==NULL) return 0;
|
|
m_pReviewProcessor->SetLineMachineType(pSystemInfo->m_nLineType, pSystemInfo->m_nMachineType, pSystemInfo->m_strEqpID);
|
m_pReviewProcessor->SetReviewImageInfo(
|
pNetworkInfo->m_nUpdateImageWidth,
|
pNetworkInfo->m_nUpdateImageHeight,
|
pNetworkInfo->m_nUpdateImageSize,
|
pNetworkInfo->m_nUpdateImageQuality,
|
pNetworkInfo->m_nUpdateImageStep,
|
pNetworkInfo->m_dUpdateImageScale,
|
pNetworkInfo->m_bUpdateImageOriginal,
|
pNetworkInfo->m_nImageRotate,
|
pNetworkInfo->m_nImageFlip);
|
|
m_pReviewProcessor->SetRP2P(static_cast<IReviewProcessor2Parent*>(this));
|
m_pReviewProcessor->SetView(static_cast<CView*>(m_pView));
|
|
AddObserverUpdateReviewProcessStatus(static_cast<IUpdateReviewProcessStatus*>(m_pReviewProcessor));
|
|
return 1;
|
}
|
|
void CReviewInterface::DeinitReviewProcessor()
|
{
|
if(m_pReviewProcessor)
|
{
|
delete m_pReviewProcessor;
|
m_pReviewProcessor = NULL;
|
TRACE(_T("[A2E]DeinitReviewProcessor\n"));
|
}
|
}
|
|
// new Priority Sorter
|
int CReviewInterface::InitPrioritySorter()
|
{
|
int nCount = 0;
|
|
if (m_pPrioritySorter)
|
{
|
delete m_pPrioritySorter;
|
m_pPrioritySorter = NULL;
|
}
|
|
const CSystemInfo* pSystemInfo = m_pDoc->System_GetSystemInfo();
|
if(pSystemInfo==NULL) return 0;
|
|
switch(pSystemInfo->m_nLineType)
|
{
|
case SystemLine_CPJT:
|
m_pPrioritySorter = new CPrioritySorter_CPJT(MAX_REVIEW_POINT_SIZE);
|
break;
|
|
default:
|
m_pPrioritySorter = new CPrioritySorter_CPJT(MAX_REVIEW_POINT_SIZE);
|
break;
|
}
|
|
if (m_pPrioritySorter)
|
{
|
m_pPrioritySorter->SetPS2P(static_cast<IPrioritySorter2Parent*>(this));
|
nCount++;
|
}
|
ISP2P_MakeDirectory(_T("D:\\Review_sorting"));
|
return nCount;
|
}
|
|
void CReviewInterface::DeinitPrioritySorter()
|
{
|
if(m_pPrioritySorter)
|
{
|
delete m_pPrioritySorter;
|
m_pPrioritySorter = NULL;
|
TRACE(_T("[A2E]DeinitPrioritySorter\n"));
|
}
|
}
|
|
// Review Defect Picker
|
int CReviewInterface::InitDefectPicker()
|
{
|
int nCount = 0;
|
|
if (m_pDefectPicker)
|
{
|
delete m_pDefectPicker;
|
m_pDefectPicker = NULL;
|
}
|
|
const CSystemInfo* pSystemInfo = m_pDoc->System_GetSystemInfo();
|
if(pSystemInfo==NULL) return 0;
|
|
m_pDefectPicker = new CDefectPicker();
|
nCount++;
|
|
return nCount;
|
}
|
|
void CReviewInterface::DeinitDefectPicker()
|
{
|
if (m_pDefectPicker)
|
{
|
delete m_pDefectPicker;
|
m_pDefectPicker = NULL;
|
TRACE(_T("[A2E]DeinitDefectPicker\n"));
|
}
|
}
|
|
// Review Scheduler
|
int CReviewInterface::InitReviewScheduler()
|
{
|
if (m_pReviewScheduler)
|
{
|
delete m_pReviewScheduler;
|
}
|
m_pReviewScheduler = NULL;
|
|
const CSystemInfo* pSystemInfo = m_pDoc->System_GetSystemInfo();
|
if(pSystemInfo==NULL) return 0;
|
|
switch(pSystemInfo->m_nLineType)
|
{
|
case SystemLine_CPJT:
|
m_pReviewScheduler = new CPathScheduler_Dual_Active_TSP();
|
break;
|
|
default:
|
m_pReviewScheduler = new CPathScheduler();
|
break;
|
}
|
|
if (m_pReviewScheduler==NULL) { return 0; }
|
|
m_pReviewScheduler->SetPointInfo(10, 200);
|
|
CString strPath = _REVIEW_SERVER_BASE_PATH_;
|
strPath += _T("\\MotionInfo.ini");
|
|
if (m_pReviewScheduler->LoadPathSchedulerParam(strPath)==FALSE)
|
{
|
delete m_pReviewScheduler;
|
m_pReviewScheduler = NULL;
|
return 0;
|
}
|
|
// set scheduler param
|
CPathSchedulerParm* pPathSchedulerParm = m_pReviewScheduler->GetPathSchedulerParam();
|
if (pPathSchedulerParm)
|
{
|
pPathSchedulerParm->SetCollisionDistX(int(pSystemInfo->m_dCollisionDistance*1000));
|
pPathSchedulerParm->SetCollisionDistY(50);
|
pPathSchedulerParm->SetModuleCount(pSystemInfo->GetGantryInfoCount());
|
|
|
STransferData* pTransferData = ISP2P_GetCurrentTransferData();
|
if (pSystemInfo==NULL || pTransferData==NULL) return 0;
|
|
|
// glass info
|
const CGlassTypeInfo* pGlassTypeInfo = ISP2P_System_GetGlassTypeInfo(_ttoi(pTransferData->strGlassScanSchedule)); /////////////////////// 임시코드 smok
|
|
if (pGlassTypeInfo)
|
{
|
pPathSchedulerParm->SetCenterCoord(pGlassTypeInfo->m_bUseCenterCoodinateSystem);
|
pPathSchedulerParm->SetOriginDir(pGlassTypeInfo->m_nOriginDirection);
|
pPathSchedulerParm->SetGlassSizeX(pGlassTypeInfo->m_nGlassSizeX*1000);
|
pPathSchedulerParm->SetGlassSizeY(pGlassTypeInfo->m_nGlassSizeY*1000);
|
}
|
}
|
|
return 1;
|
}
|
|
void CReviewInterface::DeinitReviewScheduler()
|
{
|
TRACE(_T("[A2E]DeinitReviewScheduler\n"));
|
|
if(m_pReviewScheduler)
|
{
|
delete m_pReviewScheduler;
|
m_pReviewScheduler = NULL;
|
TRACE(_T("[A2E]DeinitReviewScheduler\n"));
|
}
|
}
|
|
// Coord Calibrator
|
int CReviewInterface::InitCoordCalibrator()
|
{
|
if (m_pDoc==NULL) return 0;
|
|
if (m_pCoordCalibrator)
|
{
|
delete m_pCoordCalibrator;
|
m_pCoordCalibrator = NULL;
|
}
|
|
m_pCoordCalibrator = new CCoordCalibrator();
|
if (m_pCoordCalibrator==NULL)
|
{
|
return 0;
|
}
|
|
const CMotorControlInfo* pMotorInfo = m_pDoc->System_GetMotorInfo();
|
if (pMotorInfo == NULL) return 0;
|
|
// if (pMotorInfo->m_bUseCheckMotorOffset)
|
// {
|
// m_pCoordCalibrator->SetARMotorInfo(pMotorInfo->m_ndirectionX, pMotorInfo->m_ndirectionY, pMotorInfo->m_dOffsetX, pMotorInfo->m_dOffsetY);
|
// }
|
|
return 1;
|
}
|
|
void CReviewInterface::DeinitCoordCalibrator()
|
{
|
if (m_pCoordCalibrator)
|
{
|
delete m_pCoordCalibrator;
|
m_pCoordCalibrator = NULL;
|
}
|
}
|
|
void CReviewInterface::IMC2P_AxisMotionEnd(int nIndex, int nAxisIdx, BOOL bMotionEnd)
|
{
|
CString strValue = _T("");
|
strValue.Format(_T("%d Axis MotionEnd => %d"), nAxisIdx, bMotionEnd);
|
g_pLog->DisplayMessage(strValue);
|
}
|
|
void CReviewInterface::IMC2P_GantryMotionEnd(int nIndex, int nGantryIdx, BOOL bMotionEnd)
|
{
|
if (bMotionEnd==FALSE) { return; }
|
if (nGantryIdx<0 || nGantryIdx>=(int)m_vecReviewCameraControl.size()) { return; }
|
|
CCameraControlReview* pCamera = m_vecReviewCameraControl[nGantryIdx];
|
if (pCamera==NULL) return;
|
|
::Sleep(100);
|
|
CCHImageData imageData;
|
if (pCamera->GetLiveImage(nGantryIdx, &imageData)==FALSE) { return; }
|
}
|
|
void CReviewInterface::IMC2P_UpdatePosition(int nIndex, int nAxisIdx, double dPosition)
|
{
|
BOOL bUpdate;
|
CString strMessage;
|
SAxisIndex* pAxisIndex = NULL;
|
SMotorPosition* pMotorPosition = NULL;
|
|
for (VectorModuleStatusIt it=m_vecModuleStatus.begin(); it!=m_vecModuleStatus.end(); it++)
|
{
|
bUpdate = FALSE;
|
|
SAxisIndex *pAxisIndex = it->GetAxisIndex();
|
SMotorPosition *pMotorPosition = it->GetMotorPosition();
|
|
if (pAxisIndex->nAxisIndexX==nAxisIdx)
|
{
|
pMotorPosition->dMotorPosX = dPosition;
|
bUpdate = TRUE;
|
}
|
else if (pAxisIndex->nAxisIndexY==nAxisIdx)
|
{
|
pMotorPosition->dMotorPosY = dPosition;
|
bUpdate = TRUE;
|
}
|
else if (pAxisIndex->nAxisIndexSx==nAxisIdx)
|
{
|
//pMotorPosition->dMotorPosX = dPosition;
|
//bUpdate = TRUE;
|
}
|
|
if (bUpdate)
|
{
|
UpdateMotorPosition(it->GetModuleIndex(), it->GetSelected(), pMotorPosition);
|
CDitGlassRawClient* dit = CDitGlassRawClient::GetInstance();
|
|
// update glass pos to aoi shared memory
|
CCoordCalibrator* pCoordCalibrator = ISP2P_GetCoordCalibrator();
|
SCoordInfo* pCoordInfo = it->GetCoordInfo();
|
if (pCoordCalibrator && pCoordInfo)
|
{
|
m_pCoordCalibrator->TransMotor2Glass(pCoordInfo, pMotorPosition);
|
|
// _ProtocolReview* pProtocolData = ISP2P_GetAoiMemoryProtocol();
|
// if (pProtocolData)
|
// {
|
// if (pAxisIndex->nAxisIndexX==nAxisIdx)
|
// pProtocolData->SetModuleGlassPosX(it->GetModuleIndex(), int(pMotorPosition->dGlassPosX*1000.0));
|
//
|
// else if (pAxisIndex->nAxisIndexY==nAxisIdx)
|
// pProtocolData->SetModuleGlassPosY(it->GetModuleIndex(), int(pMotorPosition->dGlassPosY*1000.0));
|
// }
|
}
|
}
|
}
|
}
|
|
void CReviewInterface::IMC2P_UpdateStatus(int nIndex, int nAxisIdx, long lStatus)
|
{
|
for (VectorModuleStatusIt it=m_vecModuleStatus.begin(); it!=m_vecModuleStatus.end(); it++)
|
{
|
BOOL bUpdate = FALSE;
|
|
SAxisIndex *pAxisIndex = it->GetAxisIndex();
|
SMotorStatus *pMotorStatus = it->GetMotorStatus();
|
|
if (pAxisIndex->nAxisIndexX==nAxisIdx)
|
{
|
pMotorStatus->lMotorStatusX = lStatus;
|
bUpdate = TRUE;
|
}
|
else if (pAxisIndex->nAxisIndexY==nAxisIdx)
|
{
|
pMotorStatus->lMotorStatusY = lStatus;
|
bUpdate = TRUE;
|
}
|
else if (pAxisIndex->nAxisIndexSx==nAxisIdx)
|
{
|
pMotorStatus->lMotorStatusSx = lStatus;
|
bUpdate = TRUE;
|
}
|
|
if (bUpdate)
|
{
|
UpdateMotorStatus(it->GetModuleIndex(), pMotorStatus);
|
}
|
}
|
}
|
|
void CReviewInterface::IMC2P_UpdateThetaPosition(int nIndex, double dPosition)
|
{
|
m_sThetaMotorInfo.dPosition = dPosition;
|
|
UpdateThetaMotorInfo(&m_sThetaMotorInfo);
|
}
|
|
void CReviewInterface::IMC2P_UpdateThetaStatus(int nIndex, long lStatus)
|
{
|
m_sThetaMotorInfo.lStatus = lStatus;
|
|
UpdateThetaMotorInfo(&m_sThetaMotorInfo);
|
}
|
|
void CReviewInterface::IMC2P_DisplayMessage(int nIndex, const TCHAR* lpstrFormat, ...)
|
{
|
va_list list;
|
TCHAR strText[2000] = {0};
|
|
va_start(list, lpstrFormat);
|
_vstprintf_s(strText, lpstrFormat, list);
|
va_end(list);
|
|
g_pLog->DisplayMessage(strText);
|
|
}
|
|
void CReviewInterface::IMC2P_WsiGantrySoftWareTrigger(int nIndex, int nGantryIdx, int nTrigger)
|
{
|
//WSI 정보 채우기
|
|
//// gantry에 header 1개, camera 1개일 경우
|
//int nModuleIndex = -1;
|
//int nModuleCount = Module_GetModuleStatusCount();
|
//for (int nIdx=0; nIdx<nModuleCount; nIdx++)
|
//{
|
// CModuleStatus* pModuleStatus = Module_GetModuleStatus(nIdx);
|
// if (pModuleStatus == NULL) continue;
|
|
// if (pModuleStatus->GetGantryIndex() == nGantryIdx)
|
// nModuleIndex = pModuleStatus->GetModuleIndex();
|
//}
|
|
//if (nModuleIndex < 0) return;
|
|
//CCameraControlReview *pCameraControlReview = ISP2P_GetReviewCameraControl(nModuleIndex);
|
//if (pCameraControlReview==NULL) return;
|
|
//// send trigger to camera
|
|
//pCameraControlReview->SetCameraSoftwareTrigger(nModuleIndex);
|
|
}
|
|
|
|
void CReviewInterface::IMC2P_GantrySoftWareTrigger(int nIndex, int nGantryIdx, int nTrigger)
|
{
|
// gantry에 header 1개, camera 1개일 경우
|
int nModuleIndex = -1;
|
int nModuleCount = Module_GetModuleStatusCount();
|
for (int nIdx=0; nIdx<nModuleCount; nIdx++)
|
{
|
CModuleStatus* pModuleStatus = Module_GetModuleStatus(nIdx);
|
if (pModuleStatus == NULL) continue;
|
|
if (pModuleStatus->GetGantryIndex() == nGantryIdx)
|
nModuleIndex = pModuleStatus->GetModuleIndex();
|
}
|
|
if (nModuleIndex < 0) return;
|
|
CCameraControlReview *pCameraControlReview = ISP2P_GetReviewCameraControl(nModuleIndex);
|
if (pCameraControlReview==NULL) return;
|
|
// send trigger to camera
|
|
pCameraControlReview->SetCameraSoftwareTrigger(nModuleIndex);
|
}
|
|
BOOL CReviewInterface::IWC2P_SetMeasureInfo(int nModuleIndex, int nPointIndex, const CString& strImageFilename, int nWsiType)
|
{
|
if (m_pDoc==NULL) return FALSE;
|
CGlassResult *pGlassResult = m_pDoc->GlassResult_GetCurrentGlassResult();
|
if (pGlassResult==NULL) return FALSE;
|
|
CReviewResult *pCamera = NULL;
|
|
switch(GetCurrentWsiMode())
|
{
|
case WsiMeasureType_Normal:
|
{
|
pCamera= pGlassResult->GetWsiResult(nModuleIndex);
|
}
|
break;
|
case WsiMeasureType_Monomer:
|
{
|
pCamera= pGlassResult->GetWsiReflowResult(nModuleIndex);
|
}
|
break;
|
case WsiMeasureType_User:
|
{
|
pCamera= pGlassResult->GetWsiUserResult(nModuleIndex);
|
}
|
break;
|
case WsiMeasureType_MultiShot:
|
{
|
pCamera = pGlassResult->GetWsiMultiShotResult(nModuleIndex);
|
}
|
break;
|
|
default:
|
break;
|
}
|
|
if (pCamera==NULL) return FALSE;
|
|
SReviewResult *pResult = pCamera->GetSReviewResult(nPointIndex);
|
if (pResult==NULL) return FALSE;
|
|
pResult->strUploadImgFileName = strImageFilename;
|
|
//WSI 이미지 이름 받아오고 공유 메모리 및 서버 피시에 이미지 카피
|
//0129 cmark
|
CDitGlassRawClient * pDitGlassRawClient = CDitGlassRawClient::GetInstance();
|
_grmDefectData* pSharedDefect = pDitGlassRawClient->GetDefectData(pResult->nDefectidx2);
|
_grmDefectReviewData * pSharedDefectReview = &pSharedDefect->m_ReviewDefect;
|
_grmGlassData* pSharedGlassData = pDitGlassRawClient->GetGlassData();
|
|
CString strTarget;
|
CString strWSIImageFileName = m_pReviewProcessor->MakeWSIImageFileName(pResult);
|
CString UploadFilePath,FilePath,RTMSFilePath;
|
//원본
|
//향후 WSI 이미지 네임에 01 붙으면 3D 이미지 02 면 그레이 이미지
|
|
const CNetworkInfo * pNetworkInfo =m_pDoc->System_GetNetworkInfo();
|
if(pNetworkInfo == NULL){
|
g_pLog->DisplayMessage(_T("[ReviewInterface] pNetworkInfo is Null"));
|
strTarget.Format(_T("\\\\126.100.100.200\\d\\DIT\\WSI\\Upload\\%s\\%s"),pGlassResult->m_strGlassID,pResult->strUploadImgFileName);
|
}
|
else{
|
strTarget.Format(pNetworkInfo->m_strWsiImagePath+_T("\\%s\\%s"),pGlassResult->m_strGlassID,pResult->strUploadImgFileName);
|
}
|
|
//복사
|
UploadFilePath.Format(_T("%s\\%s"),m_pReviewProcessor->GetUploadImagePath(),strWSIImageFileName);
|
//UploadFilePath.Format(_T("D:\\ResultData\\Upload\\\Image\\%s\\WSI\\%s.jpg"),pGlassResult->m_strGlassID,strWSIImageFileName);
|
FilePath.Format(_T("D:\\ResultData\\Image\\WSI\\%s.jpg"),strWSIImageFileName);
|
|
//size_t CharactersConverted;
|
//wcstombs_s(&CharactersConverted, pSharedDefectReview->m_strWsi_3DImageFilename, strWSIImageFileName, _TRUNCATE);
|
strcpy(pSharedDefectReview->m_strWsi_3DImageFilename,strWSIImageFileName);
|
|
//RTMSFilePath.Format(_T("D:\\DitRtms\\Data\\ReviewImage\\%s\\%s\\%s\\%s.jpg"),pGlassResult->m_strOperID,pGlassResult->m_strLotID,pGlassResult->m_strGlassID,strWSIImageFileName);
|
BOOL aa =CopyFile(strTarget,UploadFilePath,FALSE);
|
CopyFile(strTarget,FilePath,FALSE);
|
//CopyFile(strTarget,RTMSFilePath,FALSE);
|
|
g_pLog->DisplayMessage(_T("[WSI_%d] %d Result => %s"), nModuleIndex, nPointIndex, UploadFilePath);
|
g_pLog->DisplayMessage(_T("[WSI] %s"),pResult->strDefectType);
|
return TRUE;
|
}
|
|
BOOL CReviewInterface::IWC2P_SetMeasureInfo(int nIndex, int nPointIndex, const CString& strImagFilename, const CString& strImagFilename2)
|
{
|
if (m_pDoc == NULL) return FALSE;
|
CGlassResult *pGlassResult = m_pDoc->GlassResult_GetCurrentGlassResult();
|
if (pGlassResult == NULL) return FALSE;
|
|
CReviewResult *pCamera = NULL;
|
|
switch (GetCurrentWsiMode())
|
{
|
case WsiMeasureType_Normal:
|
{
|
pCamera = pGlassResult->GetWsiResult(nIndex);
|
}
|
break;
|
case WsiMeasureType_Monomer:
|
{
|
pCamera = pGlassResult->GetWsiReflowResult(nIndex);
|
}
|
break;
|
case WsiMeasureType_User:
|
{
|
pCamera = pGlassResult->GetWsiUserResult(nIndex);
|
}
|
break;
|
case WsiMeasureType_MultiShot:
|
{
|
pCamera = pGlassResult->GetWsiMultiShotResult(nIndex);
|
}
|
break;
|
default:
|
break;
|
}
|
|
if (pCamera == NULL) return FALSE;
|
|
SReviewResult *pResult = pCamera->GetSReviewResult(nPointIndex);
|
if (pResult == NULL) return FALSE;
|
|
pResult->strUploadImgFileName = strImagFilename;
|
pResult->strUploadImgFileName2 = strImagFilename2;
|
|
//WSI 이미지 이름 받아오고 공유 메모리 및 서버 피시에 이미지 카피
|
//0129 cmark
|
CDitGlassRawClient * pDitGlassRawClient = CDitGlassRawClient::GetInstance();
|
_grmDefectData* pSharedDefect = pDitGlassRawClient->GetDefectData(pResult->nDefectidx2);
|
_grmDefectReviewData * pSharedDefectReview = &pSharedDefect->m_ReviewDefect;
|
_grmGlassData* pSharedGlassData = pDitGlassRawClient->GetGlassData();
|
|
CString strTarget,strTarget2;
|
CString strWSIImageFileName = m_pReviewProcessor->MakeWSIImageFileName(pResult);
|
CString UploadFilePath, FilePath, RTMSFilePath, IntensityFilePath;
|
|
//여기가 진짜
|
const CNetworkInfo * pNetworkInfo = m_pDoc->System_GetNetworkInfo();
|
if (nIndex == 0)
|
{
|
strTarget.Format(_T("\\\\126.100.100.6\\d\\DIT\\WSI\\Upload\\%s\\%s"), pGlassResult->m_strGlassID, pResult->strUploadImgFileName);
|
strTarget2.Format(_T("\\\\126.100.100.6\\d\\DIT\\WSI\\Upload\\%s\\%s"), pGlassResult->m_strGlassID, pResult->strUploadImgFileName2);
|
}
|
else
|
{
|
strTarget.Format(_T("\\\\126.100.100.7\\d\\DIT\\WSI\\Upload\\%s\\%s"), pGlassResult->m_strGlassID, pResult->strUploadImgFileName);
|
strTarget2.Format(_T("\\\\126.100.100.7\\d\\DIT\\WSI\\Upload\\%s\\%s"), pGlassResult->m_strGlassID, pResult->strUploadImgFileName2);
|
}
|
|
//복사
|
UploadFilePath.Format(_T("%s\\WSI\\%s.jpg"), m_pReviewProcessor->GetUploadImagePath(), strWSIImageFileName);
|
IntensityFilePath.Format(_T("%s\\WSI\\%s_Intensity.jpg"), m_pReviewProcessor->GetUploadImagePath(), strWSIImageFileName);
|
RTMSFilePath.Format(_T("\\\\126.100.100.5\\Reviewimage\\%s\\%s\\WSI_%s.jpg"), pGlassResult->m_strRTMSStepID, pGlassResult->m_strGlassID, strWSIImageFileName); //taek 210127 RTMS
|
//UploadFilePath.Format(_T("D:\\ResultData\\Upload\\\Image\\%s\\WSI\\%s.jpg"),pGlassResult->m_strGlassID,strWSIImageFileName);
|
//FilePath.Format(_T("D:\\ResultData\\Image\\WSI\\%s.jpg"),strWSIImageFileName);
|
|
//size_t CharactersConverted;
|
|
//wcstombs_s(&CharactersConverted, pSharedDefectReview->m_strWsi_3DImageFilename, strWSIImageFileName, _TRUNCATE);
|
|
strcpy(pSharedDefectReview->m_strWsi_3DImageFilename, strWSIImageFileName);
|
|
if (pSharedDefectReview->m_nPlanType == ditRaw::RTP_WsiReflow || pSharedDefectReview->m_nPlanType == ditRaw::RTP_UserWsi)
|
{
|
|
//wcstombs_s(&CharactersConverted, pSharedDefectReview->m_strRevImageName , strWSIImageFileName, _TRUNCATE);
|
strcpy(pSharedDefectReview->m_strRevImageName, strWSIImageFileName);
|
}
|
|
|
//RTMSFilePath.Format(_T("D:\\DitRtms\\Data\\ReviewImage\\%s\\%s\\%s\\%s.jpg"),pGlassResult->m_strOperID,pGlassResult->m_strLotID,pGlassResult->m_strGlassID,strWSIImageFileName);
|
BOOL aa = CopyFile(strTarget, UploadFilePath, FALSE);
|
BOOL bb = CopyFile(strTarget2, IntensityFilePath, FALSE);
|
CopyFile(strTarget, FilePath, FALSE);
|
CopyFile(strTarget2, FilePath, FALSE);
|
CopyFile(strTarget, RTMSFilePath, FALSE); //taek 210126 rtms upload
|
CopyFile(strTarget2, RTMSFilePath, FALSE);
|
|
g_pLog->DisplayMessage(_T("[WSI]Upload WSI Image Name DefectIdx [%d] "), pResult->nDefectidx2);
|
g_pLog->DisplayMessage(_T("[WSI_%d] %d Result => %s"), nIndex, nPointIndex, UploadFilePath);
|
g_pLog->DisplayMessage(_T("[WSI] Defect Type : %s"), pResult->strDefectType);
|
return TRUE;
|
}
|
|
BOOL CReviewInterface::IWC2P_SetMeasureInfo( int nIndex, int nPointIndex, const CString& strImagFilename )
|
{
|
if (m_pDoc==NULL) return FALSE;
|
CGlassResult *pGlassResult = m_pDoc->GlassResult_GetCurrentGlassResult();
|
if (pGlassResult==NULL) return FALSE;
|
|
CReviewResult *pCamera = NULL;
|
|
switch(GetCurrentWsiMode())
|
{
|
case WsiMeasureType_Normal:
|
{
|
pCamera= pGlassResult->GetWsiResult(nIndex);
|
}
|
break;
|
case WsiMeasureType_Monomer:
|
{
|
pCamera= pGlassResult->GetWsiReflowResult(nIndex);
|
}
|
break;
|
case WsiMeasureType_User:
|
{
|
pCamera= pGlassResult->GetWsiUserResult(nIndex);
|
}
|
break;
|
case WsiMeasureType_MultiShot:
|
{
|
pCamera = pGlassResult->GetWsiMultiShotResult(nIndex);
|
}
|
break;
|
default:
|
break;
|
}
|
|
if (pCamera==NULL) return FALSE;
|
|
SReviewResult *pResult = pCamera->GetSReviewResult(nPointIndex);
|
if (pResult==NULL) return FALSE;
|
|
pResult->strUploadImgFileName = strImagFilename;
|
|
//WSI 이미지 이름 받아오고 공유 메모리 및 서버 피시에 이미지 카피
|
//0129 cmark
|
CDitGlassRawClient * pDitGlassRawClient = CDitGlassRawClient::GetInstance();
|
_grmDefectData* pSharedDefect = pDitGlassRawClient->GetDefectData(pResult->nDefectidx2);
|
_grmDefectReviewData * pSharedDefectReview = &pSharedDefect->m_ReviewDefect;
|
_grmGlassData* pSharedGlassData = pDitGlassRawClient->GetGlassData();
|
|
CString strTarget;
|
CString strWSIImageFileName = m_pReviewProcessor->MakeWSIImageFileName(pResult);
|
CString UploadFilePath,FilePath,RTMSFilePath;
|
|
//여기가 진짜
|
const CNetworkInfo * pNetworkInfo = m_pDoc->System_GetNetworkInfo();
|
if (nIndex==0)
|
{
|
// if (pNetworkInfo == NULL) {
|
// g_pLog->DisplayMessage(_T("pNetworkInfo is Null"));
|
strTarget.Format(_T("\\\\126.100.100.6\\d\\DIT\\WSI\\Upload\\%s\\%s"), pGlassResult->m_strGlassID, pResult->strUploadImgFileName);
|
// }
|
// else {
|
// strTarget.Format(pNetworkInfo->m_strWsiImagePath + _T("\\%s\\%s"), pGlassResult->m_strGlassID, pResult->strUploadImgFileName);
|
// }
|
}
|
else
|
{
|
// if (pNetworkInfo == NULL) {
|
// g_pLog->DisplayMessage(_T("pNetworkInfo is Null"));
|
strTarget.Format(_T("\\\\126.100.100.7\\d\\DIT\\WSI\\Upload\\%s\\%s"), pGlassResult->m_strGlassID, pResult->strUploadImgFileName);
|
// }
|
// else {
|
// strTarget.Format(pNetworkInfo->m_strWsiImagePath + _T("\\%s\\%s"), pGlassResult->m_strGlassID, pResult->strUploadImgFileName);
|
// }
|
}
|
|
//복사
|
UploadFilePath.Format(_T("%s\\WSI\\%s.jpg"),m_pReviewProcessor->GetUploadImagePath(),strWSIImageFileName);
|
RTMSFilePath.Format(_T("\\\\126.100.100.5\\Reviewimage\\%s\\%s\\WSI_%s.jpg"), pGlassResult->m_strRTMSStepID, pGlassResult->m_strGlassID, strWSIImageFileName); //taek 210127 RTMS
|
//UploadFilePath.Format(_T("D:\\ResultData\\Upload\\\Image\\%s\\WSI\\%s.jpg"),pGlassResult->m_strGlassID,strWSIImageFileName);
|
//FilePath.Format(_T("D:\\ResultData\\Image\\WSI\\%s.jpg"),strWSIImageFileName);
|
|
//size_t CharactersConverted;
|
|
//wcstombs_s(&CharactersConverted, pSharedDefectReview->m_strWsi_3DImageFilename, strWSIImageFileName, _TRUNCATE);
|
|
strcpy(pSharedDefectReview->m_strWsi_3DImageFilename,strWSIImageFileName);
|
|
if(pSharedDefectReview->m_nPlanType ==ditRaw::RTP_WsiReflow||pSharedDefectReview->m_nPlanType ==ditRaw::RTP_UserWsi)
|
{
|
|
//wcstombs_s(&CharactersConverted, pSharedDefectReview->m_strRevImageName , strWSIImageFileName, _TRUNCATE);
|
strcpy(pSharedDefectReview->m_strRevImageName,strWSIImageFileName);
|
}
|
|
|
//RTMSFilePath.Format(_T("D:\\DitRtms\\Data\\ReviewImage\\%s\\%s\\%s\\%s.jpg"),pGlassResult->m_strOperID,pGlassResult->m_strLotID,pGlassResult->m_strGlassID,strWSIImageFileName);
|
BOOL aa =CopyFile(strTarget,UploadFilePath,FALSE);
|
CopyFile(strTarget,FilePath,FALSE);
|
CopyFile(strTarget,RTMSFilePath,FALSE); //taek 210126 rtms upload
|
|
g_pLog->DisplayMessage(_T("[WSI]Upload WSI Image Name DefectIdx [%d] "),pResult->nDefectidx2);
|
g_pLog->DisplayMessage(_T("[WSI_%d] %d Result => %s"), nIndex, nPointIndex, UploadFilePath);
|
g_pLog->DisplayMessage(_T("[WSI] Defect Type : %s"),pResult->strDefectType);
|
return TRUE;
|
}
|
|
BOOL CReviewInterface::IWC2P_GetMeasureInfo(int nModuleIndex, int nPointIndex, short& nLoc, short& nOptic, short& nGray, CString& strCellID)
|
{
|
if (m_pDoc==NULL) return FALSE;
|
CGlassResult *pGlassResult = m_pDoc->GlassResult_GetCurrentGlassResult();
|
if (pGlassResult==NULL) return FALSE;
|
|
const CReviewResult *pCamera = NULL;
|
|
switch(GetCurrentWsiMode())
|
{
|
case WsiMeasureType_Normal:
|
{
|
pCamera= pGlassResult->GetWsiResult(nModuleIndex);
|
}
|
break;
|
case WsiMeasureType_Monomer:
|
{
|
pCamera= pGlassResult->GetWsiReflowResult(nModuleIndex);
|
}
|
break;
|
case WsiMeasureType_User:
|
{
|
pCamera= pGlassResult->GetWsiUserResult(nModuleIndex);
|
}
|
break;
|
case WsiMeasureType_MultiShot:
|
{
|
pCamera = pGlassResult->GetWsiMultiShotResult(nModuleIndex);
|
}
|
break;
|
default:
|
break;
|
}
|
|
if (pCamera==NULL) return FALSE;
|
|
const SReviewResult *pResult = pCamera->GetSReviewResult(nPointIndex);
|
if (pResult==NULL) return FALSE;
|
|
nLoc = pResult->nLocation;
|
nOptic = pResult->nOpticType;
|
nGray = pResult->nGrayType;
|
strCellID = pResult->strCellID;
|
|
return TRUE;
|
}
|
|
int CReviewInterface::IWC2P_GetCurrentStatus(int nModuleIndex, CString& strGlassID, CString& strRecipeID, int& nType )
|
{
|
if (m_pDoc==NULL || m_pSequenceProcessor==NULL) return -1;
|
CGlassResult *pGlassResult = m_pDoc->GlassResult_GetCurrentGlassResult();
|
if (pGlassResult==NULL) return -1;
|
|
if (m_pSequenceProcessor->GetProcessStatus()==ProcessLoading || m_pSequenceProcessor->GetProcessStatus()==ProcessAlignStart || m_pSequenceProcessor->GetProcessStatus()==ProcessReadRawFile)
|
{
|
strGlassID = *pGlassResult->GetJobID(); // pGlassResult->.GetGlassID() -> pGlassResult->GetJobID()
|
strRecipeID = *pGlassResult->GetPPID();
|
|
return WMT_MeasureReady;
|
}
|
|
return -1;
|
}
|
|
void CReviewInterface::IWC2P_SetConnectedStatus(int nModuleIndex, int nConnectStatus)
|
{
|
CString strMessage = _T("");
|
|
if (nConnectStatus==1)
|
strMessage.Format(_T("[WSI_%d] Network is Connected!"), nModuleIndex);
|
else
|
strMessage.Format(_T("[WSI_%d] Network is Disconnected!"), nModuleIndex);
|
|
g_pLog->DisplayMessage(strMessage);
|
}
|
|
void CReviewInterface::IWC2P_RecvMeasureMessage(int nModuleIndex, int nMessageType, int nMessageResult)
|
{
|
CString strMessage = _T("");
|
CString strResult = _T("");
|
|
if (nMessageResult==1)
|
strResult.Format(_T("Success!"));
|
else
|
strResult.Format(_T("Fail!"));
|
|
switch(nMessageType)
|
{
|
case WMT_MeasureReady:
|
strMessage.Format(_T("[WSI_%d]MeasureReady Recevied "), nModuleIndex);
|
m_pSequenceProcessor->SetCheckWSIEnd(0);//190725 chm wsi end 여부
|
m_pSequenceProcessor->WSIReadyProcess(nMessageResult);
|
break;
|
|
case WMT_MeasureStart:
|
strMessage.Format(_T("[WSI_%d]MeasureStart Recevied "), nModuleIndex);
|
m_pSequenceProcessor->WSIStartProcess(nMessageResult);
|
break;
|
|
case WMT_MeasureMotionEnd:
|
strMessage.Format(_T("[WSI_%d] MeasureMotionEnd Ack Recevied "), nModuleIndex);
|
break;
|
|
case WMT_MeasureEnd:
|
strMessage.Format(_T("[WSI_%d]MeasureEnd Recevied "), nModuleIndex);
|
m_pSequenceProcessor->SetCheckWSIEnd(1);//190725 chm wsi end 여부
|
strMessage.Format(_T("[WSI_%d] SetCheckWSIEnd %d "),nModuleIndex, m_pSequenceProcessor->GetCheckWSIEnd());
|
break;
|
|
case WMT_MeasureTimeout:
|
strMessage.Format(_T("[WSI_%d]MeasureTimeout Recevied "), nModuleIndex);
|
break;
|
|
//// 20170713 smok. MOTION END MONITERING ////
|
// case WMT_MeasurePosition:
|
// strMessage.Format(_T("[WSI_%d]MeasurePosition Recevied "), nModuleIndex);
|
// break;
|
//////////////////////////////////////////////
|
|
}
|
|
strMessage += strResult;
|
g_pLog->DisplayMessage(strMessage);
|
|
// measure end
|
if (nMessageType==WMT_MeasureEnd)
|
{
|
//2014-04-25, Send ReviewEnd Signal
|
g_pLog->DisplayMessage(_T("[ReviwInterface] %02d Module WSI Measure End"),nModuleIndex);
|
// WSI 종료 프로세스 추가, WSI 종료후 리뷰 엔드 처리 안되는 현상 수정 [6/16/2017 bhs]
|
// m_pReviewProcessor->PostProcessWsiResult(nModuleIndex, NULL); // 20180502 smok WSI 이후 Plan 수행 되지 않아 제거
|
}
|
//// 20170713 smok. MOTION END MONITERING ////
|
// if(nMessageType == WMT_MeasurePosition)
|
// {
|
// SMotorPosition *pPos = Module_GetMotorPosition(nModuleIndex);
|
// g_pLog->DisplayMessage(_T("[ReviwInterface] Motor pos %d, %d send to WSI"),(int)(pPos->dMotorPosX*1000.), (int)(pPos->dMotorPosY*1000.));
|
// m_vecWSIControl[nModuleIndex]->NetProcess_WC_CURRENT_MOTOR_POSITION((int)(pPos->dMotorPosX*1000.), (int)(pPos->dMotorPosY*1000.));
|
// }
|
//////////////////////////////////////////////
|
}
|
|
void CReviewInterface::IWC2P_SetMeasureResult(int nModuleIndex, const SWsiResult& measureResut)
|
{
|
if(m_pReviewProcessor == NULL)
|
{
|
g_pLog->DisplayMessage(_T("[ReviewInterface] ReviewProcessor NULL"));
|
return ;
|
}
|
|
switch(GetCurrentWsiMode())
|
{
|
case WsiMeasureType_Normal:
|
{
|
g_pLog->DisplayMessage(_T("[ReviwInterface] WSI Type is Defect!!!!"));
|
m_pReviewProcessor->AddWsiResultData(nModuleIndex, measureResut);
|
m_pSequenceProcessor->RecvWSIResult(nModuleIndex, measureResut);
|
}
|
break;
|
case WsiMeasureType_Monomer:
|
{
|
g_pLog->DisplayMessage(_T("[ReviwInterface] WSI Type is Reflow!!!!"));
|
m_pReviewProcessor->AddWsiReflowResultData(nModuleIndex, measureResut);
|
m_pSequenceProcessor->RecvWSIReflowResult(nModuleIndex, measureResut);
|
}
|
break;
|
case WsiMeasureType_User:
|
{
|
g_pLog->DisplayMessage(_T("[ReviwInterface] WSI Type is User!!!!"));
|
m_pReviewProcessor->AddWsiUserResultData(nModuleIndex, measureResut);
|
m_pSequenceProcessor->RecvWSIUserResult(nModuleIndex, measureResut);
|
}
|
break;
|
case WsiMeasureType_MultiShot:
|
{
|
g_pLog->DisplayMessage(_T("[ReviwInterface] WSI Type is MultiShot!!!!"));
|
m_pReviewProcessor->AddWsiMultiShotResultData(nModuleIndex, measureResut);
|
//m_pSequenceProcessor->RecvWSIMultiShotResult(nModuleIndex, measureResut);
|
}
|
break;
|
case WsiMeasureType_VLSI:
|
{
|
g_pLog->DisplayMessage(_T("[ReviwInterface] WSI Type is VLSI!!!!"));
|
m_pReviewProcessor->AddWsiVLSIResultData(nModuleIndex, measureResut);
|
|
//WSI자가진단 결과 채우기
|
if (m_pDiagnosisManager->GetDiagnosisResult_Wsi(nModuleIndex))
|
{
|
|
double dAccdata = measureResut.dAccuracy;
|
double dRbtdata = measureResut.dRepeatability;
|
double dDiagnosisHeight[10];
|
|
for (int i = 0; i < 10; i++)
|
{
|
dDiagnosisHeight[i] = measureResut.dDiagnosisHeight[i];
|
}
|
|
if (nModuleIndex == 0)
|
{
|
m_pDiagnosisManager->GetDiagnosisResult_Wsi(0)->SetACC(dAccdata);
|
m_pDiagnosisManager->GetDiagnosisResult_Wsi(0)->SetRTB(dRbtdata);
|
for (int i = 0; i < 10; i++)
|
{
|
m_pDiagnosisManager->GetDiagnosisResult_Wsi(0)->SetDiagnosisHeight(dDiagnosisHeight[i], i);
|
}
|
m_vecWSIControl[0]->SendWsiAfmSafePosMove();
|
}
|
else if (nModuleIndex == 1)
|
{
|
m_pDiagnosisManager->GetDiagnosisResult_Wsi(1)->SetACC(dAccdata);
|
m_pDiagnosisManager->GetDiagnosisResult_Wsi(1)->SetRTB(dRbtdata);
|
for (int i = 0; i < 10; i++)
|
{
|
m_pDiagnosisManager->GetDiagnosisResult_Wsi(1)->SetDiagnosisHeight(dDiagnosisHeight[i], i);
|
}
|
m_vecWSIControl[1]->SendWsiAfmSafePosMove();
|
}
|
|
|
m_pDlgDiagnosis->m_pDlgWsi->UpdateWSIResult(nModuleIndex,dAccdata, dAccdata, dRbtdata, dRbtdata);
|
|
m_pDlgDiagnosis->m_pDiagnosisManager->setWSIVLSIEnd(true);
|
}
|
|
//m_pSequenceProcessor->RecvWSIUserResult(nModuleIndex, measureResut);
|
}
|
break;
|
default:
|
break;
|
}
|
}
|
|
// light control 2 parent
|
void CReviewInterface::ILC2P_DisplayMessage(int nIndex, const TCHAR* lpstrFormat, ...)
|
{
|
|
}
|
void CReviewInterface::ILC2P_ChangeLightLevel(int nIndex, int nLevel)
|
{
|
|
}
|
|
void CReviewInterface::IAFC2P_DisplayMessage(int nIndex, const TCHAR* lpstrFormat, ...)
|
{
|
va_list list;
|
TCHAR strText[2000] = {0};
|
|
va_start(list, lpstrFormat);
|
_vstprintf_s(strText, lpstrFormat, list);
|
va_end(list);
|
|
g_pLog->DisplayMessage(strText);
|
}
|
void CReviewInterface::IAFC2P_CurrentStatus(int nIndex, int nStatusCode)
|
{
|
|
}
|
void CReviewInterface::IAFC2P_RecipeChangeComplete(int nIndex, int nResultCode)
|
{
|
|
}
|
|
// vcr control 2 parent
|
void CReviewInterface::IVCRC2P_DisplayMessage(int nIndex, const TCHAR* lpstrFormat, ...)
|
{
|
|
}
|
|
BOOL CReviewInterface::IVCRC2P_RecvDecodingData(int nIndex, CString& strCode)
|
{
|
return VCR_GetDecodingData(nIndex, strCode);
|
}
|
|
void CReviewInterface::IVCRC2P_SendDecodeTriggerSignal(int nIndex)
|
{
|
VCR_SetDecodeTriggerSignal(nIndex);
|
}
|
|
// signal control 2 parent
|
void CReviewInterface::ISC2P_DisplayMessage(int nIndex, const TCHAR* lpstrFormat, ...)
|
{
|
va_list list;
|
TCHAR strText[2000] = {0};
|
|
va_start(list, lpstrFormat);
|
_vstprintf_s(strText, lpstrFormat, list);
|
va_end(list);
|
|
g_pLog->DisplayMessage(strText);
|
}
|
|
void CReviewInterface::ISC2P_ReceiveSignal(int nIndex, int nSignalIndex, int nSignalValue, BOOL bOn)
|
{
|
if (m_pSequenceProcessor==NULL || nIndex<0) return;
|
|
// [2017:4:14]-[WEZASW] : B7 PCControl 요청 및 응답 Bit 분산으로 Address 추가.
|
switch (nSignalIndex)
|
{
|
case 10: // D2300
|
m_pSequenceProcessor->RecvCIMSignalToSignalControl(nSignalIndex, nSignalValue);
|
break;
|
|
default: // D2400
|
EnterCriticalSection(&m_csReviewSignal);
|
m_pSequenceProcessor->RecvSignalToSignalControl(nSignalIndex, nSignalValue, bOn);
|
LeaveCriticalSection(&m_csReviewSignal);
|
break;
|
}
|
}
|
|
void CReviewInterface::ISC2P_SetSignalStatus(int nReadSignal, int nSendSignal, BOOL alive)
|
{
|
if (m_pDoc==NULL) return;
|
if (nReadSignal==-1 || nSendSignal==-1) return;
|
|
SSignalIOStatus *pCurPCControlIOSignal = m_pDoc->Etc_GetPCControlIOSignal();
|
if (pCurPCControlIOSignal==NULL) return;
|
|
pCurPCControlIOSignal->nSignalRead = nReadSignal;
|
if (alive)
|
{
|
alive = FALSE;
|
return;
|
}
|
else
|
{
|
pCurPCControlIOSignal->nSignalWrite = nSendSignal;
|
}
|
|
UpdateSignalIOStatus(pCurPCControlIOSignal);
|
}
|
|
BOOL CReviewInterface::IACC2P_GetCurrentFrame(int nCameraIndex, int nFrameWidth, int nFrameHeight, int nFrameChannels, CCHImageData* pImageData)
|
{
|
if (m_pVirtualGlassMap==NULL) return FALSE;
|
|
//return FALSE;
|
|
//GlassTypeInfo Index NEED!!!!!!!!!!!!!!!!!!!!!!! 꼭 추가할 것
|
STransferData* pTransferData = ISP2P_GetCurrentTransferData();
|
if ( pTransferData==NULL) return FALSE;
|
|
const CGlassTypeInfo* pAlignPos = ISP2P_System_GetGlassTypeInfo(_ttoi(pTransferData->strGlassScanSchedule));
|
const CAlignCameraInfo* pCamInfo = ISP2P_System_GetAlignCameraInfo(nCameraIndex);
|
|
if (pAlignPos==NULL || pCamInfo==NULL) return FALSE;
|
|
CVirtualImageInfo imageInfo;
|
imageInfo.nFrameWidth = nFrameWidth;
|
imageInfo.nFrameHeight = nFrameHeight;
|
imageInfo.nFrameChannels = nFrameChannels;
|
|
if(nCameraIndex==0)
|
{
|
imageInfo.dCenterX = pAlignPos->m_dFirstAlignMotorX;
|
imageInfo.dCenterY = pAlignPos->m_dFirstAlignMotorY;
|
}
|
else
|
{
|
imageInfo.dCenterX = pAlignPos->m_dSecondAlignMotorX;
|
imageInfo.dCenterY = pAlignPos->m_dSecondAlignMotorY;
|
}
|
|
const CCameraControlInfo_Plus* pCameraControlInfo = pCamInfo->GetCameraControlInfo();
|
if(pCameraControlInfo == NULL) return FALSE;
|
|
imageInfo.dPixelSizeX = pCameraControlInfo->GetPixelResolution();
|
imageInfo.dPixelSizeY = pCameraControlInfo->GetPixelResolution();
|
|
return m_pVirtualGlassMap->GetImageData(imageInfo, pImageData);
|
}
|
|
void CReviewInterface::IACC2P_FrameCaptured(int nCameraIndex, int nFrameIndex, CCHImageData* pImageData)
|
{
|
if (pImageData==NULL || !pImageData->GetImageExist()) return;
|
|
SSharedImageInfo sharedImageInfo;
|
sharedImageInfo.nSelected = 1;
|
sharedImageInfo.nCameraIndex = nCameraIndex;
|
sharedImageInfo.nImageIndex = nFrameIndex;
|
|
sharedImageInfo.dRulerGab = 300.0; // um
|
sharedImageInfo.dResolution = 6.0; // um
|
|
sharedImageInfo.nImageWidth = pImageData->GetWidth();
|
sharedImageInfo.nImageHeight = pImageData->GetHeight();
|
sharedImageInfo.nImageWidthStep = pImageData->GetWidthStep();
|
sharedImageInfo.nImageChannels = pImageData->GetChannels();
|
|
|
if (m_pSharedImageData->SetImageData(nCameraIndex+2, &sharedImageInfo, (BYTE*)pImageData->GetImageBuffer()))
|
{
|
|
}
|
else
|
{
|
|
}
|
|
return;
|
}
|
|
void CReviewInterface::IACC2P_AlignResult(const CAlignResult& alignResult)
|
{
|
g_pLog->DisplayMessage(_T("[AlignResult] Align Find Process End!"));
|
|
if (m_pSequenceProcessor==NULL) return;
|
|
m_pSequenceProcessor->RecvAlignResult(&alignResult);
|
}
|
|
void CReviewInterface::IACC2P_CameraControl(int nValue)
|
{
|
if (m_pAlignCameraControl==NULL) return;
|
|
//m_pAlignCameraControl->Camera_Control(nValue);
|
}
|
|
BOOL CReviewInterface::IACC2P_SetLightLevel(int nCameraIndex, int nValue)
|
{
|
return AlignLight_SetLightLevel(nCameraIndex, nValue);
|
}
|
|
BOOL CReviewInterface::IACC2P_GetLightLevel(int nCameraIndex, int& nValue)
|
{
|
return AlignLight_GetLightLevel(nCameraIndex, nValue);
|
}
|
|
BOOL CReviewInterface::IRCC2P_GetCurrentFrame(int nModuleIndex, int nCameraIndex, int nFrameWidth, int nFrameHeight, int nFrameChannels, CCHImageData* pImageData)
|
{
|
if (m_pVirtualGlassMap==NULL) return FALSE;
|
|
const SMotorPosition* pMotorPos = Module_GetMotorPosition(nModuleIndex);
|
const SMagnificInfo* pMagInfo = Module_GetCurrentMagnificInfo(nModuleIndex);
|
const SCameraInfo* pCamInfo = Module_GetCameraInfo(nModuleIndex);
|
|
if (pMotorPos==NULL || pMagInfo==NULL || pCamInfo==NULL) return FALSE;
|
|
CVirtualImageInfo imageInfo;
|
imageInfo.nFrameWidth = nFrameWidth;
|
imageInfo.nFrameHeight = nFrameHeight;
|
imageInfo.nFrameChannels = nFrameChannels;
|
imageInfo.dCenterX = pMotorPos->dMotorPosX;
|
imageInfo.dCenterY = pMotorPos->dMotorPosY;
|
imageInfo.dPixelSizeX = pCamInfo->dResolution / pMagInfo->dMagnification;
|
imageInfo.dPixelSizeY = pCamInfo->dResolution / pMagInfo->dMagnification;
|
|
return m_pVirtualGlassMap->GetImageData(imageInfo, pImageData);
|
}
|
|
void CReviewInterface::IRCC2P_FrameCaptured(int nModuleIndex, int nCameraIndex, int nFrameIndex, CCHImageData* pImageData)
|
{
|
if (pImageData == NULL || !pImageData->GetImageExist()) return;
|
|
//if (nModuleIndex != Module_GetSelectedModuleIndex()) return;
|
|
// camera control
|
SCameraControl* pCameraControl = Module_GetCameraControl(nModuleIndex);
|
SCameraInfo* pCameraInfo = Module_GetCameraInfo(nModuleIndex, nCameraIndex);
|
if (pCameraControl == NULL || pCameraInfo == NULL) return;
|
|
// 배율정보
|
SMagnificInfo* pMagnificInfo = Module_GetMagnificInfo(nModuleIndex, pCameraControl->nZoomLevel);
|
if (pMagnificInfo == NULL) return;
|
|
SSharedImageInfo sharedImageInfo;
|
sharedImageInfo.nSelected = pCameraControl->bSelected;
|
sharedImageInfo.nCameraIndex = nCameraIndex;
|
sharedImageInfo.nImageIndex = nFrameIndex;
|
|
double dCameraResolution = pCameraInfo->dResolution;
|
double dMagnification = pMagnificInfo->dMagnification;
|
double dDigitalZoom = 1.0;
|
double dRulerGab = 50.0;
|
|
sharedImageInfo.dResolution = (dCameraResolution / dMagnification) / dDigitalZoom;
|
sharedImageInfo.dRulerGab = dRulerGab;
|
|
sharedImageInfo.nImageWidth = pImageData->GetWidth();
|
sharedImageInfo.nImageHeight = pImageData->GetHeight();
|
sharedImageInfo.nImageWidthStep = pImageData->GetWidthStep();
|
sharedImageInfo.nImageChannels = pImageData->GetChannels();
|
//sharedImageInfo.nUpdated = 1;
|
|
if (nModuleIndex == 1)
|
{
|
nModuleIndex = nModuleIndex;
|
}
|
|
if (m_pSharedImageData->SetImageData(nModuleIndex, &sharedImageInfo, (BYTE*)pImageData->GetImageBuffer()))
|
//if (m_pSharedImageData->SetImageData(0, &sharedImageInfo, (BYTE*)pImageData->GetImageBuffer()))
|
{
|
|
}
|
else
|
{
|
|
}
|
|
return;
|
}
|
|
void CReviewInterface::IRCC2P_ReviewResult(int nModuleIndex, int nPointIndex, VectorImageData& vectorImageData)
|
{
|
if (m_pReviewProcessor==NULL)
|
{
|
g_pLog->DisplayMessage(_T("[CameraControl] ReviewResult FAIL! module[%d] point[%d]"), nModuleIndex, nPointIndex);
|
return;
|
}
|
|
EnterCriticalSection(&m_csReviewResult);
|
g_pLog->DisplayMessage(_T("[CameraControl] ReviewResult Added! module[%d] point[%d]"), nModuleIndex, nPointIndex);
|
m_pReviewProcessor->AddCameraImageData(nModuleIndex, nPointIndex, vectorImageData);
|
LeaveCriticalSection(&m_csReviewResult);
|
|
return;
|
}
|
|
void CReviewInterface::IRCC2P_CameraControl(int nModuleIndex, int nValue)
|
{
|
// camera control 변경
|
SCameraControl *pCameraControl = Module_GetCameraControl(nModuleIndex);
|
if (pCameraControl==NULL) return;
|
|
pCameraControl->nCameraControl = nValue;
|
|
UpdateCameraControl(nModuleIndex, pCameraControl, NULL);
|
}
|
|
int CReviewInterface::IRP2P_GetWSIControlCount()
|
{
|
return (int)m_vecWSIControl.size();
|
}
|
|
CWsiControl* CReviewInterface::IRP2P_GetWSIControl(int nIndex)
|
{
|
if (nIndex<0 || nIndex>=m_vecWSIControl.size()) return NULL;
|
return m_vecWSIControl[nIndex];
|
}
|
|
int CReviewInterface::IRP2P_GetModuleStatusCount(int nModuleType) const
|
{
|
return Module_GetModuleStatusCount(nModuleType);
|
}
|
|
CModuleStatus* CReviewInterface::IRP2P_GetModuleStatus(int nModuleIdx)
|
{
|
return Module_GetModuleStatus(nModuleIdx);
|
}
|
|
CMotorControl* CReviewInterface::IRP2P_GetMotorControl()
|
{
|
return m_pMotorControl;
|
}
|
|
CSignalControl* CReviewInterface::IRP2P_GetSignalControl()
|
{
|
return m_pSignalControl;
|
}
|
|
CCameraControlReview* CReviewInterface::IRP2P_GetReviewCameraControl(int nModuleIndex)
|
{
|
for (VectorCameraControlReviewIt it=m_vecReviewCameraControl.begin(); it!=m_vecReviewCameraControl.end(); it++)
|
{
|
CCameraControlReview *pControl = (*it);
|
|
if (pControl->GetModuleIndex()==nModuleIndex)
|
{
|
return pControl;
|
}
|
}
|
|
return NULL;
|
}
|
|
int CReviewInterface::IRP2P_GetReviewCameraControlCount()
|
{
|
return (int)m_vecReviewCameraControl.size();
|
}
|
|
void CReviewInterface::IRP2P_UpdateReviewResult(int nModuleIndex, const CGlassResult* pGlassResult, int nPlanIndex)
|
{
|
UpdateReviewResult(nModuleIndex, pGlassResult, nPlanIndex);
|
|
_ProtocolReview* pProtocolReview = ISP2P_GetAoiMemoryProtocol();
|
if (pProtocolReview==NULL) return ;
|
|
int nReviewedDefectCount[16]={};
|
{
|
const VectorReviewResult *pVecReviewResult = pGlassResult->GetVectorReviewResult();
|
//m_pGlassResult->GetWsiScheduleResult(1);
|
|
if (pVecReviewResult)
|
{
|
for(constVectorReviewResultIt it=pVecReviewResult->begin();it!=pVecReviewResult->end();it++)
|
{
|
const CReviewResult *pReviewResult = static_cast<const CReviewResult*>(&(*it));
|
|
for(constVectorSReviewResultIt its=pReviewResult->m_vecSReviewResult.begin(); its!=pReviewResult->m_vecSReviewResult.end();its++)
|
{
|
if (its->nResultCode>ReviewResult_None)
|
{
|
nReviewedDefectCount[pReviewResult->m_nModuleIndex]++;
|
}
|
}
|
}
|
}
|
}
|
|
for(int i=0; i<Module_GetModuleStatusCount(); i++ )
|
{
|
_ProtocalReviewModlueData* pModule = pProtocolReview->GetModuleData(i);;
|
pModule->m_nReviewedDefectCount = nReviewedDefectCount[i];
|
}
|
}
|
|
void CReviewInterface::IRP2P_UpdateCameraControl(int nModuleIdx, const SCameraControl *pCameraControl, const SCameraInfo* pCameraInfo)
|
{
|
UpdateCameraControl(nModuleIdx, pCameraControl, pCameraInfo);
|
}
|
|
const CRsRcpReviewInfo* CReviewInterface::IRP2P_Recipe_GetRsRcpReviewInfo()
|
{
|
if (m_pDoc==NULL) return NULL;
|
return m_pDoc->Recipe_GetRsRcpReviewInfo();
|
}
|
|
const CSystemInfo* CReviewInterface::IRP2P_GetReviewSysteminfo()
|
{
|
if (m_pDoc==NULL) return NULL;
|
return m_pDoc->System_GetSystemInfo();
|
}
|
|
const CSignalControlInfo* CReviewInterface::IRP2P_GetReviewSignalinfo()
|
{
|
if (m_pDoc == NULL) return NULL;
|
return m_pDoc->System_GetSignalInfo();
|
}
|
|
CGlassResult* CReviewInterface::IRP2P_GetCurrentGlassResult()
|
{
|
if (m_pDoc==NULL) return NULL;
|
return m_pDoc->GlassResult_GetCurrentGlassResult();
|
}
|
|
void CReviewInterface::IRP2P_DisplayMessage(const TCHAR* lpstrFormat, ...)
|
{
|
try
|
{
|
va_list list;
|
TCHAR strText[2000] = { 0 };
|
|
va_start(list, lpstrFormat);
|
_vstprintf_s(strText, lpstrFormat, list);
|
va_end(list);
|
|
g_pLog->DisplayMessage(strText);
|
}
|
|
catch (...)
|
{
|
return ;
|
}
|
|
}
|
|
CResultServerControl* CReviewInterface::IRP2P_GetResultServerControl()
|
{
|
return m_pResultServerControl;
|
}
|
|
CSequenceProcessor* CReviewInterface::IRP2P_GetSequenceProcessor()
|
{
|
return m_pSequenceProcessor;
|
}
|
|
void CReviewInterface::IRP2P_UpdateReviewProcessStatus(int nReviewStatus, int nPlanIndex)
|
{
|
UpdateReviewProcessStatus(nReviewStatus, nPlanIndex);
|
}
|
|
void CReviewInterface::IRP2P_UpdateDefocusList() //20190819chm
|
{
|
UpdateDefocusList();
|
}
|
|
void CReviewInterface::IRP2P_CompletePlanIndex(int nReviewStatus, int nPlanIndex)
|
{
|
if (m_pSequenceProcessor==NULL)
|
{
|
g_pLog->DisplayMessage(_T("[ReviewInterface] SequenceProcessor NULL Error"));
|
}
|
|
m_pSequenceProcessor->CompletePlanIndex(nReviewStatus, nPlanIndex);
|
}
|
|
CRecipeManager* CReviewInterface::IRP2P_GetEdgeRecipeManager()
|
{
|
return m_pEdgeRecipeManager;
|
}
|
|
BOOL CReviewInterface::IRP2P_GetFirstReviewLeft()
|
{
|
return m_bFirstReviewLeft;
|
}
|
|
BOOL CReviewInterface::IRP2P_GetFirstReviewRight()
|
{
|
return m_bFirstReviewRight;
|
}
|
|
void CReviewInterface::IRP2P_SetFirstReviewLeft(BOOL b_Check)
|
{
|
m_bFirstReviewLeft = b_Check;
|
}
|
|
void CReviewInterface::IRP2P_SetFirstReviewRight(BOOL b_Check)
|
{
|
m_bFirstReviewRight = b_Check;
|
}
|
|
|
int CReviewInterface::PS2P_GetModuleStatusCount(int nModuleType)
|
{
|
return Module_GetModuleStatusCount(nModuleType);
|
}
|
|
|
double CReviewInterface::PS2P_GetCurrentModuleResolution(int nModuleIndex)
|
{
|
if(int(m_vecModuleStatus.size()) <= nModuleIndex) return 0;
|
|
SCameraInfo* pCameraInfo = m_vecModuleStatus[nModuleIndex].GetCurrentCameraInfo();
|
|
if(pCameraInfo==NULL) return 0;
|
|
return pCameraInfo->dResolution;
|
}
|
|
void CReviewInterface::PS2P_GetCurrentModuleZoomData(int nModuleIndex, int& nZoomIdx, double& dZoomInfo)
|
{
|
if(int(m_vecModuleStatus.size()) <= nModuleIndex) return;
|
|
SCameraControl* pCamera = m_vecModuleStatus[nModuleIndex].GetCameraControl();
|
|
SMagnificInfo* pMagnifiInfo = m_vecModuleStatus[nModuleIndex].GetCurrentMagnificInfo();
|
|
if(pCamera==NULL || pMagnifiInfo==NULL) return;
|
|
nZoomIdx = pCamera->nZoomLevel;
|
dZoomInfo = pMagnifiInfo->dMagnification;
|
}
|
|
BOOL CReviewInterface::IDRO2P_GetMotorPos(int nModule, double &dXpos, double &dYpos)
|
{
|
dXpos = m_vecModuleStatus[nModule].GetMotorPosition()->dMotorPosX;
|
dYpos = m_vecModuleStatus[nModule].GetMotorPosition()->dMotorPosY;
|
return TRUE;
|
|
}
|
|
BOOL CReviewInterface::GetOffSetValue(int nModule, int nCam, int nScan,double dGlassXPos, double &dXpos, double &dYpos)
|
{
|
DlgReviewOffSetTool* pReviewOffSetTool = m_pView->GetReviewOffSetToolHandle();
|
|
pReviewOffSetTool->GetOffSetInfo(nModule, nCam, nScan, dGlassXPos,dXpos, dYpos);
|
return TRUE;
|
}
|
|
BOOL CReviewInterface::IDRO2P_SetGlassMode(BOOL bMode, int nCamidx, int nScanidx, double nXpos, double nYpos)
|
{
|
//_pView
|
|
CDlgDefectMap* pDefectmap = m_pView->GetDefectMapDlgHandle();
|
if (pDefectmap == NULL) { return FALSE; }
|
pDefectmap->GetDefectMap()->SetOffsetmodeparma(bMode, nCamidx, nScanidx, nXpos, nYpos);
|
return FALSE;
|
}
|
|
// diagnosis processor
|
void CReviewInterface::IDP2P_DisplayMessage(int nIndex, const TCHAR* lpstrFormat, ...)
|
{
|
va_list list;
|
TCHAR strText[2000] = { 0 };
|
|
va_start(list, lpstrFormat);
|
_vstprintf_s(strText, lpstrFormat, list);
|
va_end(list);
|
|
g_pLog->DisplayMessage(strText);
|
}
|
|
void CReviewInterface::IDP2P_MotorGo(int nModuleIdx, double dPosX, double dPosY, BOOL bWaitReturn /*= FALSE*/)
|
{
|
if (m_pDoc == NULL || m_pMotorControl == NULL || !(m_pMotorControl->GetConnected()) || m_pSequenceProcessor == NULL) return;
|
|
// check motion end
|
IDP2P_GetMotionEnd(nModuleIdx);
|
|
// check gantry interlock
|
// go diff gantry go 0,0
|
|
const CModuleStatus *pModuleStatus = Module_GetModuleStatus(nModuleIdx);
|
if (pModuleStatus == NULL) return;
|
|
int nGantryIndex = pModuleStatus->GetGantryIndex();
|
|
g_pLog->DisplayMessage(_T("[%d Module][%d Gantry] Go [%.3lf, %.3lf]"), nModuleIdx, nGantryIndex, dPosX, dPosY);
|
|
if (bWaitReturn)
|
{
|
m_pMotorControl->GantryManualGoEnd(nGantryIndex, dPosX, dPosY);
|
}
|
|
m_pMotorControl->GantryManualGo(nGantryIndex, dPosX, dPosY);
|
}
|
|
BOOL CReviewInterface::IDP2P_GetMotionEnd(int nModuleIdx, int nTimeOut/* = -1*/)
|
{
|
if (m_pMotorControl == NULL || m_pMotorControl->GetConnected() == FALSE) return FALSE;
|
|
int nModuleCount = Module_GetModuleStatusCount();
|
int nGantryIndex = -1;
|
|
for (int nIdx=0; nIdx<nModuleCount; nIdx++)
|
{
|
CModuleStatus* pModuleStatus = Module_GetModuleStatus(nIdx);
|
if (pModuleStatus == NULL) continue;
|
|
if (nModuleIdx == pModuleStatus->GetModuleIndex())
|
{
|
nGantryIndex = pModuleStatus->GetGantryIndex();
|
break;
|
}
|
}
|
|
if (nGantryIndex < 0) return FALSE;
|
|
int nWaitTime = nTimeOut < 0 ? INT_MAX : nTimeOut;
|
|
// wait move start
|
Sleep(100);
|
|
DWORD dwTick = GetTickCount();
|
BOOL bEnd = FALSE;
|
while (!bEnd)
|
{
|
if (GetTickCount()-dwTick >= nWaitTime) break;
|
|
bEnd = m_pMotorControl->IsGantryMotionEnd(nGantryIndex);
|
}
|
|
return bEnd;
|
}
|
|
BOOL CReviewInterface::IDP2P_IsGantryMotionEnd(int nModuleIdx)
|
{
|
|
return m_pMotorControl->IsGantryMotionEnd(nModuleIdx);
|
|
}
|
|
BOOL CReviewInterface::IDP2P_CheckManualMode()
|
{
|
if (IsManualProcessMode() == TRUE)
|
{
|
return TRUE;
|
}
|
|
return FALSE;
|
}
|
|
int CReviewInterface::IDP2P_GetSelectedModuleIndex()
|
{
|
return Module_GetSelectedModuleIndex();
|
}
|
|
int CReviewInterface::IDP2P_GetOrigionMotorDir()
|
{
|
if (m_pMotorControl == NULL || m_pMotorControl->GetConnected() == FALSE) return -1;
|
|
const CMotorControlInfo* pMotorControlInfo = m_pDoc->System_GetMotorInfo();
|
if (pMotorControlInfo == NULL) return -1;
|
|
return pMotorControlInfo->GetOriginDirection();
|
}
|
|
BOOL CReviewInterface::IDP2P_FindPanelCenter(int nModuleIdx, double& dPixelX, double& dPixelY, CString strImageName)
|
{
|
CCameraControlReview* pCamera = m_vecReviewCameraControl[nModuleIdx];
|
if (pCamera == NULL) return FALSE;
|
|
CModuleStatus* pModuleStatus = Module_GetModuleStatus(nModuleIdx);
|
if (pModuleStatus == NULL) return FALSE;
|
|
int nHeaderIndex = pModuleStatus->GetHeaderIndex();
|
|
|
ReviewLight_SetLightLevel(nModuleIdx, 22);
|
|
|
//CCameraControlReview *pCameraControlReview = ISP2P_GetReviewCameraControl(nModuleIdx);
|
|
pCamera->Camera_Control(CameraControlStop);
|
Sleep(200);
|
//pCamera->Camera_Control(CameraControlStart);
|
//Sleep(200);
|
pCamera->Camera_Control(CameraControlLive);
|
Sleep(200);
|
// source image
|
CCHImageData imageData;
|
//pCamera->Camera_Control(CameraControlLive);
|
|
//pCamera->Camera_Control(CameraControlStart);
|
if (pCamera->GetLiveImage(nHeaderIndex, &imageData) == FALSE) return FALSE;
|
//pCamera->GetCameraImage(nHeaderIndex, pCamera->GetCameraCount())->CopyImageFrom(&imageData);
|
imageData.SaveImage(_T("D:\\imagecon.bmp"), 100);
|
|
|
//int a = GetTickCount();
|
//CString Imagepath = NULL;
|
//Imagepath.Format(_T("D:\\ResultData\\AutoDiagnosis\\ResultImage\\%s.bmp"),strImageName);
|
|
|
|
imageData.LoadImageA("D:\\imagecon.bmp");
|
|
CCHImageData imageConvert;
|
imageConvert.CopyImageFrom(&imageData);
|
|
if (imageData.GetChannels() != 3)
|
{
|
if (CCHImageProcess::ImageConvert(&imageData, &imageConvert, ConvertTypeRGBA2RGB) != 1)
|
{
|
imageConvert.CopyImageFrom(&imageData);
|
//imageData.SaveImage(_T("D:\\imagecon.bmp"), 95);
|
}
|
}
|
if (imageConvert.GetImageExist() == FALSE) return FALSE;
|
|
// template image
|
CCHImageData imageTmpl;
|
|
CString strDiagnosisTmplImgPath = _T("");
|
strDiagnosisTmplImgPath.Format(_T("%s\\TemplateImage.bmp"), REVIEW_AUTO_DIAGNOSIS_SETTING_FILE_PATH);
|
if (imageTmpl.LoadImage(strDiagnosisTmplImgPath) == FALSE) return FALSE;
|
|
|
if (imageData.GetImageExist() == FALSE || imageTmpl.GetImageExist() == FALSE) return FALSE;
|
//imageTmpl.SaveImage(_T("D:\\tmpcon.bmp"), 95);
|
|
|
CCHImageData imageResult;
|
|
//imageResult.CopyImageFrom(&imageData);
|
|
double dScore = 0.;
|
if (CCHImageProcess::ImageMatching(&imageConvert, &imageTmpl, dPixelX, dPixelY, dScore, &imageResult) != 1) return FALSE;
|
//if (CCHImageProcess::ImageMatching(&imageConvert, &imageTmpl, dPixelX, dPixelY, dScore, &imageResult) != 1) return FALSE;
|
|
dPixelX += double(imageTmpl.GetWidth()) / 2.;
|
dPixelY += double(imageTmpl.GetHeight()) / 2.;
|
//찾은 위치
|
CPoint pt1,pt2;
|
pt1.x = int(0);
|
pt1.y = int(dPixelY);
|
pt2.x = int(2464);
|
pt2.y = int(dPixelY);
|
|
imageData.DrawLine(pt1, pt2, RGB(0, 255, 0), 2);
|
|
pt1.x = int(dPixelX);
|
pt1.y = int(0);
|
pt2.x = int(dPixelX);
|
pt2.y = int(2056);
|
imageData.DrawLine(pt1, pt2, RGB(0, 255, 0), 2);
|
|
// 이미지 중앙
|
pt1.x = int(0);
|
pt1.y = int(2056/2);
|
pt2.x = int(2464);
|
pt2.y = int(2056/2);
|
|
imageData.DrawLine(pt1, pt2, RGB(255, 0, 0), 1);
|
|
pt1.x = int(2464/2);
|
pt1.y = int(0);
|
pt2.x = int(2464 / 2);
|
pt2.y = int(2056);
|
imageData.DrawLine(pt1, pt2, RGB(255, 0, 0), 1);
|
|
imageData.SaveImage(strImageName, 100);
|
|
DM2P_DisplayMessage(_T("%lf"),dScore);
|
|
if (dScore < 0.6) return FALSE;
|
|
return TRUE;
|
}
|
|
BOOL CReviewInterface::IDP2P_SetAFMTracking(int nModuleIdx, BOOL bOn)
|
{
|
if (int(m_vecAFMControl.size()) <= 0) return FALSE;
|
|
return AFM_SetAFMTracking(nModuleIdx, bOn);
|
}
|
|
BOOL CReviewInterface::IDP2P_GetAFMZPosition(int nModuleIdx, double& dValue)
|
{
|
if (int(m_vecAFMControl.size()) <= 0) return FALSE;
|
|
return AFM_GetAFMZPosition(nModuleIdx, dValue);
|
}
|
|
BOOL CReviewInterface::IDP2P_AFMHomePosition(int nModuleIndex)
|
{
|
|
int nMagInfoIdx = 0;
|
int nModuleCount = ISP2P_GetModuleStatusCount();
|
int nHomePosition = 0;
|
|
CModuleStatus *pAFMModuleStatus = Module_GetModuleStatus(nModuleIndex);
|
if (pAFMModuleStatus == NULL) return FALSE;
|
|
SExternalIndex* pExternalIndex = pAFMModuleStatus->GetExternalIndex();
|
if (pExternalIndex == NULL) return FALSE;
|
|
CAfmControl* pAFMControl = ISP2P_GetAFMControl(pExternalIndex->nAFM_Index);
|
if (pAFMControl == NULL) return FALSE;
|
|
CModuleStatus* pModuleStatus = ISP2P_GetModuleStatus(pAFMControl->GetIndex());
|
if (pModuleStatus == NULL) return FALSE;
|
|
VectorSMagnificInfo* pvMagnificInfo = pModuleStatus->GetVectorSMagnificInfo();
|
if (pvMagnificInfo == NULL) return FALSE;
|
|
for (VectorSMagnificInfoIt it = pvMagnificInfo->begin(); it != pvMagnificInfo->end(); it++)
|
{
|
nHomePosition = it->nMsgHomePosition;
|
|
}
|
pAFMControl->MoveToHomePosition(nHomePosition);
|
}
|
|
BOOL CReviewInterface::IDP2P_DiagnosisSendCompleteSig()
|
{
|
|
return m_pSequenceProcessor->SendSignalToSignalControl(4, 0,1000);
|
|
//return pAFMControl->MoveToHomePosition(nHomePosition);
|
}
|
|
//#3407 KYH 자가진단 Judge 판정 및 알람 발생 기능 ADD START
|
BOOL CReviewInterface::IDP2P_DiagnosisSendJudgeAlarm() // 0412 자가진단 JudgeAlarm 추가
|
{
|
|
return m_pSequenceProcessor->SendSignalToSignalControl(0, 4, 1000); // 0412 자가진단 JudgeAlarm 추가
|
|
//return pAFMControl->MoveToHomePosition(nHomePosition);
|
}
|
//#3407 KYH 자가진단 Judge 판정 및 알람 발생 기능 ADD END
|
|
BOOL CReviewInterface::IDP2P_SetDlgFlatness(int nIndex)
|
{
|
m_pDlgDiagnosis->SetDlgFlatness(nIndex);
|
return TRUE;
|
}
|
|
BOOL CReviewInterface::IDP2P_SetDlgSquareness(int nIndex)
|
{
|
//m_pDlgDiagnosis->SetDlgSquareness(nIndex); //taek 210105
|
return TRUE;
|
}
|
|
BOOL CReviewInterface::IDP2p_SetDlgWSI(int nIndex)
|
{
|
//m_pDlgDiagnosis->SetDlgWSI(nIndex); //taek 210105
|
return TRUE;
|
}
|
|
BOOL CReviewInterface::IDP2P_SetDialogTap(int nIndex)
|
{
|
|
CDlgSelfDiagnosis_Squareness* pDlgSquareness = m_pDlgDiagnosis->m_pDlgSquareness;
|
CDlgSelfDiagnosis_Flatness* pDlgFlatness = m_pDlgDiagnosis->m_pDlgFlatness;
|
CDlgSelfDiagnosis_Wsi* pDlgWsi = m_pDlgDiagnosis->m_pDlgWsi;
|
CDlgSelfDiagnosis_Setting* pDlgSetting = m_pDlgDiagnosis->m_pDlgSetting;
|
|
if (!pDlgSquareness || !pDlgFlatness || !pDlgWsi || !pDlgSetting)
|
return FALSE;
|
|
switch (nIndex)
|
{
|
case 0:
|
m_pDlgDiagnosis->m_ctrlTabCtrl.SetCurFocus(0);
|
pDlgSquareness->ShowWindow(SW_SHOW);
|
pDlgFlatness->ShowWindow(SW_HIDE);
|
pDlgWsi->ShowWindow(SW_HIDE);
|
pDlgSetting->ShowWindow(SW_HIDE);
|
break;
|
case 1:
|
m_pDlgDiagnosis->m_ctrlTabCtrl.SetCurFocus(1);
|
pDlgSquareness->ShowWindow(SW_HIDE);
|
pDlgFlatness->ShowWindow(SW_SHOW);
|
pDlgWsi->ShowWindow(SW_HIDE);
|
pDlgSetting->ShowWindow(SW_HIDE);
|
break;
|
case 2:
|
m_pDlgDiagnosis->m_ctrlTabCtrl.SetCurFocus(2);
|
pDlgSquareness->ShowWindow(SW_HIDE);
|
pDlgFlatness->ShowWindow(SW_HIDE);
|
pDlgWsi->ShowWindow(SW_SHOW);
|
pDlgSetting->ShowWindow(SW_HIDE);
|
break;
|
case 3:
|
m_pDlgDiagnosis->m_ctrlTabCtrl.SetCurFocus(3);
|
pDlgSquareness->ShowWindow(SW_HIDE);
|
pDlgFlatness->ShowWindow(SW_HIDE);
|
pDlgWsi->ShowWindow(SW_HIDE);
|
pDlgSetting->ShowWindow(SW_SHOW);
|
break;
|
|
}
|
return TRUE;
|
}
|
|
void CReviewInterface::IDP2P_UpdateDialog(int nIndex /*= -1*/)
|
{
|
if (m_pDlgDiagnosis == NULL) return;
|
|
m_pDlgDiagnosis->UpdateDialog(nIndex);
|
}
|
|
void CReviewInterface::IDP2P_SetWsiManualMeasure(int nModuleIdx, double dPosX, double dPosY)
|
{
|
// 레시피 변경을 위한
|
CSequenceProcessor* m_SequenceProcessor = IRP2P_GetSequenceProcessor();
|
if (m_SequenceProcessor == NULL) return;
|
m_SequenceProcessor->SetWsiType(9);
|
|
if (nModuleIdx == 0)
|
{
|
if (!m_SequenceProcessor->WSIAllReadySignal(1))
|
{
|
g_pLog->DisplayMessage(_T("[WSI] Send Ready Signal to All WIS Fail"));
|
return;
|
}
|
}
|
|
SetCurrentWsiMode(WsiMeasureType_VLSI);
|
|
CWsiControl* pWsiControl = ISP2P_GetWSIControl(nModuleIdx);
|
|
VectorInteger vectorPosX, vectorPosY;
|
vectorPosX.clear();
|
vectorPosY.clear();
|
|
vectorPosX.push_back(int(dPosX * 1000));
|
vectorPosY.push_back(int(dPosY * 1000));
|
|
pWsiControl->SetWsiStart(1, vectorPosX, vectorPosY, 0);
|
|
}
|
|
void CReviewInterface::IDP2P_WsiMotorMotionEnd(int nModuleIdx, double dPosX, double dPosY)
|
{
|
CWsiControl* pWsiControl = ISP2P_GetWSIControl(nModuleIdx);
|
pWsiControl->SetWsiMotionEnd(0, dPosX * 1000, dPosY * 1000);
|
}
|
|
void CReviewInterface::DM2P_DisplayMessage(const CString& strMessage)
|
{
|
if(m_pView==NULL) return;
|
|
m_pView->DisplayMessage(strMessage);
|
}
|
|
void CReviewInterface::DM2P_DisplayMessage(const TCHAR* lpstrFormat, ...)
|
{
|
if(m_pView==NULL) return;
|
|
va_list list;
|
TCHAR strText[2000] = {0};
|
|
va_start(list, lpstrFormat);
|
_vstprintf_s(strText, lpstrFormat, list);
|
va_end(list);
|
|
m_pView->DisplayMessage(strText);
|
}
|
|
// Align Light Control command
|
BOOL CReviewInterface::AlignLight_SetLightLevel(int nCameraIndex, int nValue)
|
{
|
CLightControl* pAlignLightControl = ISP2P_GetAlignLightControl(nCameraIndex);
|
if(pAlignLightControl == NULL) return FALSE;
|
|
if(pAlignLightControl->SetLightLevel(nValue)==FALSE)
|
{
|
return FALSE;
|
}
|
|
return TRUE;
|
}
|
|
BOOL CReviewInterface::AlignLight_GetLightLevel(int nCameraIndex, int& nValue)
|
{
|
CLightControl* pAlignLightControl = ISP2P_GetAlignLightControl(nCameraIndex);
|
if(pAlignLightControl == NULL) return FALSE;
|
|
if(pAlignLightControl->GetLightLevel(nValue)==FALSE)
|
{
|
return FALSE;
|
}
|
|
return TRUE;
|
}
|
|
// Review Light Control command
|
BOOL CReviewInterface::ReviewLight_SetLightLevel(int nModuleIndex, int nValue)
|
{
|
SCameraControl *pCameraControl = Module_GetCameraControl(nModuleIndex);
|
if (pCameraControl==NULL) return FALSE;
|
|
SExternalIndex *pExternalIndex = Module_GetExternalIndex(nModuleIndex);
|
if (pExternalIndex==NULL) return FALSE;
|
|
CLightControl *pLightControl = ISP2P_GetReviewLightControl(pExternalIndex->nLight_Index);
|
if (pLightControl==NULL) return FALSE;
|
|
if(pLightControl->SetLightLevel(nValue, pExternalIndex->nLight_Channel))
|
{
|
pCameraControl->nLightLevel = nValue;
|
UpdateCameraControl(nModuleIndex, pCameraControl, NULL);
|
return TRUE;
|
}
|
|
return FALSE;
|
}
|
|
BOOL CReviewInterface::ReviewLight_GetLightLevel(int nModuleIndex, int& nValue)
|
{
|
SCameraControl *pCameraControl = Module_GetCameraControl(nModuleIndex);
|
if (pCameraControl==NULL) return FALSE;
|
|
SExternalIndex *pExternalIndex = Module_GetExternalIndex(nModuleIndex);
|
if (pExternalIndex==NULL) return FALSE;
|
|
CLightControl *pLightControl = ISP2P_GetReviewLightControl(pExternalIndex->nLight_Index);
|
if (pLightControl==NULL) return FALSE;
|
|
if(pLightControl->GetLightLevel(nValue, pExternalIndex->nLight_Channel))
|
{
|
pCameraControl->nLightLevel = nValue;
|
UpdateCameraControl(nModuleIndex, pCameraControl, NULL);
|
return TRUE;
|
}
|
|
return FALSE;
|
}
|
|
// Revolver Control Command
|
BOOL CReviewInterface::Revolver_SetRevolverLevel(int nModuleIndex, int nValue)
|
{
|
SExternalIndex *pExternalIndex = Module_GetExternalIndex(nModuleIndex);
|
if (pExternalIndex==NULL)
|
{
|
return FALSE;
|
}
|
|
CLensChangeControl *pRevolverControl = ISP2P_GetRevolverControl(pExternalIndex->nRevolver_Index);
|
if (pRevolverControl==NULL)
|
{
|
return FALSE;
|
}
|
|
// Zoom 변경
|
SCameraControl *pCameraControl = Module_GetCameraControl(nModuleIndex);
|
if (pCameraControl==NULL)
|
{
|
return FALSE;
|
}
|
|
if (pCameraControl->nZoomLevel != nValue)
|
{
|
if (pRevolverControl->SetPosition(nValue+1))
|
{
|
pCameraControl->nZoomLevel = nValue;
|
SCameraInfo* pCameraInfo = Module_GetCameraInfo(nModuleIndex, nValue);
|
UpdateCameraControl(nModuleIndex, pCameraControl, pCameraInfo);
|
}
|
}
|
|
return TRUE;
|
}
|
|
BOOL CReviewInterface::Revolver_GetRevolverLevel(int nModuleIndex, int& nValue)
|
{
|
// Zoom 변경
|
SExternalIndex *pExternalIndex = Module_GetExternalIndex(nModuleIndex);
|
if (pExternalIndex==NULL)
|
{
|
return FALSE;
|
}
|
|
CLensChangeControl *pRevolverControl = ISP2P_GetRevolverControl(pExternalIndex->nRevolver_Index);
|
if (pRevolverControl==NULL)
|
{
|
return FALSE;
|
}
|
|
// Zoom 변경
|
SCameraControl *pCameraControl = Module_GetCameraControl(nModuleIndex);
|
if (pCameraControl==NULL)
|
{
|
return FALSE;
|
}
|
|
if (pCameraControl->nZoomLevel != nValue)
|
{
|
if (pRevolverControl->GetPosition(nValue))
|
{
|
pCameraControl->nZoomLevel = nValue;
|
SCameraInfo* pCameraInfo = Module_GetCameraInfo(nModuleIndex, nValue);
|
UpdateCameraControl(nModuleIndex, pCameraControl, pCameraInfo);
|
}
|
}
|
|
return TRUE;
|
}
|
|
// AFM Control Command
|
BOOL CReviewInterface::AFM_SetAFMRecipeIndex(int nRecipeIndex, int nValue)
|
{
|
BOOL bReturn = TRUE;
|
for (int i=0; i<Module_GetModuleStatusCount(); i++)
|
{
|
bReturn = bReturn & AFM_SetAFMRecipeIndex(i, nRecipeIndex, nValue);
|
}
|
return bReturn;
|
}
|
|
BOOL CReviewInterface::AFM_SetAFMRecipeName(const CString& strRecipeName, int nValue)
|
{
|
BOOL bReturn = TRUE;
|
for (int i=0; i<Module_GetModuleStatusCount(); i++)
|
{
|
bReturn = bReturn & AFM_SetAFMRecipeName(i, strRecipeName, nValue);
|
}
|
return bReturn;
|
}
|
|
|
BOOL CReviewInterface::AFM_SetAFMZoomLevel(int nValue)
|
{
|
BOOL bReturn = TRUE;
|
for (int i=0; i<Module_GetModuleStatusCount(); i++)
|
{
|
bReturn = bReturn & AFM_SetAFMZoomLevel(i, nValue);
|
}
|
return bReturn;
|
}
|
|
BOOL CReviewInterface::AFM_SetAFMTracking(BOOL bValue)
|
{
|
BOOL bReturn = TRUE;
|
for (int i=0; i<Module_GetModuleStatusCount(); i++)
|
{
|
bReturn = bReturn & AFM_SetAFMTracking(i, bValue);
|
}
|
return bReturn;
|
}
|
|
BOOL CReviewInterface::AFM_SetAFMJogCommand(int nCmd)
|
{
|
BOOL bReturn = TRUE;
|
for (int i=0; i<Module_GetModuleStatusCount(); i++)
|
{
|
bReturn = bReturn & AFM_SetAFMJogCommand(i, nCmd);
|
}
|
return bReturn;
|
}
|
|
BOOL CReviewInterface::AFM_SetAFMJogSpeed(double dSpeed)
|
{
|
BOOL bReturn = TRUE;
|
for (int i=0; i<Module_GetModuleStatusCount(); i++)
|
{
|
bReturn = bReturn & AFM_SetAFMJogSpeed(i, dSpeed);
|
}
|
return bReturn;
|
}
|
|
BOOL CReviewInterface::AFM_GetAFMZPosition(int nModuleIndex, double& dValue)
|
{
|
CModuleStatus *pModuleStatus = Module_GetModuleStatus(nModuleIndex);
|
if (pModuleStatus == NULL) return FALSE;
|
|
SExternalIndex* pExternalIndex = pModuleStatus->GetExternalIndex();
|
if (pExternalIndex == NULL) return FALSE;
|
|
CAfmControl* pAFMControl = ISP2P_GetAFMControl(pExternalIndex->nAFM_Index);
|
if (pAFMControl == NULL) return FALSE;
|
|
return pAFMControl->GetCurPos(dValue);
|
}
|
|
BOOL CReviewInterface::AFM_SetAFMJogCommand(int nModuleIndex, int nCmd)
|
{
|
CModuleStatus *pModuleStatus = Module_GetModuleStatus(nModuleIndex);
|
if (pModuleStatus==NULL)
|
{
|
return FALSE;
|
}
|
|
SExternalIndex* pExternalIndex = pModuleStatus->GetExternalIndex();
|
if(pExternalIndex == NULL) return FALSE;
|
|
CAfmControl* pAFMControl = ISP2P_GetAFMControl(pExternalIndex->nAFM_Index);
|
if (pAFMControl==NULL) return FALSE;
|
|
if (pAFMControl->RecipeJogCommand(nCmd)!=1)
|
{
|
return FALSE;
|
}
|
|
return TRUE;
|
}
|
|
BOOL CReviewInterface::AFM_SetAFMJogSpeed(int nModuleIndex, double dSpeed)
|
{
|
CModuleStatus *pModuleStatus = Module_GetModuleStatus(nModuleIndex);
|
if (pModuleStatus==NULL)
|
{
|
return FALSE;
|
}
|
|
SExternalIndex* pExternalIndex = pModuleStatus->GetExternalIndex();
|
if(pExternalIndex == NULL) return FALSE;
|
|
CAfmControl* pAFMControl = ISP2P_GetAFMControl(pExternalIndex->nAFM_Index);
|
if (pAFMControl==NULL) return FALSE;
|
|
if (pAFMControl->RecipeJogSpeed(dSpeed)!=1)
|
{
|
return FALSE;
|
}
|
|
return TRUE;
|
}
|
|
BOOL CReviewInterface::AFM_SetAFMRecipeIndex(int nModuleIndex, int nRecipeIndex, int nValue)
|
{
|
// camera control 변경
|
SExternalIndex* pExternalIndex = Module_GetExternalIndex(nModuleIndex);
|
if(pExternalIndex == NULL) return FALSE;
|
|
SCameraControl *pCameraControl = Module_GetCameraControl(nModuleIndex);
|
if (pCameraControl==NULL)
|
{
|
return FALSE;
|
}
|
|
CAfmControl* pAFMControl = ISP2P_GetAFMControl(pExternalIndex->nAFM_Index);
|
if(pAFMControl == NULL) return FALSE;
|
|
if (pAFMControl->SetRecipeIndex(nRecipeIndex, nValue))
|
{
|
pCameraControl->nAFMRecipe = nRecipeIndex;
|
pCameraControl->nAFMLevel = nValue;
|
SCameraInfo* pCameraInfo = Module_GetCameraInfo(nModuleIndex, nValue);
|
UpdateCameraControl(nModuleIndex, pCameraControl, pCameraInfo);
|
return TRUE;
|
}
|
return FALSE;
|
}
|
|
BOOL CReviewInterface::AFM_GetAFMRecipeIndex(int nModuleIndex, int& nRecipeIndex, int& nValue)
|
{
|
// camera control 변경
|
SExternalIndex* pExternalIndex = Module_GetExternalIndex(nModuleIndex);
|
if(pExternalIndex == NULL) return FALSE;
|
|
SCameraControl *pCameraControl = Module_GetCameraControl(nModuleIndex);
|
if (pCameraControl==NULL)
|
{
|
return FALSE;
|
}
|
|
CAfmControl* pAFMControl = ISP2P_GetAFMControl(pExternalIndex->nAFM_Index);
|
if(pAFMControl == NULL) return FALSE;
|
|
if (pAFMControl->GetRecipeIndex(nRecipeIndex, nValue))
|
{
|
pCameraControl->nAFMRecipe = nRecipeIndex;
|
pCameraControl->nAFMLevel = nValue;
|
SCameraInfo* pCameraInfo = Module_GetCameraInfo(nModuleIndex, nValue);
|
UpdateCameraControl(nModuleIndex, pCameraControl, pCameraInfo);
|
return TRUE;
|
}
|
return FALSE;
|
}
|
|
BOOL CReviewInterface::AFM_SetAFMRecipeName(int nModuleIndex, const CString& strRecipeName, int nValue)
|
{
|
SExternalIndex* pExternalIndex = Module_GetExternalIndex(nModuleIndex);
|
if(pExternalIndex == NULL) return FALSE;
|
|
SCameraControl *pCameraControl = Module_GetCameraControl(nModuleIndex);
|
if (pCameraControl==NULL)
|
{
|
return FALSE;
|
}
|
|
CAfmControl* pAFMControl = ISP2P_GetAFMControl(pExternalIndex->nAFM_Index);
|
if(pAFMControl == NULL) return FALSE;
|
|
if (pAFMControl->SetRecipeName(strRecipeName, nValue))
|
{
|
pCameraControl->strAFMRecipe = strRecipeName;
|
pCameraControl->nAFMLevel = nValue;
|
SCameraInfo* pCameraInfo = Module_GetCameraInfo(nModuleIndex, nValue);
|
UpdateCameraControl(nModuleIndex, pCameraControl, pCameraInfo);
|
return TRUE;
|
}
|
return FALSE;
|
}
|
|
BOOL CReviewInterface::AFM_GetAFMRecipeName(int nModuleIndex, CString& strRecipeName, int& nValue)
|
{
|
SExternalIndex* pExternalIndex = Module_GetExternalIndex(nModuleIndex);
|
if(pExternalIndex == NULL) return FALSE;
|
|
SCameraControl *pCameraControl = Module_GetCameraControl(nModuleIndex);
|
if (pCameraControl==NULL)
|
{
|
return FALSE;
|
}
|
|
CAfmControl* pAFMControl = ISP2P_GetAFMControl(pExternalIndex->nAFM_Index);
|
if(pAFMControl == NULL) return FALSE;
|
|
if (pAFMControl->GetRecipeName(strRecipeName, nValue))
|
{
|
pCameraControl->strAFMRecipe = strRecipeName;
|
pCameraControl->nAFMLevel = nValue;
|
SCameraInfo* pCameraInfo = Module_GetCameraInfo(nModuleIndex, nValue);
|
UpdateCameraControl(nModuleIndex, pCameraControl, pCameraInfo);
|
return TRUE;
|
}
|
return FALSE;
|
}
|
|
BOOL CReviewInterface::AFM_SetAFMZoomLevel(int nModuleIndex, int nValue)
|
{
|
SExternalIndex* pExternalIndex = Module_GetExternalIndex(nModuleIndex);
|
if(pExternalIndex == NULL) return FALSE;
|
|
SCameraControl *pCameraControl = Module_GetCameraControl(nModuleIndex);
|
if (pCameraControl==NULL)
|
{
|
return FALSE;
|
}
|
|
CAfmControl* pAFMControl = ISP2P_GetAFMControl(pExternalIndex->nAFM_Index);
|
if(pAFMControl == NULL) return FALSE;
|
|
//if (pCameraControl->nAFMLevel != nValue)
|
{
|
if (pAFMControl->SetZoomIndex(nValue))
|
{
|
pCameraControl->nAFMLevel = nValue;
|
SCameraInfo* pCameraInfo = Module_GetCameraInfo(nModuleIndex, nValue);
|
UpdateCameraControl(nModuleIndex, pCameraControl, pCameraInfo);
|
return TRUE;
|
}
|
}
|
return FALSE;
|
}
|
|
BOOL CReviewInterface::AFM_GetAFMZoomLevel(int nModuleIndex, int& nValue)
|
{
|
SExternalIndex* pExternalIndex = Module_GetExternalIndex(nModuleIndex);
|
if(pExternalIndex == NULL) return FALSE;
|
|
SCameraControl *pCameraControl = Module_GetCameraControl(nModuleIndex);
|
if (pCameraControl==NULL)
|
{
|
return FALSE;
|
}
|
|
CAfmControl* pAFMControl = ISP2P_GetAFMControl(pExternalIndex->nAFM_Index);
|
if(pAFMControl == NULL) return FALSE;
|
|
if (pAFMControl->GetZoomIndex(nValue))
|
{
|
pCameraControl->nAFMLevel = nValue;
|
SCameraInfo* pCameraInfo = Module_GetCameraInfo(nModuleIndex, nValue);
|
UpdateCameraControl(nModuleIndex, pCameraControl, pCameraInfo);
|
return TRUE;
|
}
|
return FALSE;
|
}
|
|
BOOL CReviewInterface::AFM_SetAFMTracking(int nModuleIndex, BOOL bValue)
|
{
|
SExternalIndex* pExternalIndex = Module_GetExternalIndex(nModuleIndex);
|
if(pExternalIndex == NULL) return FALSE;
|
|
SCameraControl *pCameraControl = Module_GetCameraControl(nModuleIndex);
|
if (pCameraControl==NULL)
|
{
|
return FALSE;
|
}
|
|
CAfmControl* pAFMControl = ISP2P_GetAFMControl(pExternalIndex->nAFM_Index);
|
if(pAFMControl == NULL) return FALSE;
|
|
if (pCameraControl->bAFMTracking != bValue)
|
{
|
if (pAFMControl->SetTracking(bValue))
|
{
|
pCameraControl->bAFMTracking = bValue;
|
UpdateCameraControl(nModuleIndex, pCameraControl, NULL);
|
return TRUE;
|
}
|
else
|
{
|
UpdateCameraControl(nModuleIndex, pCameraControl, NULL);
|
return FALSE;
|
}
|
}
|
return FALSE;
|
}
|
|
BOOL CReviewInterface::AFM_GetAFMTracking(int nModuleIndex, BOOL& bValue)
|
{
|
SExternalIndex* pExternalIndex = Module_GetExternalIndex(nModuleIndex);
|
if(pExternalIndex == NULL) return FALSE;
|
|
SCameraControl *pCameraControl = Module_GetCameraControl(nModuleIndex);
|
if (pCameraControl==NULL)
|
{
|
return FALSE;
|
}
|
|
CAfmControl* pAFMControl = ISP2P_GetAFMControl(pExternalIndex->nAFM_Index);
|
if(pAFMControl == NULL) return FALSE;
|
|
int nValue = 0;
|
if (pAFMControl->GetTracking(nValue))
|
{
|
pCameraControl->bAFMTracking = bValue = (BOOL)nValue;
|
UpdateCameraControl(nModuleIndex, pCameraControl, NULL);
|
return TRUE;
|
}
|
return FALSE;
|
}
|
|
BOOL CReviewInterface::WSI_SetManualMeasurement(int nModuleIndex, int nDefectPosX, int nDefectPosY, int nDefectgPosX, int nDefectgPosY, BOOL bValue)
|
{
|
SExternalIndex* pExternalIndex = Module_GetExternalIndex(nModuleIndex);
|
if(pExternalIndex == NULL) return FALSE;
|
|
const SDefectFilter *pDefectFilter = m_pDoc->Etc_GetDefectFilter();
|
if (pDefectFilter==NULL) return FALSE;
|
|
CWsiControl *pWSIControl = ISP2P_GetWSIControl(pExternalIndex->nWSI_Index);
|
if (pWSIControl==NULL) return FALSE;
|
|
CGlassResult *pGlassResult = m_pDoc->GlassResult_GetCurrentGlassResult();
|
if (pGlassResult==NULL) return FALSE;
|
|
//////////////////////////////////////////////////////////////////////////
|
CMotorControl* pMotorControl = ISP2P_GetMotorControl();
|
if(pMotorControl == NULL) return FALSE;
|
|
m_pSequenceProcessor->WSI_WSIManualReady();
|
Sleep(100); // WSI Control Delay Time ?
|
|
CProcessTimer processTimer;
|
processTimer.Start();
|
|
// [2017:1:19]-[WEZASW] : 지정 시간까지 Motor 구동 완료 상태 확인
|
// Motor 구동 완료 상태 체크
|
while(1)
|
{
|
// 모든 Motor Axis이 정지되면...
|
if (pMotorControl->IsAxisMotionEnd() && TRUE) { break; }
|
|
processTimer.End();
|
// 10초 이상 대기시 중지...
|
if (processTimer.GetDurationSecond() > 10) {
|
g_pLog->DisplayMessage(_T("[User] WSI Manual Measurement Stop! - Time Over"));
|
return FALSE;
|
}
|
::Sleep(1);
|
}
|
|
m_pSequenceProcessor->WSI_WSIManualStart(nDefectPosX, nDefectPosY, nDefectgPosX, nDefectgPosY);
|
g_pLog->DisplayMessage(_T("[User] WSI Manual Measurement Start! - Pos X:%d, Pos Y:%d"), nDefectPosX, nDefectPosY);
|
|
return TRUE;
|
}
|
|
// vcr
|
BOOL CReviewInterface::VCR_GetDecodingData(int nIndex, CString& strCode)
|
{
|
if (m_pVCRControl==NULL) { return FALSE; }
|
|
return m_pVCRControl->GetDecodeData(strCode);
|
}
|
|
BOOL CReviewInterface::VCR_SetDecodeTriggerSignal(int nIndex)
|
{
|
if (m_pVCRControl==NULL) { return FALSE; }
|
|
return TRUE; //m_pVCRControl->DecodeTriggerSignal();
|
}
|
|
void CReviewInterface::DC2P_SetSelectedCamera(int nModuleIndex, int nValue)
|
{
|
if (nModuleIndex<0 || nModuleIndex>=Module_GetModuleStatusCount()) { return; }
|
|
for (VectorModuleStatusIt it=m_vecModuleStatus.begin(); it!=m_vecModuleStatus.end(); it++)
|
{
|
if (it->GetModuleIndex()==nModuleIndex)
|
{
|
it->SetSelected(TRUE);
|
}
|
else
|
{
|
it->SetSelected(FALSE);
|
}
|
}
|
}
|
|
void CReviewInterface::DC2P_SetLightLevel(int nModuleIndex, int nValue)
|
{
|
// 장비모드 체크
|
if (IsManualProcessMode()==FALSE) { return; }
|
|
if (ReviewLight_SetLightLevel(nModuleIndex, nValue))
|
{
|
g_pLog->DisplayMessage(_T("[User] Camera(%d) Light Level %d Success!"), nModuleIndex, nValue);
|
}
|
else
|
{
|
g_pLog->DisplayMessage(_T("[User] Camera(%d) Light Level %d Fail!"), nModuleIndex, nValue);
|
}
|
}
|
|
void CReviewInterface::DC2P_SetZoomLevel(int nModuleIndex, int nValue)
|
{
|
// 장비모드 체크
|
if (IsManualProcessMode()==FALSE) { return; }
|
|
CModuleStatus *pModuleStatus = Module_GetModuleStatus(nModuleIndex);
|
if (pModuleStatus==NULL) { return; }
|
|
SCameraControl *pCameraControl = Module_GetCameraControl(nModuleIndex);
|
if (pCameraControl==NULL) { return; }
|
|
// afm tracking off
|
SExternalIndex *pExternalIndex = Module_GetExternalIndex(nModuleIndex);
|
if (pExternalIndex)
|
{
|
CLensChangeControl *pRevolverControl = ISP2P_GetRevolverControl(pExternalIndex->nRevolver_Index);
|
if (pRevolverControl && pRevolverControl->GetControlType()!=LensChangeController_DualTube)
|
{
|
if (pCameraControl->bAFMTracking)
|
{
|
if (AFM_SetAFMTracking(nModuleIndex, FALSE))
|
{
|
g_pLog->DisplayMessage(_T("[User] Module(%d) AFM Tracking Stop Success!"), nModuleIndex);
|
}
|
else
|
{
|
g_pLog->DisplayMessage(_T("[User] Module(%d) AFM Tracking Stop Fail!"), nModuleIndex);
|
}
|
::Sleep(100);
|
}
|
}
|
}
|
|
// set revolver level
|
if (Revolver_SetRevolverLevel(nModuleIndex, nValue))
|
{
|
g_pLog->DisplayMessage(_T("[User] Module(%d) Revolver Level %d Success!"), nModuleIndex, nValue);
|
|
if (pExternalIndex)
|
{
|
CLensChangeControl *pRevolverControl = ISP2P_GetRevolverControl(pExternalIndex->nRevolver_Index);
|
if (pRevolverControl && pRevolverControl->GetControlType()!=LensChangeController_DualTube)
|
{
|
if (AFM_SetAFMZoomLevel(nModuleIndex, nValue))
|
{
|
g_pLog->DisplayMessage(_T("[User] Module(%d) AFM Zoom Level %d Success!"), nModuleIndex, nValue);
|
}
|
else
|
{
|
g_pLog->DisplayMessage(_T("[User] Module(%d) AFM Zoom Level %d Fail!"), nModuleIndex, nValue);
|
}
|
}
|
}
|
}
|
else
|
{
|
g_pLog->DisplayMessage(_T("[User] Module(%d) Revolver Level %d Fail!"), nModuleIndex, nValue);
|
}
|
}
|
|
void CReviewInterface::DC2P_SetCameraControl(int nModuleIndex, int nValue)
|
{
|
// 장비모드 체크
|
if (IsManualProcessMode()==FALSE ) // SEM InterLock
|
{
|
return;
|
}
|
// camera control 변경
|
SCameraControl *pCameraControl = Module_GetCameraControl(nModuleIndex);
|
CCameraControlReview *pCameraControlReview = ISP2P_GetReviewCameraControl(nModuleIndex);
|
|
if (pCameraControl==NULL || pCameraControlReview==NULL)
|
{
|
return;
|
}
|
|
//20201223
|
//pCameraControl->bSelected = TRUE;
|
|
if (pCameraControl->nCameraControl != nValue)
|
{
|
Sleep(200);
|
if (pCameraControlReview->Camera_Control(nValue))
|
{
|
pCameraControl->nCameraControl = nValue;
|
|
UpdateCameraControl(nModuleIndex, pCameraControl, NULL);
|
}
|
}
|
}
|
|
void CReviewInterface::DC2P_SetJogCommand(int nModuleIndex, int nValue)
|
{
|
// 장비모드 체크
|
if (IsManualProcessMode()==FALSE) { return; }
|
|
int nCommand = 0;
|
switch(nValue)
|
{
|
case 0:
|
nCommand = 0;
|
break;
|
case 1: //up
|
nCommand = -1;
|
break;
|
case 2: // down
|
nCommand = 1;
|
break;
|
}
|
|
if(AFM_SetAFMJogCommand(nModuleIndex, nCommand))
|
{
|
CString strbnt =_T("");
|
if (nCommand==-1)
|
{
|
strbnt = _T("UP");
|
}
|
else if(nCommand == 1)
|
{
|
strbnt = _T("DOWN");
|
}
|
else
|
{
|
strbnt = _T("NULL");
|
}
|
g_pLog->DisplayMessage(_T("AFM Module[%d] Command %s"),nModuleIndex, strbnt);
|
}
|
|
|
//CModuleStatus* pModuleStatus = DC2P_Get_Selected_module_Status();
|
//if(pModuleStatus == NULL) return ;
|
|
//SExternalIndex* pExternalIndex = pModuleStatus->GetExternalIndex();
|
//if(pExternalIndex == NULL) return ;
|
|
//CAfmControl* pAFMControl = ISP2P_GetAFMControl(pExternalIndex->nAFM_Index);
|
|
//pAFMControl->RecipeJogCommand(nCommand);
|
|
}
|
|
void CReviewInterface::DC2P_SetAFMTracking(int nModuleIndex, BOOL bValue)
|
{
|
// 장비모드 체크
|
if (IsManualProcessMode()==FALSE)
|
{
|
return;
|
}
|
|
SExternalIndex* pExternalIndex = Module_GetExternalIndex(nModuleIndex);
|
if(pExternalIndex == NULL) return ;
|
|
if (AFM_SetAFMTracking(pExternalIndex->nAFM_Index, bValue))
|
{
|
g_pLog->DisplayMessage(_T("[User] Camera(%d) AFM Tracking %d Success!"), nModuleIndex, bValue);
|
}
|
else
|
{
|
g_pLog->DisplayMessage(_T("[User] Camera(%d) AFM Tracking %d Fail!"), nModuleIndex, bValue);
|
}
|
}
|
|
void CReviewInterface::DC2P_SetCameraGo(int nModuleIndex, int nMoveAxis, double dPosX, double dPosY)
|
{
|
// 장비모드 체크
|
|
if (IsManualProcessMode() == FALSE)
|
{
|
return;
|
}
|
|
Motor_CameraGo(nModuleIndex, dPosX, dPosY, nMoveAxis); //mch test
|
|
//// 장비모드 체크
|
|
//if (IsManualProcessMode() == FALSE)
|
//{
|
// return;
|
//}
|
|
|
//double dGantryX1st = 0;
|
//double dGantryX2nd = 0;
|
//dGantryX1st = Module_GetModuleStatus(nModuleIndex)->GetMotorPosition()->dGlassPosX;
|
//dGantryX2nd = Module_GetModuleStatus(nModuleIndex)->GetMotorPosition()->dGlassPosX;
|
|
//if (nModuleIndex == 0)
|
//{
|
// if (abs(dGantryX2nd - dPosX) > 300)
|
// {
|
// Motor_CameraGo(nModuleIndex, dPosX, dPosY, nMoveAxis); //mch test
|
// }
|
// else
|
// {
|
// DC2P_MoveCommand(1, MOVE_CMD_X + MOVE_CMD_Y, 0, 0, 0);
|
|
// if (IDP2P_GetMotionEnd(1) == TRUE)
|
// {
|
// dGantryX2nd = Module_GetModuleStatus(1)->GetMotorPosition()->dGlassPosX;
|
// if (abs(dGantryX2nd- dPosX) > 300)
|
// {
|
// Motor_CameraGo(nModuleIndex, dPosX, dPosY, nMoveAxis); //mch test
|
// }
|
// }
|
// }
|
//}
|
//else
|
//{
|
// if (abs(dPosX- dGantryX1st) > 300)
|
// {
|
// Motor_CameraGo(nModuleIndex, dPosX, dPosY, nMoveAxis); //mch test
|
// }
|
// else
|
// {
|
// DC2P_MoveCommand(0, MOVE_CMD_X + MOVE_CMD_Y, 0, 0, 0);
|
|
// if (IDP2P_GetMotionEnd(0) == TRUE)
|
// {
|
// dGantryX1st = Module_GetModuleStatus(0)->GetMotorPosition()->dGlassPosX;
|
// if (abs(dPosX - dGantryX1st) > 300)
|
// {
|
// Motor_CameraGo(nModuleIndex, dPosX, dPosY, nMoveAxis); //mch test
|
// }
|
// }
|
// }
|
//}
|
|
//
|
}
|
|
void CReviewInterface::DC2P_SetCameraCenterGo(int nModuleIndex, int nMoveAxis, double dPosX, double dPosY)
|
{
|
// 장비모드 체크
|
if (IsManualProcessMode()==FALSE)
|
{
|
return;
|
}
|
|
Motor_CameraCenterGo(nModuleIndex, dPosX, dPosY, nMoveAxis); //mch test
|
}
|
|
|
void CReviewInterface::DC2P_MoveCommand(int nModuleIndex, int nCmdCode, double dX, double dY, double dR)
|
{
|
|
// 장비모드 체크
|
|
if (IsManualProcessMode() == FALSE) { return; }
|
|
int nMoveType = 0;
|
int nBit = 1;
|
CModuleStatus* pModuleStatus = Module_GetModuleStatus(nModuleIndex);
|
|
int nGantryIndex = pModuleStatus->GetGantryIndex();
|
int nHeaderIndex = pModuleStatus->GetHeaderIndex();
|
|
VectorDouble vecPos;
|
|
if (nCmdCode == MOVE_CMD_X + MOVE_CMD_Y)
|
{
|
nMoveType = nBit << (nHeaderIndex + 1);
|
nMoveType += nBit;
|
|
vecPos.push_back(dX);
|
for (int i = 0; i < nHeaderIndex; i++) vecPos.push_back(0);
|
vecPos.push_back(dY);
|
|
Motor_GantryGo(nModuleIndex, vecPos, nMoveType);
|
return;
|
}
|
|
switch (nCmdCode)
|
{
|
case MOVE_CMD_X:
|
nMoveType += nBit;
|
|
vecPos.push_back(dX);
|
Motor_GantryGo(nModuleIndex, vecPos, nMoveType);
|
break;
|
|
case MOVE_CMD_Y:
|
nMoveType = nBit << (nHeaderIndex + 1);
|
|
vecPos.push_back(dY);
|
Motor_GantryGo(nModuleIndex, vecPos, nMoveType);
|
break;
|
|
// case MOVE_CMD_R:
|
// Motor_AxisGo(nModuleIndex, 2, dR);
|
// break;
|
}
|
//// 장비모드 체크
|
//if (IsManualProcessMode()==FALSE) { return; }
|
|
//int nMoveType = 0;
|
//int nBit = 1;
|
//CModuleStatus* pModuleStatus = Module_GetModuleStatus(nModuleIndex);
|
|
//int nGantryIndex = pModuleStatus->GetGantryIndex();
|
//int nHeaderIndex = pModuleStatus->GetHeaderIndex();
|
|
//VectorDouble vecPos;
|
//double dGantryX1st = 0;
|
//double dGantryX2nd = 0;
|
//double dGamtryY = 0;
|
//dGantryX1st = Module_GetModuleStatus(nModuleIndex)->GetMotorPosition()->dGlassPosX;
|
//dGantryX2nd = Module_GetModuleStatus(nModuleIndex)->GetMotorPosition()->dGlassPosX;
|
|
//if (nModuleIndex == 0)
|
//{
|
// dGantryX1st = dX;
|
// const CModuleStatus *pModuleStatus = Module_GetModuleStatus(0);
|
// if (pModuleStatus == NULL) return;
|
// // offset 적용
|
// const SCoordInfo* pCoordInfo = pModuleStatus->GetCoordInfo();
|
// if (pCoordInfo == NULL) return;
|
// m_pCoordCalibrator->TransGlass2Motor(pCoordInfo, dGantryX1st, dGamtryY);
|
|
// if (dGantryX2nd - dGantryX1st > 300)
|
// {
|
|
// }
|
// else
|
// {
|
// DC2P_MoveCommand(1, MOVE_CMD_X + MOVE_CMD_Y, 0, 0, 0);
|
|
// if (IDP2P_GetMotionEnd(1) == TRUE)
|
// {
|
// dGantryX2nd = Module_GetModuleStatus(1)->GetMotorPosition()->dGlassPosX;
|
// if (abs(dGantryX2nd - dGantryX1st) > 300)
|
// {
|
|
// }
|
// else
|
// {
|
// return;
|
// }
|
// }
|
// }
|
|
//}
|
//else
|
//{
|
// dGantryX2nd = dX;
|
// const CModuleStatus *pModuleStatus = Module_GetModuleStatus(1);
|
// if (pModuleStatus == NULL) return;
|
// // offset 적용
|
// const SCoordInfo* pCoordInfo = pModuleStatus->GetCoordInfo();
|
// if (pCoordInfo == NULL) return;
|
// m_pCoordCalibrator->TransGlass2Motor(pCoordInfo, dGantryX2nd, dGamtryY);
|
|
// if (dGantryX2nd- dGantryX1st > 300)
|
// {
|
|
// }
|
// else
|
// {
|
// DC2P_MoveCommand(0, MOVE_CMD_X + MOVE_CMD_Y, 0, 0, 0);
|
|
// if (IDP2P_GetMotionEnd(0) == TRUE)
|
// {
|
// dGantryX1st = Module_GetModuleStatus(0)->GetMotorPosition()->dGlassPosX;
|
// if (abs(dGantryX2nd - dGantryX1st) > 300)
|
// {
|
|
// }
|
// else
|
// {
|
// return;
|
// }
|
// }
|
// }
|
//}
|
|
//if (nCmdCode==MOVE_CMD_X+MOVE_CMD_Y)
|
//{
|
// nMoveType = nBit << (nHeaderIndex + 1);
|
// nMoveType += nBit;
|
|
// vecPos.push_back(dX);
|
// for(int i = 0; i < nHeaderIndex; i++) vecPos.push_back(0);
|
// vecPos.push_back(dY);
|
|
// Motor_GantryGo(nModuleIndex, vecPos, nMoveType);
|
// return;
|
//}
|
|
//switch(nCmdCode)
|
//{
|
//case MOVE_CMD_X:
|
// nMoveType += nBit;
|
|
// vecPos.push_back(dX);
|
// Motor_GantryGo(nModuleIndex, vecPos, nMoveType);
|
// break;
|
|
//case MOVE_CMD_Y:
|
// nMoveType = nBit << (nHeaderIndex + 1);
|
|
// vecPos.push_back(dY);
|
// Motor_GantryGo(nModuleIndex, vecPos, nMoveType);
|
// break;
|
|
// // case MOVE_CMD_R:
|
// // Motor_AxisGo(nModuleIndex, 2, dR);
|
// // break;
|
//}
|
}
|
|
void CReviewInterface::DC2P_MoveCommandTheta(double dTheta)
|
{
|
|
}
|
|
void CReviewInterface::DC2P_JogCommandTheta(int nCommandFlag)
|
{
|
// 장비모드 체크
|
if (IsManualProcessMode()==FALSE)
|
{
|
return;
|
}
|
|
BOOL bResult = Motor_AxisThetaJogCommand(nCommandFlag);
|
|
if (bResult)
|
{
|
switch (nCommandFlag)
|
{
|
case JogDirection_Stop:
|
g_pLog->DisplayMessage(_T("[Manual] Theta Axis Jog_Stop!"));
|
break;
|
case JogDirection_Plus:
|
g_pLog->DisplayMessage(_T("[Manual] Theta Axis Jog_Plus!"));
|
break;
|
case JogDirection_Minus:
|
g_pLog->DisplayMessage(_T("[Manual] Theta Axis Jog_Minus!"));
|
break;
|
}
|
}
|
else
|
{
|
g_pLog->DisplayMessage(_T("[Manual] Theta Axis Jog Command Fail!"));
|
}
|
}
|
|
void CReviewInterface::DC2P_JogCommand(int nModuleIndex, int nAxisFlag, int nCommandFlag)
|
{
|
//jog 이동20201216
|
// 장비모드 체크
|
if (IsManualProcessMode()==FALSE)
|
{
|
return;
|
}
|
|
if (m_pMotorControl==NULL) return;
|
|
// camera control 변경
|
SAxisIndex* pAxisIndex = Module_GetAxisIndex(nModuleIndex);
|
if (pAxisIndex==NULL) return;
|
|
SCoordInfo* pCoordInfo = Module_GetCoordInfo(nModuleIndex);
|
if(pCoordInfo == NULL) return;
|
|
const CMotorControlInfo* pMotorControlInfo = m_pMotorControl->GetControlInfo();
|
if (pMotorControlInfo == NULL) return;
|
|
int nAxisIdx = -1;
|
int nJogCommand = 0;
|
BOOL bResult = FALSE;
|
|
double dXposPlusLimitPos;
|
double dXposMinusLimitPos;
|
double dYposPlusLimitPos;
|
double dYposMinusLimitPos;
|
dXposPlusLimitPos = m_pDoc->System_GetMotorInfo()->GetMotorGantryAddr(nModuleIndex)->GetMotorAxisAddr(0)->m_dPlusLimitPos;
|
dXposMinusLimitPos = m_pDoc->System_GetMotorInfo()->GetMotorGantryAddr(nModuleIndex)->GetMotorAxisAddr(0)->m_dMinusLimitPos;
|
dYposPlusLimitPos = m_pDoc->System_GetMotorInfo()->GetMotorGantryAddr(nModuleIndex)->GetMotorAxisAddr(1)->m_dPlusLimitPos;
|
dYposMinusLimitPos = m_pDoc->System_GetMotorInfo()->GetMotorGantryAddr(nModuleIndex)->GetMotorAxisAddr(1)->m_dMinusLimitPos;
|
|
double d1stGantryXpos, d1stGantryYpos, d2ndGantryXpos, d2ndGantryYpos;
|
double dDistance, dCameraDistance;
|
d1stGantryXpos = m_vecModuleStatus[0].GetMotorPosition()->dMotorPosX;
|
d1stGantryYpos = m_vecModuleStatus[0].GetMotorPosition()->dMotorPosY;
|
d2ndGantryXpos = m_vecModuleStatus[1].GetMotorPosition()->dMotorPosX;
|
d2ndGantryYpos = m_vecModuleStatus[1].GetMotorPosition()->dMotorPosY;
|
//m_pDoc->System_GetSystemInfo()->GetGantryInfo(nModuleIndex)->GetHeaderInfo(nModuleIndex)->GetCameraInfo(nModuleIndex)->GetCameraDistanceX();
|
dCameraDistance = m_pDoc->System_GetSystemInfo()->GetGantryInfo(1)->GetHeaderInfo(0)->GetCameraInfo(0)->GetCameraDistanceX();
|
dDistance = m_pDoc->System_GetSystemInfo()->m_dCollisionDistance;
|
int nOriginDir= m_pDoc->System_GetMotorInfo()->GetOriginDirection();
|
|
if (nCommandFlag != JogDirection_Stop)
|
{
|
if (nModuleIndex == 0) //LT
|
{
|
if (nOriginDir == 0)
|
{
|
if (nAxisFlag == 2)//위Y -
|
{
|
if (d1stGantryYpos <= dYposMinusLimitPos)
|
{
|
g_pLog->DisplayMessage(_T("[Manual] Y MinusLimit !!"), nAxisIdx);
|
return;
|
}
|
}
|
else if (nAxisFlag == 0)//왼X -
|
{
|
if (d1stGantryXpos <= dXposMinusLimitPos)
|
{
|
g_pLog->DisplayMessage(_T("[Manual] X PlusLimit !!"), nAxisIdx);
|
return;
|
}
|
|
}
|
else if (nAxisFlag == 3)//아래Y +
|
{
|
if (d1stGantryYpos >= dYposPlusLimitPos)
|
{
|
g_pLog->DisplayMessage(_T("[Manual] Y PlusLimit !!"), nAxisIdx);
|
return;
|
}
|
}
|
else if (nAxisFlag == 1)//오른X +
|
{
|
|
if (d1stGantryXpos >= dXposPlusLimitPos)
|
{
|
g_pLog->DisplayMessage(_T("[Manual] X MinusLimit !!"), nAxisIdx);
|
return;
|
}
|
|
if (abs(d1stGantryXpos + d2ndGantryXpos) > (dCameraDistance - dDistance))
|
{
|
g_pLog->DisplayMessage(_T("[Manual] 0번축 겐트리가 너무 가깝습니다."), nAxisIdx);
|
return;
|
}
|
}
|
}
|
else if (nOriginDir == 2) //LB
|
{
|
if (nAxisFlag == 2)//위Y +
|
{
|
if (d1stGantryYpos >= dYposPlusLimitPos)
|
{
|
g_pLog->DisplayMessage(_T("[Manual] Y PlusLimit !!"), nAxisIdx);
|
return;
|
}
|
|
}
|
else if (nAxisFlag == 0)//왼X -
|
{
|
|
if (d1stGantryXpos <= dXposMinusLimitPos)
|
{
|
g_pLog->DisplayMessage(_T("[Manual] X PlusLimit !!"), nAxisIdx);
|
return;
|
}
|
}
|
else if (nAxisFlag == 3)//아래Y -
|
{
|
|
if (d1stGantryYpos <= dYposMinusLimitPos)
|
{
|
g_pLog->DisplayMessage(_T("[Manual] Y MinusLimit !!"), nAxisIdx);
|
return;
|
}
|
}
|
else if (nAxisFlag == 1)//오른X +
|
{
|
if (d1stGantryXpos >= dXposPlusLimitPos)
|
{
|
g_pLog->DisplayMessage(_T("[Manual] X MinusLimit !!"), nAxisIdx);
|
return;
|
}
|
|
if (abs(d1stGantryXpos + d2ndGantryXpos) > (dCameraDistance - dDistance))
|
{
|
g_pLog->DisplayMessage(_T("[Manual] 0번축 겐트리가 너무 가깝습니다."), nAxisIdx);
|
return;
|
}
|
|
}
|
}
|
|
|
}
|
else
|
{
|
if (nOriginDir == 0)
|
{
|
if (nAxisFlag == 2)//위Y -
|
{
|
if (d2ndGantryYpos <= dYposMinusLimitPos)
|
{
|
g_pLog->DisplayMessage(_T("[Manual] Y MinusLimit !!"), nAxisIdx);
|
return;
|
}
|
}
|
else if (nAxisFlag == 0)//왼X +
|
{
|
if (d2ndGantryXpos >= dXposPlusLimitPos)
|
{
|
g_pLog->DisplayMessage(_T("[Manual] X PlusLimit !!"), nAxisIdx);
|
return;
|
}
|
|
if (abs(d1stGantryXpos + d2ndGantryXpos) > (dCameraDistance - dDistance))
|
{
|
g_pLog->DisplayMessage(_T("[Manual] 1번축 겐트리가 너무 가깝습니다."), nAxisIdx);
|
return;
|
}
|
|
}
|
else if (nAxisFlag == 3)//아래Y +
|
{
|
if (d2ndGantryYpos >= dYposPlusLimitPos)
|
{
|
g_pLog->DisplayMessage(_T("[Manual] Y PlusLimit !!"), nAxisIdx);
|
return;
|
}
|
}
|
else if (nAxisFlag == 1)//오른X -
|
{
|
|
if (d2ndGantryXpos <= dXposMinusLimitPos)
|
{
|
g_pLog->DisplayMessage(_T("[Manual] X MinusLimit !!"), nAxisIdx);
|
return;
|
}
|
}
|
}
|
else if (nOriginDir == 2) //LB
|
{
|
if (nAxisFlag == 2)//위Y +
|
{
|
if (d2ndGantryYpos >= dYposPlusLimitPos)
|
{
|
g_pLog->DisplayMessage(_T("[Manual] Y PlusLimit !!"), nAxisIdx);
|
return;
|
}
|
|
}
|
else if (nAxisFlag == 0)//왼X +
|
{
|
if (d2ndGantryXpos >= dXposPlusLimitPos)
|
{
|
g_pLog->DisplayMessage(_T("[Manual] X PlusLimit !!"), nAxisIdx);
|
return;
|
}
|
|
if (abs(d1stGantryXpos + d2ndGantryXpos) > (dCameraDistance - dDistance))
|
{
|
g_pLog->DisplayMessage(_T("[Manual] 1번축 겐트리가 너무 가깝습니다."), nAxisIdx);
|
return;
|
}
|
|
}
|
else if (nAxisFlag == 3)//아래Y -
|
{
|
|
if (d2ndGantryYpos <= dYposMinusLimitPos)
|
{
|
g_pLog->DisplayMessage(_T("[Manual] Y MinusLimit !!"), nAxisIdx);
|
return;
|
}
|
}
|
else if (nAxisFlag == 1)//오른X -
|
{
|
|
|
if (d2ndGantryXpos <= dXposMinusLimitPos)
|
{
|
g_pLog->DisplayMessage(_T("[Manual] X MinusLimit !!"), nAxisIdx);
|
return;
|
}
|
}
|
}
|
}
|
|
}
|
|
GetJogAxisIndexCommand(pMotorControlInfo, pAxisIndex, pCoordInfo, nAxisFlag, nCommandFlag, nAxisIdx, nJogCommand, nModuleIndex); //taek 201230
|
|
if (nAxisIdx==-1 || nJogCommand==-1) return;
|
|
bResult = Motor_AxisJogCommand(nAxisIdx, nJogCommand);
|
|
if (bResult)
|
{
|
switch (nJogCommand)
|
{
|
case JogDirection_Stop:
|
g_pLog->DisplayMessage(_T("[Manual] %d Axis Jog_Stop!"), nAxisIdx);
|
break;
|
case JogDirection_Plus:
|
g_pLog->DisplayMessage(_T("[Manual] %d Axis Jog_Plus!"), nAxisIdx);
|
break;
|
case JogDirection_Minus:
|
g_pLog->DisplayMessage(_T("[Manual] %d Axis Jog_Minus!"), nAxisIdx);
|
break;
|
}
|
}
|
else
|
{
|
g_pLog->DisplayMessage(_T("[Manual] %d Axis Jog Command Fail!"), nAxisIdx);
|
}
|
}
|
|
BOOL CReviewInterface::GetJogAxisIndexCommand(const CMotorControlInfo* pControlInfo, const SAxisIndex* pAxisIndex, const SCoordInfo *pCoordInfo, int nJogDir, int nGoStopFlag, int& nAxisIdx, int& nJogCmd, int nModulelIdx) //taek 201230
|
{
|
if (pControlInfo==NULL || pAxisIndex==NULL || pCoordInfo==NULL) return FALSE;
|
|
nJogCmd = JogDirection_Stop;
|
|
switch (nJogDir)
|
{
|
case JogCommand_Left:
|
{
|
// x axis index
|
nAxisIdx = pAxisIndex->nAxisIndexX;
|
|
if (nModulelIdx == 1)
|
{
|
// x jog command
|
if (nGoStopFlag == 1)
|
{
|
if(pControlInfo->GetOriginDirection() == MotorOriginDir_LeftTop || pControlInfo->GetOriginDirection() == MotorOriginDir_LeftBottom)
|
nJogCmd = (pCoordInfo->nDirectionX) ? JogDirection_Plus : JogDirection_Minus;
|
else
|
nJogCmd = (pCoordInfo->nDirectionX) ? JogDirection_Minus : JogDirection_Plus;
|
}
|
}
|
else
|
{
|
// x jog command
|
if (nGoStopFlag == 1)
|
{
|
if (pControlInfo->GetOriginDirection() == MotorOriginDir_RightTop || pControlInfo->GetOriginDirection() == MotorOriginDir_RightBottom)
|
nJogCmd = (pCoordInfo->nDirectionX) ? JogDirection_Plus : JogDirection_Minus;
|
else
|
nJogCmd = (pCoordInfo->nDirectionX) ? JogDirection_Minus : JogDirection_Plus;
|
}
|
}
|
}
|
break;
|
|
case JogCommand_Right:
|
{
|
// x axis index
|
nAxisIdx = pAxisIndex->nAxisIndexX;
|
|
if (nModulelIdx == 1)
|
{
|
// x jog command
|
if (nGoStopFlag == 1)
|
{
|
if(pControlInfo->GetOriginDirection() == MotorOriginDir_RightTop || pControlInfo->GetOriginDirection() == MotorOriginDir_RightBottom)
|
nJogCmd = (pCoordInfo->nDirectionX) ? JogDirection_Plus : JogDirection_Minus;
|
else
|
nJogCmd = (pCoordInfo->nDirectionX) ? JogDirection_Minus : JogDirection_Plus;
|
}
|
}
|
else
|
{
|
// x jog command
|
if (nGoStopFlag == 1)
|
{
|
if (pControlInfo->GetOriginDirection() == MotorOriginDir_LeftTop || pControlInfo->GetOriginDirection() == MotorOriginDir_LeftBottom)
|
nJogCmd = (pCoordInfo->nDirectionX) ? JogDirection_Plus : JogDirection_Minus;
|
else
|
nJogCmd = (pCoordInfo->nDirectionX) ? JogDirection_Minus : JogDirection_Plus;
|
}
|
}
|
}
|
break;
|
|
case JogCommand_Top:
|
{
|
// y axis index
|
nAxisIdx = pAxisIndex->nAxisIndexY;
|
|
// y jog command
|
if (nGoStopFlag == 1)
|
{
|
if(pControlInfo->GetOriginDirection() == MotorOriginDir_LeftTop || pControlInfo->GetOriginDirection() == MotorOriginDir_RightTop)
|
nJogCmd = (pCoordInfo->nDirectionX) ? JogDirection_Minus : JogDirection_Plus;
|
else
|
nJogCmd = (pCoordInfo->nDirectionX) ? JogDirection_Plus : JogDirection_Minus;
|
}
|
}
|
break;
|
|
case JogCommand_Bottom:
|
{
|
// y axis index
|
nAxisIdx = pAxisIndex->nAxisIndexY;
|
|
// y jog command
|
if (nGoStopFlag == 1)
|
{
|
if(pControlInfo->GetOriginDirection() == MotorOriginDir_LeftBottom || pControlInfo->GetOriginDirection() == MotorOriginDir_RightBottom)
|
nJogCmd = (pCoordInfo->nDirectionX) ? JogDirection_Minus : JogDirection_Plus;
|
else
|
nJogCmd = (pCoordInfo->nDirectionX) ? JogDirection_Plus : JogDirection_Minus;
|
}
|
}
|
break;
|
|
default:
|
break;
|
}
|
|
return TRUE;
|
}
|
|
void CReviewInterface::DC2P_JogSpeed(double dSpeedValue)
|
{
|
// 장비모드 체크
|
if (IsManualProcessMode()==FALSE) { return; }
|
|
if(m_pMotorControl == NULL) return ;
|
if(m_pDoc == NULL) return ;
|
CGlassResult *pGlassResult = m_pDoc->GlassResult_GetCurrentGlassResult();
|
if(pGlassResult == NULL) return ;
|
|
const CSystemInfo *pSystemInfo = m_pDoc->System_GetSystemInfo();
|
if(pSystemInfo == NULL) return ;
|
|
const CMotorControlInfo* pMotorInfo = m_pDoc->System_GetMotorInfo();
|
if (pMotorInfo == NULL) return ;
|
|
// theta motor
|
if(pMotorInfo->GetUseThetaMotor())
|
{
|
const CMotorAxisAddr* pThetaMotorAxisAddr = pMotorInfo->GetThetaMotorAxisAddr();
|
double dMaxJogSpeed = pThetaMotorAxisAddr->m_dMaxJogSpeed;
|
double dMinJogSpeed = pThetaMotorAxisAddr->m_dMinJogSpeed;
|
double dCalculateJogSpeed = (dMaxJogSpeed - dMinJogSpeed) * dSpeedValue + dMinJogSpeed;
|
if (m_pMotorControl->WriteAddressValue(pThetaMotorAxisAddr->m_nJogSpeedAddr, dCalculateJogSpeed))
|
{
|
g_pLog->DisplayMessage(_T("[User] Rotate Motor Jog Speed %.3lf Success!"), dCalculateJogSpeed);
|
}
|
else
|
{
|
g_pLog->DisplayMessage(_T("[User] Rotate Motor Jog Speed %.3lf Fail!"), dCalculateJogSpeed);
|
}
|
}
|
|
// x/y motor
|
int nMotorGantryAddr = pMotorInfo->GetMotorGantryAddrCount();
|
int nMotorIdx = 0;
|
for(int nMotorGantryAddrIdx = 0; nMotorGantryAddrIdx < nMotorGantryAddr; nMotorGantryAddrIdx ++ )
|
{
|
const CMotorGantryAddr* pMotorGantryAddr = pMotorInfo->GetMotorGantryAddr(nMotorGantryAddrIdx);
|
if(pMotorGantryAddr == NULL) continue ;
|
|
int nMotorAxisAddr = pMotorGantryAddr->GetMotorAxisAddrCount();
|
for(int nMotorAxisAddrIdx = 0; nMotorAxisAddrIdx < nMotorAxisAddr; nMotorAxisAddrIdx++ )
|
{
|
const CMotorAxisAddr* pMotorAxisAddr = pMotorGantryAddr->GetMotorAxisAddr(nMotorAxisAddrIdx);
|
if(pMotorAxisAddr == NULL) continue ;
|
|
double dMaxJogSpeed = pMotorAxisAddr->m_dMaxJogSpeed;
|
double dMinJogSpeed = pMotorAxisAddr->m_dMinJogSpeed;
|
double dCalculateJogSpeed = (dMaxJogSpeed - dMinJogSpeed) * dSpeedValue + dMinJogSpeed;
|
|
if (Motor_AxisJogSpeed(nMotorIdx, dCalculateJogSpeed))
|
{
|
g_pLog->DisplayMessage(_T("[User] Motor %02d Jog Speed %.3lf Success!"), nMotorIdx++, dCalculateJogSpeed);
|
}
|
else
|
{
|
g_pLog->DisplayMessage(_T("[User] Motor %02d Jog Speed %.3lf Fail!"), nMotorIdx++, dCalculateJogSpeed);
|
}
|
}
|
}
|
|
|
// afm motor
|
double dZJogMax = 0.1;
|
double dSpeed = dSpeedValue * dZJogMax;
|
dSpeed = (dSpeed==0.0) ? 0.0001: dSpeed;
|
int nGantryNumber = pSystemInfo->GetGantryInfoCount();
|
|
for(int nGantryIdx = 0; nGantryIdx < nGantryNumber; nGantryIdx++ )
|
{
|
const CGantryInfo* pGantryInfo = pSystemInfo->GetGantryInfo(nGantryIdx);
|
if(pGantryInfo == NULL) continue;
|
|
int nHeaderNumber = pGantryInfo->GetHeaderInfoCount();
|
for(int nHeaderIdx = 0; nHeaderIdx < nHeaderNumber; nHeaderIdx++ )
|
{
|
const CHeaderInfo* pHeaderInfo = pGantryInfo->GetHeaderInfo(nHeaderIdx);
|
if(pHeaderInfo == NULL) continue;
|
|
int nAFMNumber = pHeaderInfo->GetAFMInfoCount();
|
for(int nAFMIdx = 0; nAFMIdx < nAFMNumber; nAFMIdx++ )
|
{
|
const CAfmControlInfo* pAFMInfo = pHeaderInfo->GetAFMInfo(nAFMIdx);
|
if(pAFMInfo == NULL) continue;
|
|
double nMaxJogSpeed = pAFMInfo->GetMaxJogSpeed();
|
double nMinJogSpeed = pAFMInfo->GetMinJogSpeed();
|
double nCalculateJogSpeed = (nMaxJogSpeed - nMinJogSpeed) * dSpeedValue + nMinJogSpeed;
|
|
if (AFM_SetAFMJogSpeed(pHeaderInfo->m_nAFMIndex, nCalculateJogSpeed))
|
{
|
g_pLog->DisplayMessage(_T("[User] Motor Z Jog Speed %.3lf Success!"), nCalculateJogSpeed);
|
}
|
else
|
{
|
g_pLog->DisplayMessage(_T("[User] Motor Z Jog Speed %.3lf Fail!"), nCalculateJogSpeed);
|
}
|
}
|
}
|
}
|
|
/* if (AFM_SetAFMJogSpeed(dSpeed))
|
{
|
g_pLog->DisplayMessage(_T("[User] Motor Z Jog Speed %.3lf Success!"), dSpeed);
|
}
|
else
|
{
|
g_pLog->DisplayMessage(_T("[User] Motor Z Jog Speed %.3lf Fail!"), dSpeed);
|
}*/
|
}
|
|
void CReviewInterface::DC2P_ShowReviewPopUP()
|
{
|
m_pView->ShowReviewPopUP();
|
}
|
|
void CReviewInterface::DC2P_SetOffSetOn()
|
{
|
if (m_bIsOffSetOn == FALSE)
|
{
|
m_bIsOffSetOn = TRUE;
|
}
|
else
|
{
|
m_bIsOffSetOn = FALSE;
|
}
|
}
|
|
void CReviewInterface::DC2P_SetSimulation()
|
{
|
if (m_bIsSimulation == FALSE)
|
{
|
m_bIsSimulation = TRUE;
|
}
|
else
|
{
|
m_bIsSimulation = FALSE;
|
}
|
}
|
|
CModuleStatus* CReviewInterface::DC2P_Get_Selected_module_Status()
|
{
|
return Module_GetSelectedModuleStatus();
|
}
|
|
void CReviewInterface::DRC2P_MoveMotorMouseDoubleClick(int nDiffPixelX, int nDIffPixelY)
|
{
|
// 장비모드 체크
|
if (IsManualProcessMode()==FALSE)
|
{
|
return;
|
}
|
|
const CModuleStatus* pModuleStatus = Module_GetSelectedModuleStatus();
|
if (pModuleStatus==NULL) return;
|
|
const SCameraInfo* pCameraInfo = pModuleStatus->GetCurrentCameraInfo();
|
const SMagnificInfo* pMagnificInfo = pModuleStatus->GetCurrentMagnificInfo();
|
const SMotorPosition* pMotorPos = pModuleStatus->GetMotorPosition();
|
const SCoordInfo* pCoordInfo = pModuleStatus->GetCoordInfo();
|
|
const CMotorControlInfo* pMotorInfo = m_pDoc->System_GetMotorInfo();
|
if(pMotorInfo == NULL) return;
|
|
int nMotorDirectionX;
|
int nMotorDirectionY;
|
|
if(Motor_GetMotorDirection(pModuleStatus->GetModuleIndex(), nMotorDirectionX, nMotorDirectionY))
|
{
|
if(pCameraInfo && pMotorPos && pModuleStatus && pCoordInfo && pMagnificInfo)
|
{
|
double dCurrentResolution = pCameraInfo->dResolution / pMagnificInfo->dMagnification;
|
|
double dMoveDistanceX = double(nDiffPixelX) * (dCurrentResolution);
|
double dMoveDistanceY = double(nDIffPixelY) * (dCurrentResolution);
|
|
if( fabs(dMoveDistanceX) < (pCameraInfo->nFrameWidth * dCurrentResolution) &&
|
fabs(dMoveDistanceY) < (pCameraInfo->nFrameHeight * dCurrentResolution) )
|
{
|
double dLastPosX = pMotorPos->dMotorPosX + (dMoveDistanceX / 1000.0) * nMotorDirectionX;
|
double dLastPosY = pMotorPos->dMotorPosY + (dMoveDistanceY / 1000.0) * nMotorDirectionY;
|
|
Motor_GantryGo(pModuleStatus->GetModuleIndex(), dLastPosX, dLastPosY);
|
}
|
}
|
}
|
}
|
|
BOOL CReviewInterface::DAC2P_GetAlignImage(int nType, int nIndex, CCHImageData* pImageData)
|
{
|
if (nType==0) return FALSE;
|
|
if (nIndex<0 || nIndex>=m_pAlignCameraControl->GetCameraCount()) return FALSE;
|
|
return pImageData->CopyImageFrom(m_pAlignCameraControl->GetCameraImage(nIndex, nType));
|
}
|
|
void CReviewInterface::DAC2P_SetLightLevel(int nModuleIndex, int nValue)
|
{
|
// 장비모드 체크
|
if (IsManualProcessMode()==FALSE)
|
{
|
return;
|
}
|
|
if (nModuleIndex<0 || nModuleIndex>=(int)m_vecAlignLightControl.size())
|
{
|
return;
|
}
|
|
// 조명 변경
|
if(m_vecAlignLightControl[nModuleIndex]->SetLightLevel(nValue))
|
{
|
;
|
}
|
}
|
|
CCoordCalibrator* CReviewInterface::DAC2P_GetCoordCalibrator()
|
{
|
return m_pCoordCalibrator;
|
}
|
|
void CReviewInterface::DAC2P_SetActiveAlignCameraDialog()
|
{
|
if (IsManualProcessMode())
|
{
|
return;
|
}
|
|
m_pView->SetAcitveDialog(2); // align
|
}
|
|
void CReviewInterface::DAC2P_ManualAlignProcess()
|
{
|
// 장비모드 체크
|
if (IsManualProcessMode()==FALSE)
|
{
|
return;
|
}
|
|
if (m_pAlignCameraControl==NULL) return;
|
|
CString strPath = _T("");
|
VectorString vectorFilename;
|
vectorFilename.push_back(strPath);
|
vectorFilename.push_back(strPath);
|
|
CAlignResult alignResult = m_pAlignCameraControl->FindAlignMark(vectorFilename);
|
|
switch(alignResult.nResultCode)
|
{
|
case Align_Success:
|
g_pLog->DisplayMessage(_T("Align Mark Find Success!"));
|
g_pLog->DisplayMessage(_T("1st PixelX: %d, PixelY : %d"), (int)alignResult.dFindPixelX[0], (int)alignResult.dFindPixelY[0]);
|
g_pLog->DisplayMessage(_T("2nd PixelX: %d, PixelY : %d"), (int)alignResult.dFindPixelX[1], (int)alignResult.dFindPixelY[1]);
|
break;
|
|
case Align_TempFail:
|
g_pLog->DisplayMessage(_T("Align Mark Template Fail!"));
|
g_pLog->DisplayMessage(_T("Template #1: %s"), vectorFilename[0]);
|
g_pLog->DisplayMessage(_T("Template #2: %s"), vectorFilename[1]);
|
break;
|
|
case Align_Fail:
|
g_pLog->DisplayMessage(_T("Align Mark Matching Fail!"));
|
break;
|
}
|
}
|
|
CString CReviewInterface::DDF2P_GetProgramVersion()
|
{
|
return m_strProgramVersion;
|
}
|
|
void CReviewInterface::DDF2P_SetDefectFilter(const SDefectFilter *pDefectFilter)
|
{
|
if (m_pDoc==NULL) return;
|
|
SDefectFilter *pCurDefectFilter = m_pDoc->Etc_GetDefectFilter();
|
if (pCurDefectFilter==NULL) return;
|
|
*pCurDefectFilter = *pDefectFilter;
|
|
UpdateDefectFilter(pCurDefectFilter);
|
}
|
|
BOOL CReviewInterface::Motor_ReadAddress(long nAddress, double &dValue)
|
{
|
if (m_pMotorControl==NULL) return FALSE;
|
|
return m_pMotorControl->ReadAddressValue(nAddress, dValue);
|
}
|
|
BOOL CReviewInterface::Motor_ReadAddress(long nAddress, long &nValue)
|
{
|
if (m_pMotorControl==NULL) return FALSE;
|
|
return m_pMotorControl->ReadAddressValue(nAddress, nValue);
|
}
|
|
BOOL CReviewInterface::Motor_WriteAddress(long nAddress, double dValue)
|
{
|
if (m_pMotorControl==NULL) return FALSE;
|
|
return m_pMotorControl->WriteAddressValue(nAddress, dValue);
|
}
|
|
BOOL CReviewInterface::Motor_WriteAddress(long nAddress, long nValue)
|
{
|
if (m_pMotorControl==NULL) return FALSE;
|
|
return m_pMotorControl->WriteAddressValue(nAddress, nValue);
|
}
|
|
const CRcpAFMRecipeInfo* CReviewInterface::Recipe_GetRcpAFMRecipeInfo(int nModuleIndex) const
|
{
|
if (nModuleIndex<0) return NULL;
|
|
if (m_pDoc==NULL) return NULL;
|
|
const CRsRcpReviewInfo* pRsRcpReviewInfo = m_pDoc->Recipe_GetRsRcpReviewInfo();
|
if (pRsRcpReviewInfo==NULL) return NULL;
|
|
return pRsRcpReviewInfo->GetRcpAFMRecipeInfo(nModuleIndex);
|
}
|
|
int CReviewInterface::Recipe_GetRcpAFMRecipeInfoCount() const
|
{
|
if (m_pDoc==NULL) return 0;
|
|
const CRsRcpReviewInfo* pRsRcpReviewInfo = m_pDoc->Recipe_GetRsRcpReviewInfo();
|
if (pRsRcpReviewInfo==NULL) return NULL;
|
|
return pRsRcpReviewInfo->GetRcpAFMRecipeInfoCount();
|
}
|
|
const CRcpUserDefectInfo* CReviewInterface::Recipe_GetRcpUserDefectInfo(int nModuleIndex) const
|
{
|
if (nModuleIndex<0) return NULL;
|
|
if (m_pDoc==NULL) return NULL;
|
|
const CRsRcpReviewInfo* pRsRcpReviewInfo = m_pDoc->Recipe_GetRsRcpReviewInfo();
|
if (pRsRcpReviewInfo==NULL) return NULL;
|
|
return pRsRcpReviewInfo->GetRcpUserDefectInfo(nModuleIndex);
|
}
|
|
int CReviewInterface::Recipe_GetRcpReflowParameterCount() const
|
{
|
if (m_pDoc==NULL) return 0;
|
|
const CRsRcpReviewInfo* pRsRcpReviewInfo = m_pDoc->Recipe_GetRsRcpReviewInfo();
|
if (pRsRcpReviewInfo==NULL) return NULL;
|
|
return pRsRcpReviewInfo->GetRcpReflowParameterCount();
|
}
|
|
int CReviewInterface::Recipe_GetRcpUserDefectInfoCount() const
|
{
|
if (m_pDoc==NULL) return 0;
|
|
const CRsRcpReviewInfo* pRsRcpReviewInfo = m_pDoc->Recipe_GetRsRcpReviewInfo();
|
if (pRsRcpReviewInfo==NULL) return NULL;
|
|
return pRsRcpReviewInfo->GetRcpUserDefectInfoCount();
|
}
|
|
const CRcpPlanInfo* CReviewInterface::Recipe_GetRcpPlanInfo(int nModuleIndex) const
|
{
|
if (nModuleIndex<0) return NULL;
|
|
if (m_pDoc==NULL) return NULL;
|
|
const CRsRcpReviewInfo* pRsRcpReviewInfo = m_pDoc->Recipe_GetRsRcpReviewInfo();
|
if (pRsRcpReviewInfo==NULL) return NULL;
|
|
return pRsRcpReviewInfo->GetRcpPlanInfo(nModuleIndex);
|
}
|
|
int CReviewInterface::Recipe_GetRcpPlanInfoCount() const
|
{
|
if (m_pDoc==NULL) return 0;
|
|
const CRsRcpReviewInfo* pRsRcpReviewInfo = m_pDoc->Recipe_GetRsRcpReviewInfo();
|
if (pRsRcpReviewInfo==NULL) return NULL;
|
|
return pRsRcpReviewInfo->GetRcpPlanInfoCount();
|
}
|
|
const CRcpPriorityInfo* CReviewInterface::Recipe_GetRcpPriorityInfo(int nModuleIndex) const
|
{
|
if (nModuleIndex<0) return NULL;
|
|
if (m_pDoc==NULL) return NULL;
|
|
const CRsRcpReviewInfo* pRsRcpReviewInfo = m_pDoc->Recipe_GetRsRcpReviewInfo();
|
if (pRsRcpReviewInfo==NULL) return NULL;
|
|
return pRsRcpReviewInfo->GetRcpPriorityInfo(nModuleIndex);
|
}
|
|
|
int CReviewInterface::Recipe_GetRcpPriorityInfoCount() const
|
{
|
if (m_pDoc==NULL) return 0;
|
|
const CRsRcpReviewInfo* pRsRcpReviewInfo = m_pDoc->Recipe_GetRsRcpReviewInfo();
|
if (pRsRcpReviewInfo==NULL) return NULL;
|
|
return pRsRcpReviewInfo->GetRcpPriorityInfoCount();
|
}
|
|
|
const CRcpLightInfo* CReviewInterface::Recipe_GetRcpLightInfo(int nModuleIndex) const
|
{
|
if (nModuleIndex<0) return NULL;
|
|
if (m_pDoc==NULL) return NULL;
|
|
const CRsRcpReviewInfo* pRsRcpReviewInfo = m_pDoc->Recipe_GetRsRcpReviewInfo();
|
if (pRsRcpReviewInfo==NULL) return NULL;
|
|
return pRsRcpReviewInfo->GetRcpLightInfo(nModuleIndex);
|
}
|
|
int CReviewInterface::Recipe_GetRcpLightInfoCount() const
|
{
|
if (m_pDoc==NULL) return 0;
|
|
const CRsRcpReviewInfo* pRsRcpReviewInfo = m_pDoc->Recipe_GetRsRcpReviewInfo();
|
if (pRsRcpReviewInfo==NULL) return NULL;
|
|
return pRsRcpReviewInfo->GetRcpLightInfoCount();
|
}
|
|
BOOL CReviewInterface::Recipe_ApplyRecipeData()
|
{
|
if(m_pDoc == NULL) return FALSE;
|
CGlassResult *pGlassResult = m_pDoc->GlassResult_GetCurrentGlassResult();
|
if(pGlassResult == NULL) return FALSE;
|
|
// 레시피 설정
|
const CRsRcpReviewInfo* pRsRcpReviewInfo = m_pDoc->Recipe_GetRsRcpReviewInfo();
|
if (pRsRcpReviewInfo==NULL) return FALSE;
|
|
|
// 글라스 정보 설정
|
STransferData* pTransferData = ISP2P_GetCurrentTransferData();
|
if (pTransferData==NULL) return FALSE;
|
|
const CGlassTypeInfo* pGlassTypeInfo = m_pDoc->System_GetGlassTypeInfo(_ttoi(pTransferData->strGlassScanSchedule));
|
if (pGlassTypeInfo==NULL) return FALSE;
|
|
// 모터 설정
|
const CMotorControlInfo *pMotorInfo = m_pDoc->System_GetMotorInfo();
|
if (pMotorInfo==NULL) return FALSE;
|
|
if (pGlassTypeInfo && pMotorInfo)
|
{
|
// Get Direction
|
int nDirectionX = CSequenceProcessor::GetDirectionX(pGlassTypeInfo->m_nOriginDirection, pMotorInfo->GetOriginDirection());
|
int nDirectionY = CSequenceProcessor::GetDirectionY(pGlassTypeInfo->m_nOriginDirection, pMotorInfo->GetOriginDirection());
|
|
// 좌표계 설정
|
m_pCoordCalibrator->SetTransDirection(nDirectionX, nDirectionY);
|
m_pCoordCalibrator->SetOriginMotorPosition(pGlassTypeInfo->m_dOriginMotorX, pGlassTypeInfo->m_dOriginMotorY);
|
if (fabs(pGlassTypeInfo->m_dAlignAngle) > 0.0000001)
|
{
|
m_pCoordCalibrator->SetRotationInfo(pGlassTypeInfo->m_dFirstAlignMotorX, pGlassTypeInfo->m_dFirstAlignMotorY,
|
pGlassTypeInfo->m_dFirstAlignGlassX, pGlassTypeInfo->m_dFirstAlignGlassY, pGlassTypeInfo->m_dAlignAngle);
|
}
|
|
// 글라스 결과 설정
|
pGlassResult->SetGlassSize(pGlassTypeInfo->m_nGlassSizeX * 1000, pGlassTypeInfo->m_nGlassSizeY * 1000);
|
pGlassResult->SetGlassOriginDirection(pGlassTypeInfo->m_nOriginDirection);
|
pGlassResult->SetCornerCutDirection(pGlassTypeInfo->m_nCornerCutDirection);
|
|
// align view update
|
m_pView->SetAlignResult(Align_None, pGlassTypeInfo->m_dOriginMotorX, pGlassTypeInfo->m_dOriginMotorY, pGlassTypeInfo->m_dAlignAngle);
|
}
|
|
// Align 정보 설정
|
const CRsRcpAlignInfo* pRsRcpAlignInfo = m_pDoc->Recipe_GetRsRcpAlignInfo();
|
if(pRsRcpAlignInfo==NULL) return FALSE;
|
|
if (pGlassTypeInfo && pRsRcpAlignInfo)
|
{
|
// Align 마크 정보 설정 (픽셀, 모터, 글라스 위치)
|
pGlassResult->m_AlignRecipe.m_nUseAlignPosMove = pGlassTypeInfo->m_nUseAlignPosMove;
|
|
// 픽셀 위치
|
pGlassResult->m_AlignRecipe.dOriginPixelX[0] = pGlassTypeInfo->m_nFirstAlignFindPixelX;
|
pGlassResult->m_AlignRecipe.dOriginPixelY[0] = pGlassTypeInfo->m_nFirstAlignFindPixelY;
|
pGlassResult->m_AlignRecipe.dOriginPixelX[1] = pGlassTypeInfo->m_nSecondAlignFindPixelX;
|
pGlassResult->m_AlignRecipe.dOriginPixelY[1] = pGlassTypeInfo->m_nSecondAlignFindPixelY;
|
|
// 모터 위치
|
pGlassResult->m_AlignRecipe.dOriginPositionX[0] = pGlassTypeInfo->m_dFirstAlignMotorX;
|
pGlassResult->m_AlignRecipe.dOriginPositionY[0] = pGlassTypeInfo->m_dFirstAlignMotorY;
|
pGlassResult->m_AlignRecipe.dOriginPositionX[1] = pGlassTypeInfo->m_dSecondAlignMotorX;
|
pGlassResult->m_AlignRecipe.dOriginPositionY[1] = pGlassTypeInfo->m_dSecondAlignMotorY;
|
|
// 글라스 위치
|
pGlassResult->m_AlignRecipe.dGlassPositionX[0] = pGlassTypeInfo->m_dFirstAlignGlassX;
|
pGlassResult->m_AlignRecipe.dGlassPositionY[0] = pGlassTypeInfo->m_dFirstAlignGlassY;
|
pGlassResult->m_AlignRecipe.dGlassPositionX[1] = pGlassTypeInfo->m_dSecondAlignGlassX;
|
pGlassResult->m_AlignRecipe.dGlassPositionY[1] = pGlassTypeInfo->m_dSecondAlignGlassY;
|
|
// Align Recipe 정보 설정 자동광량 찾기 파라미터
|
// Align Skip Mode
|
pGlassResult->m_AlignRecipe.bAlignSkipMode = pRsRcpAlignInfo->m_bAlignSkipMode;
|
|
// image matching
|
pGlassResult->m_AlignRecipe.bUseImage = pRsRcpAlignInfo->m_bUseImage;
|
pGlassResult->m_AlignRecipe.dMatchingRate = pRsRcpAlignInfo->m_dMatchingRate;
|
pGlassResult->m_AlignRecipe.strFirstImageFile = pRsRcpAlignInfo->m_strFirstImageFile;
|
pGlassResult->m_AlignRecipe.strSecondImageFile = pRsRcpAlignInfo->m_strSecondImageFile;
|
pGlassResult->m_AlignRecipe.strTotalPitchImageFile = pRsRcpAlignInfo->m_strTotalPitchImageFile;
|
|
// edge find param
|
pGlassResult->m_AlignRecipe.bUseEdge = pRsRcpAlignInfo->m_bUseEdge;
|
pGlassResult->m_AlignRecipe.nEdgeWidth = pRsRcpAlignInfo->m_nEdgeWidth;
|
pGlassResult->m_AlignRecipe.nEdgeHeight = pRsRcpAlignInfo->m_nEdgeHeight;
|
pGlassResult->m_AlignRecipe.nEdgeThreshold = pRsRcpAlignInfo->m_nEdgeThreshold;
|
pGlassResult->m_AlignRecipe.nMergeRange = pRsRcpAlignInfo->m_nMergeRange;
|
pGlassResult->m_AlignRecipe.dEdgeRate = pRsRcpAlignInfo->m_dEdgeRate;
|
|
// 노출시간
|
pGlassResult->m_AlignRecipe.bManualProcess = pRsRcpAlignInfo->m_bManualProcess;
|
pGlassResult->m_AlignRecipe.dFirstCamExposure = pRsRcpAlignInfo->m_dFirstCamExposure;
|
pGlassResult->m_AlignRecipe.dSecondCamExposure = pRsRcpAlignInfo->m_dSecondCamExposure;
|
|
// 자동광량 조건
|
pGlassResult->m_AlignRecipe.bAutoProcess = pRsRcpAlignInfo->m_bAutoProcess;
|
pGlassResult->m_AlignRecipe.dTargetMin = pRsRcpAlignInfo->m_dTargetMin;
|
pGlassResult->m_AlignRecipe.dTargetMax = pRsRcpAlignInfo->m_dTargetMax;
|
pGlassResult->m_AlignRecipe.dExposureMin = pRsRcpAlignInfo->m_dExposureMin;
|
pGlassResult->m_AlignRecipe.dExposureMax = pRsRcpAlignInfo->m_dExposureMax;
|
|
// Align Recipe 정보 설정 rotate info
|
pGlassResult->m_AlignRecipe.bRotateProcess = pRsRcpAlignInfo->m_bRotateProcess;
|
pGlassResult->m_AlignRecipe.nRetryCount = pRsRcpAlignInfo->m_nRetryCount;
|
pGlassResult->m_AlignRecipe.dGlassAngleMin = pRsRcpAlignInfo->m_dGlassAngleMin;
|
pGlassResult->m_AlignRecipe.dGlassAngleMax = pRsRcpAlignInfo->m_dGlassAngleMax;
|
|
// Align 카메라 방향 및 해상도 설정
|
int nAlignCameraInfoCount = 2;
|
for(int i = 0; i < nAlignCameraInfoCount; i++)
|
{
|
//const CCameraInfo *pCameraInfo = m_pDoc->System_GetAlignCameraInfo(i);
|
const CCameraControlInfo_Plus *pCameraInfo = m_pDoc->System_GetAlignCameraInfo(i)->GetCameraControlInfo();
|
if (pCameraInfo==NULL) continue;
|
|
// Align 조명값 변경.
|
int nLightValue = 0;
|
nLightValue = (i==0) ? (int)pRsRcpAlignInfo->m_dFirstCamExposure: (int)pRsRcpAlignInfo->m_dSecondCamExposure;
|
if (AlignLight_SetLightLevel(i, nLightValue))
|
{
|
if (i==0)
|
g_pLog->DisplayMessage(_T("[ApplyRecipeData] 1st AlignCamera Light Level Change %d Success!"), nLightValue);
|
else if (i==1)
|
g_pLog->DisplayMessage(_T("[ApplyRecipeData] 2nd AlignCamera Light Level Change %d Success!"), nLightValue);
|
}
|
else
|
{
|
if (i==0)
|
g_pLog->DisplayMessage(_T("[ApplyRecipeData] 1st AlignCamera Light Level Change %d Fail!"), nLightValue);
|
else if (i==1)
|
g_pLog->DisplayMessage(_T("[ApplyRecipeData] 2nd AlignCamera Light Level Change %d Fail!"), nLightValue);
|
}
|
|
pGlassResult->m_AlignRecipe.dCameraResolution[i] = pCameraInfo->GetPixelResolution();
|
if(pCameraInfo->GetAxisDirectionX() == CAMERA_DIRECTION_FORWARD)
|
{
|
pGlassResult->m_AlignRecipe.nCameraDirX[i] = 1;
|
}
|
else
|
{
|
pGlassResult->m_AlignRecipe.nCameraDirX[i] = -1;
|
}
|
|
if(pCameraInfo->GetAxisDirectionY() == CAMERA_DIRECTION_FORWARD)
|
{
|
pGlassResult->m_AlignRecipe.nCameraDirY[i] = 1;
|
}
|
else
|
{
|
pGlassResult->m_AlignRecipe.nCameraDirY[i] = -1;
|
}
|
|
if((int)pGlassTypeInfo->m_vecTemplateImagePath.size() == nAlignCameraInfoCount)
|
{
|
pGlassResult->m_AlignRecipe.strTemplateName[i] = pGlassTypeInfo->m_vecTemplateImagePath[i];
|
}
|
}
|
}
|
|
// 리뷰 카메라 설정.
|
if (pRsRcpReviewInfo)
|
{
|
int nModuleCount = Module_GetModuleStatusCount();
|
|
CString strRecipeName = *pGlassResult->GetPPID();
|
|
for (int i=0; i<nModuleCount; i++)
|
{
|
// AFM Tracking 정지
|
AFM_SetAFMTracking(i, FALSE);
|
|
// 조명값 변경
|
const CRcpLightInfo *pRcpLightInfo = pRsRcpReviewInfo->GetRcpLightInfo(i);
|
if (pRcpLightInfo)
|
{
|
ReviewLight_SetLightLevel(i, pRcpLightInfo->m_nLightLevel);
|
}
|
|
// 리볼버 변경
|
const CRcpAFMRecipeInfo *pRcpAFMInfo = pRsRcpReviewInfo->GetRcpAFMRecipeInfo(i);
|
if (pRcpAFMInfo)
|
{
|
Revolver_SetRevolverLevel(i, pRcpAFMInfo->m_nZoomIndex);
|
|
// AFM 배율 변경
|
AFM_SetAFMRecipeName(i, strRecipeName, pRcpAFMInfo->m_nZoomIndex);
|
}
|
}
|
}
|
|
// 결함 찾기 레시피 설정
|
const CRsRcpDefectFindInfo* pRsRcpDefectFindInfo = m_pDoc->Recipe_GetRsRcpDefectFindInfo();
|
if(m_pReviewProcessor && pRsRcpDefectFindInfo)
|
{
|
m_pReviewProcessor->SetDefectFindInfo(pRsRcpDefectFindInfo);
|
}
|
|
return TRUE;
|
}
|
|
CModuleStatus* CReviewInterface::Module_GetStandardModuleStatus()
|
{
|
for (VectorModuleStatusIt it=m_vecModuleStatus.begin(); it!=m_vecModuleStatus.end(); it++)
|
{
|
if(it->GetStandard())
|
{
|
return &(*it);
|
}
|
}
|
|
return NULL;
|
}
|
|
SMotorPosition* CReviewInterface::Module_GetStandardMotorPosition()
|
{
|
for (VectorModuleStatusIt it=m_vecModuleStatus.begin(); it!=m_vecModuleStatus.end(); it++)
|
{
|
if(it->GetStandard())
|
{
|
return it->GetMotorPosition();
|
}
|
}
|
|
return NULL;
|
}
|
|
SAxisIndex* CReviewInterface::Module_GetStandardAxisIndex()
|
{
|
for (VectorModuleStatusIt it=m_vecModuleStatus.begin(); it!=m_vecModuleStatus.end(); it++)
|
{
|
if(it->GetStandard())
|
{
|
return it->GetAxisIndex();
|
}
|
}
|
|
return NULL;
|
}
|
|
CModuleStatus* CReviewInterface::Module_GetSelectedModuleStatus()
|
{
|
for (VectorModuleStatusIt it=m_vecModuleStatus.begin(); it!=m_vecModuleStatus.end(); it++)
|
{
|
if(it->GetSelected())
|
{
|
return &(*it);
|
}
|
}
|
|
return NULL;
|
}
|
|
SMotorPosition* CReviewInterface::Module_GetSelectedMotorPosition()
|
{
|
for (VectorModuleStatusIt it=m_vecModuleStatus.begin(); it!=m_vecModuleStatus.end(); it++)
|
{
|
if(it->GetSelected())
|
{
|
return it->GetMotorPosition();
|
}
|
}
|
|
return NULL;
|
}
|
|
SAxisIndex* CReviewInterface::Module_GetSelectedAxisIndex()
|
{
|
for (VectorModuleStatusIt it=m_vecModuleStatus.begin(); it!=m_vecModuleStatus.end(); it++)
|
{
|
if(it->GetSelected())
|
{
|
return it->GetAxisIndex();
|
}
|
}
|
|
return NULL;
|
}
|
|
int CReviewInterface::Module_GetStandardModuleIndex() const
|
{
|
for (constVectorModuleStatusIt it=m_vecModuleStatus.begin(); it!=m_vecModuleStatus.end(); it++)
|
{
|
if(it->GetStandard())
|
{
|
return it->GetModuleIndex();
|
}
|
}
|
|
return -1;
|
}
|
|
int CReviewInterface::Module_GetSelectedModuleIndex() const
|
{
|
for (constVectorModuleStatusIt it=m_vecModuleStatus.begin(); it!=m_vecModuleStatus.end(); it++)
|
{
|
if(it->GetSelected())
|
{
|
return it->GetModuleIndex();
|
}
|
}
|
|
return -1;
|
}
|
|
int CReviewInterface::Module_GetModuleStatusCount(int nModuleType) const
|
{
|
if (nModuleType==0)
|
{
|
return (int)m_vecModuleStatus.size();
|
}
|
|
int nCount = 0;
|
for (constVectorModuleStatusIt it=m_vecModuleStatus.begin(); it!=m_vecModuleStatus.end(); it++)
|
{
|
if(it->GetModuleType() & nModuleType)
|
{
|
nCount++;
|
}
|
}
|
|
return nCount;
|
}
|
|
CModuleStatus* CReviewInterface::Module_GetModuleStatus(int nModuleIdx)
|
{
|
for (VectorModuleStatusIt it=m_vecModuleStatus.begin(); it!=m_vecModuleStatus.end(); it++)
|
{
|
if(it->GetModuleIndex() == nModuleIdx)
|
{
|
return &(*it);
|
}
|
}
|
|
return NULL;
|
}
|
|
SExternalIndex* CReviewInterface::Module_GetExternalIndex(int nModuleIdx)
|
{
|
for (VectorModuleStatusIt it=m_vecModuleStatus.begin(); it!=m_vecModuleStatus.end(); it++)
|
{
|
if(it->GetModuleIndex() == nModuleIdx)
|
{
|
return it->GetExternalIndex();
|
}
|
}
|
|
return NULL;
|
}
|
|
|
SCameraControl* CReviewInterface::Module_GetCameraControl(int nAFMIndex)
|
{
|
for (VectorModuleStatusIt it=m_vecModuleStatus.begin(); it!=m_vecModuleStatus.end(); it++)
|
{
|
if(it->GetModuleIndex() == nAFMIndex)
|
{
|
return it->GetCameraControl();
|
}
|
}
|
|
return NULL;
|
}
|
|
SMotorPosition* CReviewInterface::Module_GetMotorPosition(int nModuleIdx)
|
{
|
for (VectorModuleStatusIt it=m_vecModuleStatus.begin(); it!=m_vecModuleStatus.end(); it++)
|
{
|
if(it->GetModuleIndex() == nModuleIdx)
|
{
|
return it->GetMotorPosition();
|
}
|
}
|
|
return NULL;
|
}
|
|
SMotorStatus* CReviewInterface::Module_GetMotorStatus(int nModuleIdx)
|
{
|
for (VectorModuleStatusIt it=m_vecModuleStatus.begin(); it!=m_vecModuleStatus.end(); it++)
|
{
|
if(it->GetModuleIndex() == nModuleIdx)
|
{
|
return it->GetMotorStatus();
|
}
|
}
|
|
return NULL;
|
}
|
|
SAxisIndex* CReviewInterface::Module_GetAxisIndex(int nModuleIdx)
|
{
|
for (VectorModuleStatusIt it=m_vecModuleStatus.begin(); it!=m_vecModuleStatus.end(); it++)
|
{
|
if(it->GetModuleIndex() == nModuleIdx)
|
{
|
return it->GetAxisIndex();
|
}
|
}
|
|
return NULL;
|
}
|
|
SCoordInfo* CReviewInterface::Module_GetCoordInfo(int nModuleIdx)
|
{
|
for (VectorModuleStatusIt it=m_vecModuleStatus.begin(); it!=m_vecModuleStatus.end(); it++)
|
{
|
if(it->GetModuleIndex() == nModuleIdx)
|
{
|
return it->GetCoordInfo();
|
}
|
}
|
|
return NULL;
|
}
|
|
SCameraInfo* CReviewInterface::Module_GetCurrentCameraInfo(int nModuleIdx)
|
{
|
for (VectorModuleStatusIt it=m_vecModuleStatus.begin(); it!=m_vecModuleStatus.end(); it++)
|
{
|
if(it->GetModuleIndex() == nModuleIdx)
|
{
|
return it->GetCurrentCameraInfo();
|
}
|
}
|
|
return NULL;
|
}
|
|
SCameraInfo* CReviewInterface::Module_GetCameraInfo(int nModuleIdx, int nZoomIdx)
|
{
|
for (VectorModuleStatusIt it=m_vecModuleStatus.begin(); it!=m_vecModuleStatus.end(); it++)
|
{
|
if(it->GetModuleIndex() == nModuleIdx)
|
{
|
return it->GetCameraInfo(nZoomIdx);
|
}
|
}
|
|
return NULL;
|
}
|
|
SMagnificInfo* CReviewInterface::Module_GetCurrentMagnificInfo(int nModuleIdx)
|
{
|
for (VectorModuleStatusIt it=m_vecModuleStatus.begin(); it!=m_vecModuleStatus.end(); it++)
|
{
|
if(it->GetModuleIndex() == nModuleIdx)
|
{
|
return it->GetCurrentMagnificInfo();
|
}
|
}
|
|
return NULL;
|
}
|
|
SMagnificInfo* CReviewInterface::Module_GetMagnificInfo(int nModuleIdx, int nZoomIdx)
|
{
|
for (VectorModuleStatusIt it=m_vecModuleStatus.begin(); it!=m_vecModuleStatus.end(); it++)
|
{
|
if(it->GetModuleIndex() == nModuleIdx)
|
{
|
return it->GetMagnificInfo(nZoomIdx);
|
}
|
}
|
|
return NULL;
|
}
|
|
// 좌표 범위 데이터
|
class DataAxisRange
|
{
|
public:
|
DataAxisRange() { Reset(); }
|
~DataAxisRange() { Reset(); }
|
|
void Reset()
|
{
|
nModuleIdx = 0;
|
nUMStartX = 0;
|
nUMEndX = 0;
|
nUMStartY = 0;
|
nUMEndY = 0;
|
}
|
|
int nModuleIdx;
|
int nUMStartX;
|
int nUMEndX;
|
int nUMStartY;
|
int nUMEndY;
|
};
|
|
int CReviewInterface::Module_GetMoveIndex(int nSelectedModuleIndex, int nUMGlassX, int nUMGlassY, BOOL bAutoSelectCamera)
|
{
|
int nGoModuleIdx = -1;
|
|
if (m_pMotorControl == NULL) return nGoModuleIdx;
|
if (m_pCoordCalibrator == NULL) return nGoModuleIdx;
|
|
SMotorPosition *pMotorPosition = new SMotorPosition;
|
if (pMotorPosition == NULL) return nGoModuleIdx;
|
|
typedef std::vector<DataAxisRange> VecAxisRange;
|
typedef std::vector<DataAxisRange>::iterator VecAxisRangeIt;
|
VecAxisRange vecRangeGlassAxis;
|
vecRangeGlassAxis.clear();
|
|
int nTotalModuleCount = Module_GetModuleStatusCount();
|
SAxisIndex* pAxisIndex;
|
double dAxisPlusLimitX=0, dAxisMinusLimitX=0, dAxisPlusLimitY=0, dAxisMinusLimitY=0;
|
for(int nM=0 ; nM<nTotalModuleCount ; nM++)
|
{
|
CModuleStatus* pModuleStatus = Module_GetModuleStatus(nM);
|
|
// only review module
|
if (!(pModuleStatus->GetModuleType() & 1))
|
continue;
|
|
// get axis index
|
pAxisIndex = pModuleStatus->GetAxisIndex();
|
|
const SCoordInfo* pCoordInfo = Module_GetCoordInfo(nM);
|
if (pCoordInfo == NULL) return nGoModuleIdx;
|
|
// get plus, minus limit
|
m_pMotorControl->GetAxisLimitPosition(pAxisIndex->nAxisIndexX, dAxisPlusLimitX, dAxisMinusLimitX);
|
m_pMotorControl->GetAxisLimitPosition(pAxisIndex->nAxisIndexY, dAxisPlusLimitY, dAxisMinusLimitY);
|
|
if(dAxisPlusLimitX == 9999 || dAxisPlusLimitY == 9999
|
|| dAxisMinusLimitX == -9999 || dAxisMinusLimitY == -9999)
|
{
|
g_pLog->DisplayMessage(_T("[Error] Insert %02d Motor Limits"), nM);
|
return -1;
|
}
|
|
// cal motor limit -> glass axis
|
DataAxisRange dataModuleGlassRange;
|
// start
|
pMotorPosition->dMotorPosX = dAxisMinusLimitX;
|
pMotorPosition->dMotorPosY = dAxisMinusLimitY;
|
m_pCoordCalibrator->TransMotor2Glass(pCoordInfo, pMotorPosition);
|
|
dataModuleGlassRange.nModuleIdx = nM;
|
dataModuleGlassRange.nUMStartX = int(pMotorPosition->dGlassPosX*1000);
|
dataModuleGlassRange.nUMStartY = int(pMotorPosition->dGlassPosY*1000);
|
// end
|
pMotorPosition->dMotorPosX = dAxisPlusLimitX;
|
pMotorPosition->dMotorPosY = dAxisPlusLimitY;
|
m_pCoordCalibrator->TransMotor2Glass(pCoordInfo, pMotorPosition);
|
|
dataModuleGlassRange.nUMEndX = int(pMotorPosition->dGlassPosX*1000);
|
dataModuleGlassRange.nUMEndY = int(pMotorPosition->dGlassPosY*1000);
|
|
// 보조 겐트리의 경우 범위 좌표를 뒤집어줌
|
if(dataModuleGlassRange.nUMStartX > dataModuleGlassRange.nUMEndX)
|
{
|
int nTemp = dataModuleGlassRange.nUMStartX;
|
dataModuleGlassRange.nUMStartX = dataModuleGlassRange.nUMEndX;
|
dataModuleGlassRange.nUMEndX = nTemp;
|
}
|
if(dataModuleGlassRange.nUMStartY > dataModuleGlassRange.nUMEndY)
|
{
|
int nTemp = dataModuleGlassRange.nUMStartY;
|
dataModuleGlassRange.nUMStartY = dataModuleGlassRange.nUMEndY;
|
dataModuleGlassRange.nUMEndY = nTemp;
|
}
|
|
// set range data
|
vecRangeGlassAxis.push_back(dataModuleGlassRange);
|
}
|
delete pMotorPosition;
|
|
// find index
|
for(VecAxisRangeIt it=vecRangeGlassAxis.begin() ; it!=vecRangeGlassAxis.end() ; it++)
|
{
|
if (nUMGlassX >= it->nUMStartX && nUMGlassX < it->nUMEndX)
|
{
|
if (nUMGlassY >= it->nUMStartY && nUMGlassY < it->nUMEndY)
|
{
|
nGoModuleIdx = it->nModuleIdx;
|
if(nSelectedModuleIndex == nGoModuleIdx)
|
break;
|
}
|
}
|
}
|
|
if(bAutoSelectCamera)
|
{
|
if(nSelectedModuleIndex != nGoModuleIdx)
|
return nGoModuleIdx;
|
}
|
else
|
{
|
if(nSelectedModuleIndex != nGoModuleIdx)
|
return -1;
|
}
|
return nSelectedModuleIndex;
|
}
|
|
void CReviewInterface::DDL2P_SelectDefect(int nDefectIdx)
|
{
|
if(m_pDoc == NULL || m_pView==NULL) return;
|
|
if (IsManualProcessMode()==FALSE) { return; }
|
|
CGlassResult *pGlassResult = m_pDoc->GlassResult_GetCurrentGlassResult();
|
if(pGlassResult == NULL) return ;
|
|
const SDefectFilter *pDefectFilter = m_pDoc->Etc_GetDefectFilter();
|
if (pDefectFilter==NULL) return;
|
|
const MapDefectResult *pMapDefectResult = pGlassResult->GetMapDefectResult();
|
if (pMapDefectResult==NULL) return;
|
|
int nSelectModuleIdx = 0;
|
CDefectResult* pDefectResult = NULL;
|
|
for (constMapDefectResultIt it = pMapDefectResult->begin(); it != pMapDefectResult->end(); it++)
|
{
|
pDefectResult = static_cast<CDefectResult*>(it->second);
|
|
if (pDefectResult && pDefectResult->nDefectIdx == nDefectIdx)
|
{
|
m_pView->UpdateSelectDefectMap(pDefectResult);
|
m_pView->UpdateSelectDefectInfoMap(pDefectResult); //taek 201214 선택한 디펙의 정보를 넘긴다.
|
m_pView->UpdateSelectDefectInfo(pDefectResult->nDefectIdx); //taek 201214 선택한 디펙의 인덱스를 넘긴다
|
|
nSelectModuleIdx = Module_GetSelectedModuleIndex();
|
|
// 이동할 모듈 인덱스 알아내기 (모듈별 limit 데이터 사용)
|
int nGoModuleIndex = Module_GetMoveIndex(nSelectModuleIdx, pDefectResult->nUMOriginX, pDefectResult->nUMOriginY, pDefectFilter->bAutoSelectCamera);
|
|
// 선택 모듈을 제외한 나머지 홈동작 작동
|
if(nGoModuleIndex >= 0)
|
{
|
Motor_HomeGoExceptOne(nGoModuleIndex, pDefectFilter->bAutoSelectCamera, TRUE);
|
}
|
else
|
{
|
g_pLog->DisplayMessage(_T("[Error] Can't Move Motor to Home"));
|
break;
|
}
|
|
|
if(IsManualProcessMode() !=FALSE){
|
|
Motor_CameraGo(nGoModuleIndex, pDefectResult->nUMOriginX, pDefectResult->nUMOriginY, pDefectFilter->bAutoSelectCamera, pDefectResult);//1219
|
}
|
|
//Motor_CameraCenterGo(nGoModuleIndex, pDefectResult->nUMOriginX, pDefectResult->nUMOriginY, pDefectFilter->bAutoSelectCamera);
|
|
// [2017:1:19]-[WEZASW] : WSI Manual Measurement 기능 추가
|
if (pDefectFilter->bUseWSI == TRUE && pDefectFilter->bUseWSIMeasurement == TRUE)
|
{
|
WSI_SetManualMeasurement(nGoModuleIndex, pDefectResult->nUMOriginX, pDefectResult->nUMOriginY, pDefectResult->dUMCenterOriginX, pDefectResult->dUMCenterOriginY, TRUE);
|
}
|
break;
|
}
|
}
|
}
|
|
void CReviewInterface::DDM2P_MoveGlassPos(double dGlassPosX, double dGlassPosY)
|
{
|
// 장비모드 체크
|
if (IsManualProcessMode()==FALSE)
|
{
|
return;
|
}
|
|
int nSelectModuleIdx = Module_GetSelectedModuleIndex();
|
|
//mch test
|
//Motor_CameraGo(nSelectModuleIdx, dGlassPosX/1000, dGlassPosY/1000);
|
}
|
|
void CReviewInterface::DDM2P_SelectDefect(int nDefectPosX, int nDefectPosY, int nDefectMarginX, int nDefectMarginY)
|
{
|
//20201216 Defect 클릭
|
if (m_pDoc==NULL || m_pView==NULL) return;
|
|
if (IsManualProcessMode()==FALSE) { return; }
|
|
|
CGlassResult *pGlassResult = m_pDoc->GlassResult_GetCurrentGlassResult();
|
if(pGlassResult == NULL) return;
|
|
const SDefectFilter *pDefectFilter = m_pDoc->Etc_GetDefectFilter();
|
if(pDefectFilter == NULL) return;
|
|
int nMarginX = nDefectMarginX; //5000; // um
|
int nMarginY = nDefectMarginY; //5000; // um
|
int nSelectedModuleIndex;
|
|
MapDefectResult *pMapReviewResult = pGlassResult->GetMapDefectResult();
|
|
if (pMapReviewResult)
|
{
|
CDefectResult* pDefectResult = NULL;
|
for (constMapDefectResultIt it = pMapReviewResult->begin(); it != pMapReviewResult->end(); it++)
|
{
|
pDefectResult = static_cast<CDefectResult*>(it->second);
|
|
if(pDefectResult == NULL) continue;
|
|
if (CDefectMap::FilterDefect(pDefectFilter, pDefectResult)==-1) continue;
|
|
if (pDefectResult->nUMOriginX >= nDefectPosX - nMarginX &&
|
pDefectResult->nUMOriginX <= nDefectPosX + nMarginX &&
|
pDefectResult->nUMOriginY >= nDefectPosY - nMarginY &&
|
pDefectResult->nUMOriginY <= nDefectPosY + nMarginY)
|
{
|
m_pView->UpdateSelectDefectList(pDefectResult->nDefectIdx);
|
m_pView->UpdateSelectDefectMap(pDefectResult);
|
|
m_pView->UpdateSelectDefectInfoMap(pDefectResult); //taek 201214 선택한 디펙의 정보를 넘긴다
|
m_pView->UpdateSelectDefectInfo(pDefectResult->nDefectIdx); //taek 201214 선택한 디펙의 사진 정보를 넘긴다.
|
|
nSelectedModuleIndex = Module_GetSelectedModuleIndex();
|
|
// 이동할 모듈 인덱스 알아내기 (모듈별 limit 데이터 사용)
|
int nGoModuleIndex = Module_GetMoveIndex(nSelectedModuleIndex, pDefectResult->nUMOriginX, pDefectResult->nUMOriginY, pDefectFilter->bAutoSelectCamera);
|
|
// 선택 모듈을 제외한 나머지 홈동작 작동
|
if(nGoModuleIndex >= 0)
|
{
|
Motor_HomeGoExceptOne(nGoModuleIndex, pDefectFilter->bAutoSelectCamera, TRUE);
|
}
|
else
|
{
|
g_pLog->DisplayMessage(_T("[Error] Can't Move Motor to Home"));
|
break;
|
}
|
|
if(IsManualProcessMode() != FALSE){
|
|
Motor_CameraGo(nSelectedModuleIndex, pDefectResult->nUMOriginX, pDefectResult->nUMOriginY, pDefectFilter->bAutoSelectCamera,pDefectResult );
|
}
|
// Motor_CameraCenterGo(nSelectedModuleIndex, pDefectResult->nUMOriginX, pDefectResult->nUMOriginY, pDefectFilter->bAutoSelectCamera);
|
|
// [2017:1:19]-[WEZASW] : WSI Manual Measurement 기능 추가
|
if (pDefectFilter->bUseWSI == TRUE && pDefectFilter->bUseWSIMeasurement == TRUE)
|
{
|
WSI_SetManualMeasurement(nGoModuleIndex, pDefectResult->nUMOriginX, pDefectResult->nUMOriginY, pDefectResult->dUMCenterOriginX, pDefectResult->dUMCenterOriginY, TRUE);
|
}
|
break;
|
}
|
}
|
}
|
}
|
|
|
void CReviewInterface::DDM2P_SelectDefect2(int nDefectPosX, int nDefectPosY, int nDefectMarginX, int nDefectMarginY, CGlassResult* pHistoryResult)
|
{
|
//20201216 Defect 클릭
|
if (m_pDoc == NULL || m_pView == NULL) return;
|
|
//if (IsManualProcessMode() == FALSE) { return; }
|
|
if (pHistoryResult == NULL) return;
|
|
const SDefectFilter *pDefectFilter = m_pDoc->Etc_GetDefectFilter();
|
if (pDefectFilter == NULL) return;
|
|
int nMarginX = nDefectMarginX; //5000; // um
|
int nMarginY = nDefectMarginY; //5000; // um
|
int nSelectedModuleIndex;
|
|
MapDefectResult *pMapReviewResult = pHistoryResult->GetMapDefectResult();
|
|
if (pMapReviewResult)
|
{
|
CDefectResult* pDefectResult = NULL;
|
for (constMapDefectResultIt it = pMapReviewResult->begin(); it != pMapReviewResult->end(); it++)
|
{
|
pDefectResult = static_cast<CDefectResult*>(it->second);
|
|
if (pDefectResult == NULL) continue;
|
|
if (CDefectMap::FilterDefect(pDefectFilter, pDefectResult) == -1) continue;
|
|
if (pDefectResult->nUMOriginX >= nDefectPosX - nMarginX &&
|
pDefectResult->nUMOriginX <= nDefectPosX + nMarginX &&
|
pDefectResult->nUMOriginY >= nDefectPosY - nMarginY &&
|
pDefectResult->nUMOriginY <= nDefectPosY + nMarginY)
|
{
|
if(m_pView->AllDefect())
|
{
|
if (m_pView->UpdateSelectDefectList2(pDefectResult->nDefectIdx))
|
{
|
m_pView->UpdateSelectDefectMap2(pDefectResult);
|
}
|
}
|
else
|
{
|
if (m_pView->UpdateSelectDefectList3(pDefectResult->nDefectIdx))
|
{
|
if (m_pView->UpdateSelectDefectList2(pDefectResult->nDefectIdx))
|
{
|
m_pView->UpdateSelectDefectMap2(pDefectResult);
|
}
|
}
|
}
|
}
|
}
|
}
|
}
|
|
BOOL CReviewInterface::IsManualProcessMode()
|
{
|
// 장비모드 체크
|
if(m_pSequenceProcessor==NULL || m_pReviewProcessor==NULL) return FALSE;
|
|
const CSystemInfo* pSystemInfo = m_pDoc->System_GetSystemInfo();
|
if(pSystemInfo==NULL)
|
{
|
g_pLog->DisplayMessage(_T("SystemInfo Is NULL"));
|
return FALSE;
|
}
|
|
if ((pSystemInfo->m_nLineType == SystemLine_CPJT && m_pSequenceProcessor->GetProcessMode() < ProcessModeManual))
|
{
|
g_pLog->DisplayMessage(_T("The Machine Status is not ManualReview!!"));
|
return FALSE;
|
}
|
|
return TRUE;
|
|
}
|
|
// dialog command 2 parent
|
void CReviewInterface::DC2P_SetUserCommand(int nCommand)
|
{
|
if (m_pSequenceProcessor==NULL) return;
|
|
//#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 ADD START
|
m_pSequenceProcessor->SetSimulationMode(TRUE);
|
//#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 ADD END
|
|
if (nCommand == -1) // DBClick Date
|
{
|
|
//CDlgSelfDiagnosis* m_pDlg;
|
//m_pDlg = new CDlgSelfDiagnosis(m_pDiagnosisManager);
|
|
|
m_pDlgDiagnosis->ShowWindow(SW_SHOW);
|
/*
|
if (m_pSignalControl)
|
{
|
int nAddrIdx = 0;
|
|
if (IsManualProcessMode()==FALSE)
|
m_pSignalControl->Write_SendSignal(nAddrIdx, SendSig_ManualMode, 1, 2000);
|
else
|
m_pSignalControl->Write_SendSignal(nAddrIdx, SendSig_AutoMode, 1, 2000);
|
}
|
*/
|
}
|
|
if (IsManualProcessMode()==FALSE)
|
{
|
g_pLog->DisplayMessage(_T("Machine Mode is not Manual or Review Mode!"));
|
return;
|
}
|
|
m_pSequenceProcessor->RecvSignalToSignalControl(PCControlRecvSignalIndex_Seq, nCommand);
|
}
|
|
// dialog user cmd 2 parent
|
void CReviewInterface::DUC2P_SetUserCommand(int nCommand)
|
{
|
if (m_pSequenceProcessor==NULL) return;
|
|
if (IsManualProcessMode()==FALSE)
|
{
|
g_pLog->DisplayMessage(_T("Machine Mode is not Manual or Review Mode!"));
|
return;
|
}
|
|
m_pSequenceProcessor->RecvSignalToSignalControl(1, nCommand);
|
}
|
|
void CReviewInterface::DMI2P_SetSelectedModuleIndex(int nModuleIdx, BOOL bExcute)
|
{ // 처음 실행 시 매뉴얼모드 체크하지 않음.
|
if (bExcute == FALSE)
|
{
|
if (IsManualProcessMode()==TRUE )
|
{
|
|
}
|
else
|
{
|
// current module index
|
if (nModuleIdx == Module_GetSelectedModuleIndex())
|
{
|
return;
|
}
|
|
if (nModuleIdx < 0 || nModuleIdx >= Module_GetModuleStatusCount())
|
{
|
return;
|
}
|
|
for (VectorModuleStatusIt it = m_vecModuleStatus.begin(); it != m_vecModuleStatus.end(); it++)
|
{
|
if (it->GetModuleIndex() == nModuleIdx)
|
{
|
it->SetSelected(TRUE);
|
}
|
else
|
{
|
it->SetSelected(FALSE);
|
}
|
}
|
|
m_pView->SelectedCameraIndex(nModuleIdx);
|
|
UpdateSelectedModuleIndex(nModuleIdx, Module_GetSelectedModuleStatus());
|
return;
|
}
|
}
|
// current module index
|
if (nModuleIdx==Module_GetSelectedModuleIndex())
|
{
|
return;
|
}
|
|
if (nModuleIdx<0 || nModuleIdx>=Module_GetModuleStatusCount())
|
{
|
return;
|
}
|
|
CString strValue = _T("");
|
CString strTemp = _T("");
|
|
m_ProcessTimer.Start();
|
ReviewCamera_CameraControl(Module_GetSelectedModuleIndex(), CameraControlStop);
|
m_ProcessTimer.End();
|
strTemp.Format(_T("Stop: %.3f ms, "), m_ProcessTimer.GetDurationMilliSecond());
|
strValue += strTemp;
|
|
m_ProcessTimer.Start();
|
for (VectorModuleStatusIt it=m_vecModuleStatus.begin(); it!=m_vecModuleStatus.end(); it++)
|
{
|
if (it->GetModuleIndex()==nModuleIdx)
|
{
|
it->SetSelected(TRUE);
|
}
|
else
|
{
|
it->SetSelected(FALSE);
|
}
|
}
|
m_ProcessTimer.End();
|
strTemp.Format(_T("Select: %.3f ms, "), m_ProcessTimer.GetDurationMilliSecond());
|
strValue += strTemp;
|
|
m_ProcessTimer.Start();
|
ReviewCamera_CameraControl(Module_GetSelectedModuleIndex(), CameraControlLive);
|
m_ProcessTimer.End();
|
strTemp.Format(_T("Live: %.3f ms"), m_ProcessTimer.GetDurationMilliSecond());
|
strValue += strTemp;
|
|
m_pView->SelectedCameraIndex(nModuleIdx);
|
|
g_pLog->DisplayMessage(strValue);
|
|
UpdateSelectedModuleIndex(nModuleIdx, Module_GetSelectedModuleStatus());
|
}
|
|
const CSystemInfo* CReviewInterface::DMI2P_GetSystemInfo()
|
{
|
if (m_pDoc==NULL) return NULL;
|
return m_pDoc->System_GetSystemInfo();
|
}
|
|
BOOL CReviewInterface::DMI2P_GetCenterCoordinate( double& dPosX, double& dPosY )
|
{
|
return GetCenterCoordinate(dPosX, dPosY);
|
}
|
|
const CGlassTypeInfo* CReviewInterface::DMI2P_StandardGlassTypeInfo()
|
{
|
if (m_pDoc==NULL) return NULL;
|
|
return m_pDoc->System_GetStandardGlassTypeInfo();
|
}
|
const CRsRcpReviewInfo* CReviewInterface::DMI2P_Recipe_GetRsRcpReviewInfo(){
|
|
if (m_pDoc==NULL) return NULL;
|
|
return m_pDoc->Recipe_GetRsRcpReviewInfo();
|
}
|
|
const CMotorControlInfo* CReviewInterface::DMI2P_GetMotorInfo()
|
{
|
if (m_pDoc==NULL) return NULL;
|
return m_pDoc->System_GetMotorInfo();
|
}
|
|
BOOL CReviewInterface::Motor_GetMotorDirection(int nModuleIndx, int& nDirX, int& nDirY)
|
{
|
CModuleStatus* pModuleStatus = Module_GetModuleStatus(nModuleIndx);
|
if(pModuleStatus == NULL) return FALSE;
|
|
const CMotorControlInfo* pMotorInfo = m_pDoc->System_GetMotorInfo();
|
if(pMotorInfo == NULL) return FALSE;
|
|
int nStandardMotorDirectionX = 0;
|
int nStandardMotorDirectionY = 0;
|
|
switch(pMotorInfo->GetOriginDirection())
|
{
|
case 0:
|
nStandardMotorDirectionX = 1;
|
nStandardMotorDirectionY = 1;
|
break;
|
case 1:
|
nStandardMotorDirectionX = -1;
|
nStandardMotorDirectionY = 1;
|
break;
|
case 2:
|
nStandardMotorDirectionX = 1;
|
nStandardMotorDirectionY = -1;
|
break;
|
case 3:
|
nStandardMotorDirectionX = -1;
|
nStandardMotorDirectionY = -1;
|
break;
|
}
|
|
const SCoordInfo* pCoordInfo = pModuleStatus->GetCoordInfo();
|
if(pCoordInfo == NULL) return FALSE;
|
|
nDirX = nStandardMotorDirectionX * pCoordInfo->nDirectionX;
|
nDirY = nStandardMotorDirectionY * pCoordInfo->nDirectionY;
|
|
return TRUE;
|
}
|
|
BOOL CReviewInterface::Motor_CollisionDetect(int nModuleIndx, double dGlassPosX, double dGlassPosY)
|
{
|
CModuleStatus* pModuleStatus = Module_GetModuleStatus(nModuleIndx);
|
if(pModuleStatus == NULL) return TRUE;
|
|
SMotorPosition* pMotorPosition = pModuleStatus->GetMotorPosition();
|
if(pMotorPosition == NULL) return TRUE;
|
|
double dTargetGlassPosX = pMotorPosition->dGlassPosX;
|
double dTargetGlassPosY = pMotorPosition->dGlassPosY;
|
|
const CSystemInfo* pSystemInfo = ISP2P_System_GetSystemInfo();
|
if(pSystemInfo == NULL) return TRUE;
|
|
const CGantryInfo* pGantryInfo = pSystemInfo->GetGantryInfo(0);
|
if(pGantryInfo == NULL) return TRUE;
|
|
double dGantryCollisionDistance = pSystemInfo->m_dCollisionDistance;
|
double dHeaderCollisionDistance = pGantryInfo->m_dCollisionDistance;
|
|
if(abs(dTargetGlassPosX - dGlassPosX) < dGantryCollisionDistance) return TRUE;
|
if(abs(dTargetGlassPosY - dGlassPosY) < dHeaderCollisionDistance) return TRUE;
|
|
return FALSE;
|
}
|
|
BOOL CReviewInterface::Motor_HomeGoExceptOne(int nModuleindex, BOOL bAutoSelectCamera, BOOL bGoEnd)
|
{
|
int nModuleStatusCount = Module_GetModuleStatusCount();
|
if(nModuleindex < 0 || nModuleindex > nModuleStatusCount) return FALSE;
|
|
CModuleStatus* pSelectedModuleStatus = Module_GetModuleStatus(nModuleindex);
|
if(pSelectedModuleStatus == NULL) return FALSE;
|
|
int nSelectedGantryNumber = pSelectedModuleStatus->GetGantryIndex();
|
|
for(int nModuleStatusIdx = 0; nModuleStatusIdx < nModuleStatusCount; nModuleStatusIdx++)
|
{
|
// 선택된 모듈 index와 같으면 스킵
|
if(nModuleStatusIdx == nModuleindex)
|
{
|
continue ;
|
}
|
|
CModuleStatus* pModulestatus = Module_GetModuleStatus(nModuleStatusIdx);
|
if(pModulestatus == NULL) continue ;
|
|
// 같은 Gantry에 있는지 확인
|
int nGantryNumber = pModulestatus->GetGantryIndex();
|
|
// 같은 Gantry면 Header만 동작
|
if(nGantryNumber == nSelectedGantryNumber)
|
{
|
Motor_AxisGo(nModuleStatusIdx, 1, 0, bAutoSelectCamera, bGoEnd);
|
}
|
// 아니면 전체 동작
|
else
|
{
|
SMotorPosition* pSMotorPosition = Module_GetMotorPosition(nModuleStatusIdx);
|
if(pSMotorPosition->dMotorPosX != 0 && pSMotorPosition->dMotorPosY != 0)
|
Motor_GantryGo(nModuleStatusIdx, 0, 0, bGoEnd);
|
}
|
}
|
|
return TRUE;
|
}
|
|
BOOL CReviewInterface::Motor_GantryGo(int nModuleIndex, double dPosX, double dPosY, BOOL bGoEnd)
|
{
|
//20201216 Defect 클릭
|
|
if(m_pDoc==NULL || m_pMotorControl==NULL || m_pSequenceProcessor==NULL) return FALSE;
|
|
const CModuleStatus *pModuleStatus = Module_GetModuleStatus(nModuleIndex);
|
if (pModuleStatus==NULL) return FALSE;
|
|
int nGantryIndex = pModuleStatus->GetGantryIndex();
|
|
CString strMessage = _T("");
|
strMessage.Format(_T("[%d Module][%d Gantry] Motor (%.3lf, %.3lf)mm Move?"), nModuleIndex, nGantryIndex, dPosX, dPosY);
|
if (IDNO == AfxMessageBox(strMessage, MB_YESNO | MB_ICONQUESTION))
|
{
|
return FALSE;
|
}
|
|
const SDefectFilter *pDefectFilter = m_pDoc->Etc_GetDefectFilter();
|
if (pDefectFilter==NULL) return FALSE;
|
|
if (pDefectFilter->bUseWSI)
|
{
|
const SMotorPosition* pPos = Module_GetMotorPosition(nModuleIndex);
|
if (pPos && pPos->bUseWSI)
|
{
|
dPosX -= pPos->dWSIOffsetX;
|
dPosY -= pPos->dWSIOffsetY;
|
}
|
}
|
g_pLog->DisplayMessage(_T("[%d Module][%d Gantry] Go [%.3lf, %.3lf]"), nModuleIndex, nGantryIndex, dPosX, dPosY);
|
|
if (bGoEnd)
|
{
|
return m_pMotorControl->GantryManualGoEnd(nGantryIndex, dPosX, dPosY);
|
}
|
|
return m_pMotorControl->GantryManualGo(nGantryIndex, dPosX, dPosY);
|
}
|
|
BOOL CReviewInterface::Motor_GantryGo(int nModuleIndex, int nDefectPosX, int nDefectPosY, BOOL bGoEnd)
|
{
|
double dPosX = nDefectPosX/1000.0;
|
double dPosY = nDefectPosX/1000.0;
|
|
return Motor_GantryGo(nModuleIndex, dPosX, dPosY, bGoEnd);
|
}
|
|
|
BOOL CReviewInterface::Motor_GantryGo(int nModuleIndex, const VectorInteger& vecMovePos, int nMoveType, BOOL bGoEnd)
|
{
|
VectorDouble vecData;
|
for (int i=0; i<(int)vecMovePos.size(); i++)
|
{
|
vecData.push_back(vecMovePos[i]/1000.0);
|
}
|
return Motor_GantryGo(nModuleIndex, vecData, nMoveType, bGoEnd);
|
|
}
|
|
BOOL CReviewInterface::Motor_GantryGo(int nModuleIndex, const VectorDouble& vecMovePos, int nMoveType, BOOL bGoEnd)
|
{
|
//
|
if(m_pDoc==NULL || m_pMotorControl==NULL || m_pSequenceProcessor==NULL) return FALSE;
|
|
const CModuleStatus *pModuleStatus = Module_GetModuleStatus(nModuleIndex);
|
if (pModuleStatus==NULL) return FALSE;
|
|
int nGantryIndex = pModuleStatus->GetGantryIndex();
|
|
CString strMessage = _T("");
|
/////////////////////////
|
|
double dXposPlusLimitPos;
|
double dXposMinusLimitPos;
|
double dYposPlusLimitPos;
|
double dYposMinusLimitPos;
|
dXposPlusLimitPos = m_pDoc->System_GetMotorInfo()->GetMotorGantryAddr(nGantryIndex)->GetMotorAxisAddr(0)->m_dPlusLimitPos;
|
dXposMinusLimitPos = m_pDoc->System_GetMotorInfo()->GetMotorGantryAddr(nGantryIndex)->GetMotorAxisAddr(0)->m_dMinusLimitPos;
|
dYposPlusLimitPos = m_pDoc->System_GetMotorInfo()->GetMotorGantryAddr(nGantryIndex)->GetMotorAxisAddr(1)->m_dPlusLimitPos;
|
dYposMinusLimitPos = m_pDoc->System_GetMotorInfo()->GetMotorGantryAddr(nGantryIndex)->GetMotorAxisAddr(1)->m_dMinusLimitPos;
|
|
if (vecMovePos[0] > dXposPlusLimitPos || vecMovePos[0]<dXposMinusLimitPos || vecMovePos[1] > dYposPlusLimitPos || vecMovePos[1] < dYposMinusLimitPos)
|
{
|
IDNO == AfxMessageBox(_T("Limit을 초과 하여 갈수 없습니다."), MB_YESNO | MB_ICONQUESTION);
|
g_pLog->DisplayMessage(_T("Limit 초과"));
|
return FALSE;
|
}
|
|
double n1stGantryXpos, n1stGantryYpos, n2ndGantryXpos, n2ndGantryYpos;
|
double dDistance, dCameraDistance;
|
n1stGantryXpos = m_vecModuleStatus[0].GetMotorPosition()->dMotorPosX;
|
//n1stGantryYpos = m_vecModuleStatus[0].GetMotorPosition()->dMotorPosY;
|
n2ndGantryXpos = m_vecModuleStatus[1].GetMotorPosition()->dMotorPosX;
|
//n2ndGantryYpos = m_vecModuleStatus[1].GetMotorPosition()->dMotorPosY;
|
//m_pDoc->System_GetSystemInfo()->GetGantryInfo(nModuleIndex)->GetHeaderInfo(nModuleIndex)->GetCameraInfo(nModuleIndex)->GetCameraDistanceX();
|
dCameraDistance = m_pDoc->System_GetSystemInfo()->GetGantryInfo(1)->GetHeaderInfo(0)->GetCameraInfo(0)->GetCameraDistanceX();
|
|
|
dCameraDistance = dCameraDistance - m_pDoc->System_GetSystemInfo()->m_dCollisionDistance;
|
|
if (nModuleIndex == 0)
|
{
|
dDistance = abs(n2ndGantryXpos + vecMovePos[0]);
|
|
}
|
else
|
{
|
dDistance = abs(n1stGantryXpos + vecMovePos[0]);
|
}
|
|
if (dDistance > dCameraDistance)
|
{
|
strMessage.Format(_T("이동할 좌표의 Gantry 위치가 너무 가깝습니다."));
|
IDNO == AfxMessageBox(strMessage, MB_YESNO | MB_ICONQUESTION);
|
return FALSE;
|
}
|
|
/////////////////////////
|
|
|
CString strTemp = _T("");
|
strTemp.Format(_T("[%d Module][%d Gantry] Motor ("), nModuleIndex, nGantryIndex);
|
strMessage += strTemp;
|
for (int i=0; i<(int) vecMovePos.size(); i++)
|
{
|
strTemp.Format(_T("%.3lf, "), vecMovePos[i]);
|
strMessage += strTemp;
|
}
|
strTemp.Format(_T(")mm Move Type => %d"), nMoveType);
|
strMessage += strTemp;
|
if (IDNO == AfxMessageBox(strMessage, MB_YESNO | MB_ICONQUESTION))
|
{
|
return FALSE;
|
}
|
|
if (bGoEnd)
|
{
|
return m_pMotorControl->GantryManualGoEnd(nGantryIndex, vecMovePos, nMoveType);
|
}
|
|
return m_pMotorControl->GantryManualGo(nGantryIndex, vecMovePos, nMoveType);
|
}
|
|
|
BOOL CReviewInterface::Motor_CameraGo(int nModuleIndex, double dPosX, double dPosY, int MoveAxis, BOOL bAutoSelectCamera, BOOL bGoEnd)
|
{
|
//201216
|
if(m_pDoc==NULL || m_pMotorControl==NULL || m_pSequenceProcessor==NULL) return FALSE;
|
|
const CModuleStatus *pModuleStatus = Module_GetModuleStatus(nModuleIndex);
|
if (pModuleStatus==NULL) return FALSE;
|
|
int nGantryIndex = pModuleStatus->GetGantryIndex();
|
|
const SDefectFilter *pDefectFilter = m_pDoc->Etc_GetDefectFilter();
|
if (pDefectFilter==NULL) return FALSE;
|
|
CString strMessage = _T("");
|
if (pDefectFilter->bUseWSI)
|
{
|
strMessage.Format(_T("[%d Module][%d Gantry] WSI Camera GlassPos (%.3lf, %.3lf)mm Move?"), nModuleIndex, nGantryIndex, dPosX, dPosY);
|
}
|
else
|
{
|
strMessage.Format(_T("[%d Module][%d Gantry] Review Camera GlassPos (%.3lf, %.3lf)mm Move?"), nModuleIndex, nGantryIndex, dPosX, dPosY);
|
}
|
|
if (IDNO == AfxMessageBox(strMessage, MB_YESNO | MB_ICONQUESTION))
|
{
|
return FALSE;
|
}
|
|
// OffSet Min,Max
|
double m_dMinOffset = -5.0;
|
double m_dMaxOffset = 5.0;
|
|
// get direction
|
int nDirectionX, nDirectionY;
|
m_pCoordCalibrator->GetTransDirection(nDirectionX, nDirectionY);
|
|
double dDefectPosX = dPosX;
|
double dDefectPosY = dPosY;
|
|
// offset 적용
|
const SCoordInfo* pCoordInfo = pModuleStatus->GetCoordInfo();
|
|
m_pCoordCalibrator->TransGlass2Motor(pCoordInfo, dDefectPosX, dDefectPosY);
|
|
if (pCoordInfo)
|
{
|
// [2016:11:16]-[WEZASW] : Manual Review의 Camera Offset 벙향 변경 ( '+' -> '-' )
|
if(pCoordInfo->dOffsetX != 0.0)
|
{
|
if(pCoordInfo->dOffsetX >= m_dMinOffset && pCoordInfo->dOffsetX <= m_dMaxOffset)
|
{
|
g_pLog->DisplayMessage(_T("Gantry[%d] OffsetX[%.03lf]"), nModuleIndex, pCoordInfo->dOffsetX);
|
dDefectPosX -= pCoordInfo->dOffsetX * nDirectionX * -1;
|
}
|
}
|
|
if(pCoordInfo->dOffsetY != 0.0)
|
{
|
if(pCoordInfo->dOffsetY >= m_dMinOffset && pCoordInfo->dOffsetY <= m_dMaxOffset)
|
{
|
g_pLog->DisplayMessage(_T("Gantry[%d] OffsetY[%.03lf]"), nModuleIndex, pCoordInfo->dOffsetY);
|
dDefectPosY -= pCoordInfo->dOffsetY * nDirectionY * -1;
|
}
|
}
|
|
|
}
|
|
// CMotorCalibrator *pCalibrator = ISP2P_GsetMotorCalibrator(nModuleIndex);
|
// if (pCalibrator!=NULL)
|
// {
|
// pCalibrator->BCalibratePosition(dDefectPosX, dDefectPosY);
|
// }
|
|
if (pDefectFilter->bUseWSI)
|
{
|
const SMotorPosition* pPos = Module_GetMotorPosition(nModuleIndex);
|
if (pPos && pPos->bUseWSI)
|
{
|
dDefectPosX -= pPos->dWSIOffsetX;
|
dDefectPosY -= pPos->dWSIOffsetY;
|
}
|
}
|
g_pLog->DisplayMessage(_T("[%d Module][%d Gantry] Go [%.3lf, %.3lf]"), nModuleIndex, nGantryIndex, dDefectPosX, dDefectPosY);
|
|
double dXposPlusLimitPos;
|
double dXposMinusLimitPos;
|
double dYposPlusLimitPos;
|
double dYposMinusLimitPos;
|
dXposPlusLimitPos = m_pDoc->System_GetMotorInfo()->GetMotorGantryAddr(nGantryIndex)->GetMotorAxisAddr(0)->m_dPlusLimitPos;
|
dXposMinusLimitPos = m_pDoc->System_GetMotorInfo()->GetMotorGantryAddr(nGantryIndex)->GetMotorAxisAddr(0)->m_dMinusLimitPos;
|
dYposPlusLimitPos = m_pDoc->System_GetMotorInfo()->GetMotorGantryAddr(nGantryIndex)->GetMotorAxisAddr(1)->m_dPlusLimitPos;
|
dYposMinusLimitPos = m_pDoc->System_GetMotorInfo()->GetMotorGantryAddr(nGantryIndex)->GetMotorAxisAddr(1)->m_dMinusLimitPos;
|
|
|
|
if (dDefectPosX > dXposPlusLimitPos|| dDefectPosX<dXposMinusLimitPos|| dDefectPosY > dYposPlusLimitPos|| dDefectPosY < dYposMinusLimitPos)
|
{
|
IDNO == AfxMessageBox(_T("Limit을 초과 하여 갈수 없습니다."), MB_YESNO | MB_ICONQUESTION);
|
g_pLog->DisplayMessage(_T("Limit 초과"));
|
return FALSE;
|
}
|
|
double n1stGantryXpos, n1stGantryYpos, n2ndGantryXpos, n2ndGantryYpos;
|
double dDistance,dCameraDistance;
|
n1stGantryXpos = m_vecModuleStatus[0].GetMotorPosition()->dMotorPosX;
|
//n1stGantryYpos = m_vecModuleStatus[0].GetMotorPosition()->dMotorPosY;
|
n2ndGantryXpos = m_vecModuleStatus[1].GetMotorPosition()->dMotorPosX;
|
//n2ndGantryYpos = m_vecModuleStatus[1].GetMotorPosition()->dMotorPosY;
|
//m_pDoc->System_GetSystemInfo()->GetGantryInfo(nModuleIndex)->GetHeaderInfo(nModuleIndex)->GetCameraInfo(nModuleIndex)->GetCameraDistanceX();
|
dCameraDistance = m_pDoc->System_GetSystemInfo()->GetGantryInfo(1)->GetHeaderInfo(0)->GetCameraInfo(0)->GetCameraDistanceX();
|
|
|
dCameraDistance = dCameraDistance - m_pDoc->System_GetSystemInfo()->m_dCollisionDistance;
|
|
if (nModuleIndex==0)
|
{
|
dDistance = abs(n2ndGantryXpos + dDefectPosX);
|
|
}
|
else
|
{
|
dDistance = abs(n1stGantryXpos + dDefectPosX);
|
}
|
|
if (dDistance > dCameraDistance)
|
{
|
strMessage.Format(_T("이동할 좌표의 Gantry 위치가 너무 가깝습니다."));
|
IDNO == AfxMessageBox(strMessage, MB_YESNO | MB_ICONQUESTION);
|
return FALSE;
|
}
|
|
// kmj added.
|
int nCmd = 1;
|
int nHeaderIndex = pModuleStatus->GetHeaderIndex();
|
nCmd += 1 << (nHeaderIndex + 1);
|
|
VectorDouble vecPos;
|
|
vecPos.push_back(dDefectPosX);
|
for(int i = 0; i < nHeaderIndex; i++) vecPos.push_back(0);
|
vecPos.push_back(dDefectPosY);
|
|
if (bGoEnd)
|
{
|
return m_pMotorControl->GantryManualGoEnd(nGantryIndex, vecPos, nCmd);
|
}
|
|
return m_pMotorControl->GantryManualGo(nGantryIndex, vecPos, nCmd);
|
}
|
|
|
BOOL CReviewInterface::Motor_CameraGo2(int nModuleIndex, double dPosX, double dPosY, int MoveAxis, BOOL bAutoSelectCamera, BOOL bGoEnd)
|
{
|
if(m_pDoc==NULL || m_pMotorControl==NULL || m_pSequenceProcessor==NULL) return FALSE;
|
|
const CModuleStatus *pModuleStatus = Module_GetModuleStatus(nModuleIndex);
|
if (pModuleStatus==NULL) return FALSE;
|
|
int nGantryIndex = pModuleStatus->GetGantryIndex();
|
|
const SDefectFilter *pDefectFilter = m_pDoc->Etc_GetDefectFilter();
|
if (pDefectFilter==NULL) return FALSE;
|
|
// OffSet Min,Max
|
double m_dMinOffset = -5.0;
|
double m_dMaxOffset = 5.0;
|
|
// get direction
|
int nDirectionX, nDirectionY;
|
m_pCoordCalibrator->GetTransDirection(nDirectionX, nDirectionY);
|
|
double dDefectPosX = dPosX;
|
double dDefectPosY = dPosY;
|
|
// offset 적용
|
const SCoordInfo* pCoordInfo = pModuleStatus->GetCoordInfo();
|
|
m_pCoordCalibrator->TransGlass2Motor(pCoordInfo, dDefectPosX, dDefectPosY);
|
|
if (pCoordInfo)
|
{
|
// [2016:11:16]-[WEZASW] : Manual Review의 Camera Offset 벙향 변경 ( '+' -> '-' )
|
if(pCoordInfo->dOffsetX != 0.0)
|
{
|
if(pCoordInfo->dOffsetX >= m_dMinOffset && pCoordInfo->dOffsetX <= m_dMaxOffset)
|
{
|
g_pLog->DisplayMessage(_T("Gantry[%d] OffsetX[%.03lf]"), nModuleIndex, pCoordInfo->dOffsetX);
|
dDefectPosX -= pCoordInfo->dOffsetX * nDirectionX * -1;
|
}
|
}
|
|
if(pCoordInfo->dOffsetY != 0.0)
|
{
|
if(pCoordInfo->dOffsetY >= m_dMinOffset && pCoordInfo->dOffsetY <= m_dMaxOffset)
|
{
|
g_pLog->DisplayMessage(_T("Gantry[%d] OffsetY[%.03lf]"), nModuleIndex, pCoordInfo->dOffsetY);
|
dDefectPosY -= pCoordInfo->dOffsetY * nDirectionY * -1;
|
}
|
}
|
}
|
|
if (pDefectFilter->bUseWSI)
|
{
|
const SMotorPosition* pPos = Module_GetMotorPosition(nModuleIndex);
|
if (pPos && pPos->bUseWSI)
|
{
|
dDefectPosX -= pPos->dWSIOffsetX;
|
dDefectPosY -= pPos->dWSIOffsetY;
|
}
|
}
|
g_pLog->DisplayMessage(_T("[%d Module][%d Gantry] Go [%.3lf, %.3lf]"), nModuleIndex, nGantryIndex, dDefectPosX, dDefectPosY);
|
|
// kmj added.
|
int nCmd = 1;
|
int nHeaderIndex = pModuleStatus->GetHeaderIndex();
|
nCmd += 1 << (nHeaderIndex + 1);
|
|
VectorDouble vecPos;
|
|
vecPos.push_back(dDefectPosX);
|
for(int i = 0; i < nHeaderIndex; i++) vecPos.push_back(0);
|
vecPos.push_back(dDefectPosY);
|
|
if (bGoEnd)
|
{
|
return m_pMotorControl->GantryManualGoEnd(nGantryIndex, vecPos, nCmd);
|
}
|
|
return m_pMotorControl->GantryManualGo(nGantryIndex, vecPos, nCmd);
|
}
|
|
//181227
|
BOOL CReviewInterface::Motor_CameraCenterGo(int nModuleIndex, double dPosX, double dPosY, int MoveAxis, BOOL bAutoSelectCamera, BOOL bGoEnd)
|
{
|
if(m_pDoc==NULL || m_pMotorControl==NULL || m_pSequenceProcessor==NULL) return FALSE;
|
|
const CModuleStatus *pModuleStatus = Module_GetModuleStatus(nModuleIndex);
|
if (pModuleStatus==NULL) return FALSE;
|
|
int nGantryIndex = pModuleStatus->GetGantryIndex();
|
|
const SDefectFilter *pDefectFilter = m_pDoc->Etc_GetDefectFilter();
|
if (pDefectFilter==NULL) return FALSE;
|
|
CString strMessage = _T("");
|
if (pDefectFilter->bUseWSI)
|
{
|
strMessage.Format(_T("[%d Module][%d Gantry] WSI Camera GlassPos (%.3lf, %.3lf)mm Move?"), nModuleIndex, nGantryIndex, dPosX, dPosY);
|
}
|
else
|
{
|
|
strMessage.Format(_T("[%d Module][%d Gantry] Review Camera GlassPos (%.3lf, %.3lf)mm Move?"), nModuleIndex, nGantryIndex, dPosX, dPosY);
|
}
|
|
if (IDNO == AfxMessageBox(strMessage, MB_YESNO | MB_ICONQUESTION))
|
{
|
return FALSE;
|
}
|
|
// [2017:3:8]-[WEZASW] : CameraOffset 범위 변경 (-1~1 => -5~5)
|
double m_dMinOffset = -5.0;
|
double m_dMaxOffset = 5.0;
|
|
// get direction
|
int nDirectionX, nDirectionY;
|
m_pCoordCalibrator->GetTransDirection(nDirectionX, nDirectionY);
|
|
//181217
|
CGlassResult *pGlassResult = m_pDoc->GlassResult_GetCurrentGlassResult();
|
|
// offset
|
const CSystemInfo *pSystemInfo = m_pDoc->System_GetSystemInfo();
|
if (pSystemInfo != NULL)
|
{
|
int nMachine = pSystemInfo->m_nMachineType;
|
double tempx ;
|
double tempy ;
|
|
//210402
|
/*if (pSystemInfo->m_nMachineType == 0 || pSystemInfo->m_nMachineType == 1 ||pSystemInfo->m_nMachineType == 2)
|
{*/
|
tempx = m_pReviewProcessor->GetCentertoOrginCoordinate(dPosX*1000,-1,pGlassResult->GetCornerCutDir(),pGlassResult->GetOriginDir());
|
tempy = m_pReviewProcessor->GetCentertoOrginCoordinate(-1,dPosY*1000,pGlassResult->GetCornerCutDir(),pGlassResult->GetOriginDir());
|
|
//
|
//}
|
//else if(pSystemInfo->m_nMachineType == 3 || pSystemInfo->m_nMachineType == 4 || pSystemInfo->m_nMachineType == 5)
|
//{
|
// //tempx = pGlassResult->GetGlassSizeX()/2 - ApplyMagAndGlassOffset(nModuleIndex ,1,dPosX*1000.0,dPosY*1000.0);
|
// tempy = m_pReviewProcessor->GetCentertoOrginCoordinate(dPosX*1000,-1,pGlassResult->GetCornerCutDir(),pGlassResult->GetOriginDir());
|
// tempx = m_pReviewProcessor->GetCentertoOrginCoordinate(-1,dPosY*1000,pGlassResult->GetCornerCutDir(),pGlassResult->GetOriginDir());
|
//}
|
|
double dDefectPosX = tempx/= 1000.0;
|
double dDefectPosY = tempy/= 1000.0;
|
|
// offset 적용
|
const SCoordInfo* pCoordInfo = pModuleStatus->GetCoordInfo();
|
if (pCoordInfo)
|
{
|
// [2016:11:16]-[WEZASW] : Manual Review의 Camera Offset 벙향 변경 ( '+' -> '-' )
|
if(pCoordInfo->dOffsetX != 0.0)
|
{
|
if(pCoordInfo->dOffsetX >= m_dMinOffset && pCoordInfo->dOffsetX <= m_dMaxOffset)
|
{
|
g_pLog->DisplayMessage(_T("Gantry[%d] OffsetX[%.03lf]"), nModuleIndex, pCoordInfo->dOffsetX);
|
dDefectPosX -= pCoordInfo->dOffsetX * nDirectionX * -1;
|
}
|
}
|
|
if(pCoordInfo->dOffsetY != 0.0)
|
{
|
if(pCoordInfo->dOffsetY >= m_dMinOffset && pCoordInfo->dOffsetY <= m_dMaxOffset)
|
{
|
g_pLog->DisplayMessage(_T("Gantry[%d] OffsetY[%.03lf]"), nModuleIndex, pCoordInfo->dOffsetY);
|
dDefectPosY -= pCoordInfo->dOffsetY * nDirectionY * -1;
|
}
|
}
|
|
m_pCoordCalibrator->TransGlass2Motor(pCoordInfo, dDefectPosX, dDefectPosY);
|
}
|
|
if (pDefectFilter->bUseWSI)
|
{
|
const SMotorPosition* pPos = Module_GetMotorPosition(nModuleIndex);
|
if (pPos && pPos->bUseWSI)
|
{
|
dDefectPosX -= pPos->dWSIOffsetX;
|
dDefectPosY -= pPos->dWSIOffsetY;
|
}
|
}
|
g_pLog->DisplayMessage(_T("[%d Module][%d Gantry] Go [%.3lf, %.3lf]"), nModuleIndex, nGantryIndex, dDefectPosX, dDefectPosY);
|
|
// kmj added.
|
int nCmd = 1;
|
int nHeaderIndex = pModuleStatus->GetHeaderIndex();
|
nCmd += 1 << (nHeaderIndex + 1);
|
|
VectorDouble vecPos;
|
|
vecPos.push_back(dDefectPosX);
|
for(int i = 0; i < nHeaderIndex; i++) vecPos.push_back(0);
|
vecPos.push_back(dDefectPosY);
|
|
if (bGoEnd)
|
{
|
return m_pMotorControl->GantryManualGoEnd(nGantryIndex, vecPos, nCmd);
|
}
|
|
return m_pMotorControl->GantryManualGo(nGantryIndex, vecPos, nCmd);
|
}
|
return FALSE;
|
}
|
|
BOOL CReviewInterface::Motor_CameraGo(int nModuleIndex, int nDefectPosX, int nDefectPosY, int nMoveAxis, CDefectResult* pDefectResult, BOOL bAutoSelectCamera, BOOL bGoEnd)
|
{
|
|
double dPosX = nDefectPosX;
|
double dPosY = nDefectPosY;
|
|
//디펙맵 이동시 오프셋 적용 //0111
|
CDlgControl *pDlgControl = CDlgControl::GetInstance();
|
if(pDlgControl->SelectOffSetOn->GetCheck() == 1)
|
{
|
CRsRcpReviewInfo* pRsRcpReviewInfo = m_pDoc->Recipe_GetRsRcpReviewInfo();
|
if (pRsRcpReviewInfo==NULL) return FALSE;
|
|
STransferData *pTransferData =ISP2P_GetCurrentTransferData();
|
if(pTransferData==NULL) return FALSE;
|
int nGlassIdx;
|
|
if(_ttoi(pTransferData->strGlassScanSchedule) == 1)
|
nGlassIdx = pRsRcpReviewInfo->m_nGlassTypeIdx + 1;
|
|
//const CGlassTypeInfo* pGlassTypeInfo = m_pDoc->System_GetGlassTypeInfo(nGlassIdx);
|
//if(pGlassTypeInfo==NULL) return 0;
|
double GlassOffsetX=0;
|
double GlassOffsetY=0;
|
//double GlassOffsetX =pGlassTypeInfo->GetMotorOffsetX(); // 분판별 오프셋
|
//double GlassOffsetY =pGlassTypeInfo->GetMotorOffsetY();
|
|
double MagOffsetX =Module_GetCurrentMagnificInfo(nModuleIndex)->dMagnificOffsetX;
|
double MagOffsetY =Module_GetCurrentMagnificInfo(nModuleIndex)->dMagnificOffsetY;
|
|
dPosX += MagOffsetX * 1000;//GlassOffsetX*1000+MagOffsetX*1000;
|
dPosY+= MagOffsetY * 1000;//GlassOffsetY*1000+MagOffsetY*1000;
|
double xpostemp = 0;
|
double ypostemp = 0;
|
|
|
GetOffSetValue(nModuleIndex, pDefectResult->nAOICameraIdx, pDefectResult->nAOIScanIdx, nDefectPosX/1000, xpostemp, ypostemp);
|
xpostemp = floor(xpostemp * 1000);
|
ypostemp = floor(ypostemp * 1000);
|
//210127
|
if (m_pDoc->System_GetMotorInfo()->GetOriginDirection() == 2)
|
{
|
if (nModuleIndex == 0)
|
{
|
dPosX += xpostemp;
|
dPosY += ypostemp;
|
}
|
else
|
{
|
dPosX += xpostemp * -1;
|
dPosY += ypostemp;
|
}
|
}
|
else
|
{
|
if (nModuleIndex == 0)
|
{
|
dPosX += xpostemp;
|
dPosY += ypostemp * -1;
|
}
|
else
|
{
|
dPosX += xpostemp * -1;
|
dPosY += ypostemp * -1;
|
}
|
}
|
|
g_pLog->DisplayMessage(_T("[OFFSetOn]MotorOffset: %.3lf, %.3lf MagOffset: %.3lf, %.3lf Glass Pos : %.3lf, %.3lf"), xpostemp, ypostemp, MagOffsetX,MagOffsetY,dPosX/1000.0,dPosY/1000.0);
|
//dPosX= ApplyMagAndGlassOffset(nModuleIndex,0,dPosX, dPosY);
|
//dPosY= ApplyMagAndGlassOffset(nModuleIndex,1,dPosX, dPosY);
|
}
|
|
return Motor_CameraGo(nModuleIndex, dPosX/1000.0, dPosY/1000.0, bAutoSelectCamera, bGoEnd);
|
}
|
int CReviewInterface::ApplyMagAndGlassOffset(int nModuleIndex ,int wicthPos,double posX,double posY)
|
{
|
double dPosX=posX;
|
double dPosY=posY;
|
|
CRsRcpReviewInfo* pRsRcpReviewInfo = m_pDoc->Recipe_GetRsRcpReviewInfo();
|
if (pRsRcpReviewInfo==NULL) return FALSE;
|
|
STransferData *pTransferData =ISP2P_GetCurrentTransferData();
|
if(pTransferData==NULL) return FALSE;
|
int nGlassIdx=0;
|
|
if(_ttoi(pTransferData->strGlassScanSchedule) == 1)
|
nGlassIdx = pRsRcpReviewInfo->m_nGlassTypeIdx + 1;
|
|
const CGlassTypeInfo* pGlassTypeInfo = m_pDoc->System_GetGlassTypeInfo(nGlassIdx);
|
if(pGlassTypeInfo==NULL) return 0;
|
|
double GlassOffsetX =pGlassTypeInfo->GetMotorOffsetX(); // 분판별 오프셋
|
double GlassOffsetY =pGlassTypeInfo->GetMotorOffsetY();
|
|
double MagOffsetX =Module_GetCurrentMagnificInfo(nModuleIndex)->dMagnificOffsetX;
|
double MagOffsetY =Module_GetCurrentMagnificInfo(nModuleIndex)->dMagnificOffsetY;
|
|
|
if(pGlassTypeInfo->m_nCornerCutDirection == 0)
|
{
|
dPosX-=GlassOffsetX*1000+MagOffsetX*1000;
|
dPosY-=GlassOffsetY*1000+MagOffsetY*1000;
|
}
|
else if(pGlassTypeInfo->m_nCornerCutDirection == 1)
|
{
|
dPosX-=GlassOffsetX*1000+MagOffsetX*1000;;
|
dPosY+=GlassOffsetY*1000+MagOffsetY*1000;
|
}
|
else if(pGlassTypeInfo->m_nCornerCutDirection == 2)
|
{
|
dPosX+=GlassOffsetX*1000+MagOffsetX*1000;
|
dPosY-=GlassOffsetY*1000+MagOffsetY*1000;
|
}
|
|
else if(pGlassTypeInfo->m_nCornerCutDirection == 3)
|
{
|
dPosX+=GlassOffsetX*1000+MagOffsetX*1000;
|
dPosY+=GlassOffsetY*1000+MagOffsetY*1000;
|
}
|
|
g_pLog->DisplayMessage(_T("[OFFSetOn]MotorOffset: %.3lf, %.3lf MagOffset: %.3lf, %.3lf Glass Pos : %.3lf, %.3lf"), GlassOffsetX, GlassOffsetY, MagOffsetX,MagOffsetY,dPosX/1000.0,dPosY/1000.0);
|
|
if(wicthPos==0)
|
{
|
return dPosX;
|
}
|
|
return dPosY;
|
}
|
|
|
BOOL CReviewInterface::Motor_CameraCenterGo(int nModuleIndex, int nDefectPosX, int nDefectPosY, int nMoveAxis, BOOL bAutoSelectCamera, BOOL bGoEnd)
|
{
|
double dPosX = nDefectPosX / 1000.0;
|
double dPosY = nDefectPosY / 1000.0;
|
|
return Motor_CameraCenterGo(nModuleIndex, dPosX, dPosY, bAutoSelectCamera, bGoEnd);
|
}
|
|
BOOL CReviewInterface::Motor_AxisGo(int nModuleIndex, int nAxisType, int nDefectPos, BOOL bAutoSelectCamera, BOOL bGoEnd)
|
{
|
double dPos = nDefectPos / 1000.0;
|
|
return Motor_AxisGo(nModuleIndex, nAxisType, dPos, bAutoSelectCamera, bGoEnd);
|
}
|
|
BOOL CReviewInterface::Motor_AxisGo(int nModuleIndex, int nAxisType, double dPos, BOOL bAutoSelectCamera, BOOL bGoEnd)
|
{
|
if(m_pMotorControl==NULL || m_pSequenceProcessor==NULL) return FALSE;
|
|
const CModuleStatus *pModuleStatus = Module_GetModuleStatus(nModuleIndex);
|
if (pModuleStatus==NULL) return FALSE;
|
|
const SAxisIndex* pAxisIndex = pModuleStatus->GetAxisIndex();
|
if (pAxisIndex==NULL) return FALSE;
|
|
int nAxisIndex = -1;
|
switch(nAxisType)
|
{
|
case 0: // x
|
nAxisIndex = pAxisIndex->nAxisIndexX;
|
break;
|
case 1: // y
|
nAxisIndex = pAxisIndex->nAxisIndexY;
|
break;
|
case 2: // sx
|
nAxisIndex = pAxisIndex->nAxisIndexSx;
|
break;
|
}
|
|
if (nAxisIndex==-1) return FALSE;
|
|
// CString strMessage = _T("");
|
// strMessage.Format(_T("Axis_%d (%.3lf)mm 위치로 이동?"), nAxisIndex, dPos);
|
// if (IDNO == AfxMessageBox(strMessage, MB_YESNO | MB_ICONQUESTION))
|
// {
|
// return FALSE;
|
// }
|
// g_pLog->DisplayMessage(_T("Motor_AxisGo Axis[%d][%d][%.3lf]"), nModuleIndex, nAxisIndex, dPos);
|
|
if (bGoEnd)
|
{
|
return m_pMotorControl->AxisManualGoEnd(nAxisIndex, dPos);
|
}
|
|
return m_pMotorControl->AxisManualGo(nAxisIndex, dPos);
|
|
}
|
|
BOOL CReviewInterface::Motor_AxisGoSpeed(int nAxisIndex, double dSpeed, int nAccel)
|
{
|
if(m_pMotorControl==NULL) return FALSE;
|
|
if (m_pMotorControl->AxisManualGoSpeed(nAxisIndex, dSpeed)==FALSE)
|
{
|
return FALSE;
|
}
|
|
if (nAccel==0) return TRUE;
|
|
if (m_pMotorControl->AxisManualGoAccel(nAxisIndex, nAccel)==FALSE)
|
{
|
return FALSE;
|
}
|
|
return TRUE;
|
}
|
|
BOOL CReviewInterface::Motor_AxisJogSpeed(int nAxisIndex, double dSpeed, int nAccel)
|
{
|
if(m_pMotorControl==NULL) return FALSE;
|
|
if (m_pMotorControl->AxisJogSpeed(nAxisIndex, dSpeed)==FALSE)
|
{
|
return FALSE;
|
}
|
|
if (nAccel==0) return TRUE;
|
|
if (m_pMotorControl->AxisManualGoAccel(nAxisIndex, nAccel)==FALSE)
|
{
|
return FALSE;
|
}
|
|
return TRUE;
|
}
|
|
BOOL CReviewInterface::Motor_AxisJogCommand(int nAxisIndex, int nCommand)
|
{
|
if(m_pMotorControl==NULL) return FALSE;
|
|
BOOL bResult = FALSE;
|
switch (nCommand)
|
{
|
case JogDirection_Stop:
|
bResult = m_pMotorControl->AxisJogStop(nAxisIndex);
|
break;
|
case JogDirection_Plus:
|
bResult = m_pMotorControl->AxisJogPlus(nAxisIndex);
|
break;
|
case JogDirection_Minus:
|
bResult = m_pMotorControl->AxisJogMinus(nAxisIndex);
|
break;
|
default:
|
break;
|
}
|
|
return bResult;
|
}
|
|
BOOL CReviewInterface::Motor_AxisThetaGoSpeed(double dSpeed, int nAccel)
|
{
|
if(m_pMotorControl==NULL) return FALSE;
|
|
if (m_pMotorControl->AxisThetaManualGoSpeed(dSpeed)==FALSE)
|
{
|
return FALSE;
|
}
|
|
if (nAccel==0) return TRUE;
|
|
if (m_pMotorControl->AxisThetaManualGoAccel(nAccel)==FALSE)
|
{
|
return FALSE;
|
}
|
|
return TRUE;
|
}
|
|
BOOL CReviewInterface::Motor_AxisThetaJogSpeed(double dSpeed, int nAccel)
|
{
|
if(m_pMotorControl==NULL) return FALSE;
|
|
if (m_pMotorControl->AxisThetaJogSpeed(dSpeed)==FALSE)
|
{
|
return FALSE;
|
}
|
|
if (nAccel==0) return TRUE;
|
|
if (m_pMotorControl->AxisThetaManualGoAccel(nAccel)==FALSE)
|
{
|
return FALSE;
|
}
|
|
return TRUE;
|
}
|
|
BOOL CReviewInterface::Motor_AxisThetaGo(double dPos, BOOL bGoEnd)
|
{
|
if(m_pMotorControl==NULL) return FALSE;
|
|
if (bGoEnd)
|
{
|
return m_pMotorControl->AxisThetaManualGoEnd(dPos);
|
}
|
|
return m_pMotorControl->AxisThetaManualGo(dPos);
|
}
|
|
BOOL CReviewInterface::Motor_AxisThetaJogCommand(int nCommand)
|
{
|
if(m_pMotorControl==NULL) return FALSE;
|
|
BOOL bResult = FALSE;
|
switch (nCommand)
|
{
|
case JogDirection_Stop:
|
bResult = m_pMotorControl->AxisThetaJogStop();
|
break;
|
case JogDirection_Plus:
|
bResult = m_pMotorControl->AxisThetaJogPlus();
|
break;
|
case JogDirection_Minus:
|
bResult = m_pMotorControl->AxisThetaJogMinus();
|
break;
|
default:
|
break;
|
}
|
|
return bResult;
|
}
|
|
double CReviewInterface::GetFreeSpaceOfDrive() const
|
{
|
CString strVolDrive;
|
ULARGE_INTEGER avail, total, free;
|
|
strVolDrive = _T("D:");
|
|
GetDiskFreeSpaceEx(strVolDrive, &avail, &total, &free);
|
|
//GBytes total.QuadPart>>30, MBytes total.QuadPart>>20 KBytes : total.QuadPart>>10
|
//total_disk_size
|
double disk_size = (int)(total.QuadPart>>30);
|
|
//disk_free_size;
|
double disk_free_size = (int)(free.QuadPart>>30);
|
|
return disk_free_size;
|
}
|
|
void CReviewInterface::ApplySystemSettingValue()
|
{
|
if (m_pDoc==NULL) return;
|
|
// delay time
|
const CMotorControlInfo* pMotorInfo = m_pDoc->System_GetMotorInfo();
|
if (pMotorInfo)
|
{
|
g_pLog->DisplayMessage(_T("[ApplySetting] AFM: %d ms, SNAP: %d ms, WSI: %d ms"), pMotorInfo->GetAfDelayTime(), pMotorInfo->GetImageDelayTime(), pMotorInfo->GetWsiDelayTime());
|
}
|
|
// upload image quailty
|
const CNetworkInfo *pNetworkInfo = m_pDoc->System_GetNetworkInfo();
|
if(pNetworkInfo && m_pReviewProcessor)
|
{
|
m_pReviewProcessor->SetReviewImageInfo(
|
pNetworkInfo->m_nUpdateImageWidth,
|
pNetworkInfo->m_nUpdateImageHeight,
|
pNetworkInfo->m_nUpdateImageSize,
|
pNetworkInfo->m_nUpdateImageQuality,
|
pNetworkInfo->m_nUpdateImageStep,
|
pNetworkInfo->m_dUpdateImageScale,
|
pNetworkInfo->m_bUpdateImageOriginal,
|
pNetworkInfo->m_nImageRotate,
|
pNetworkInfo->m_nImageFlip);
|
|
g_pLog->DisplayMessage(_T("[ApplySetting] Upload Image Info: %d, %d, %d, %d, %d, %.3lf, %d, %d"),
|
pNetworkInfo->m_nUpdateImageWidth,
|
pNetworkInfo->m_nUpdateImageHeight,
|
pNetworkInfo->m_nUpdateImageSize,
|
pNetworkInfo->m_nUpdateImageQuality,
|
pNetworkInfo->m_nUpdateImageStep,
|
pNetworkInfo->m_dUpdateImageScale,
|
pNetworkInfo->m_nImageRotate,
|
pNetworkInfo->m_nImageFlip);
|
}
|
|
// offset
|
const CSystemInfo *pSystemInfo = m_pDoc->System_GetSystemInfo();
|
if (pSystemInfo)
|
{
|
// offset
|
int nModuleIndex = 0;
|
int nGantryCount = pSystemInfo->GetGantryInfoCount();
|
|
for(int nGantryIdx = 0; nGantryIdx < nGantryCount; nGantryIdx++)
|
{
|
const CGantryInfo *pGantryInfo = pSystemInfo->GetGantryInfo(nGantryIdx);
|
if (pGantryInfo==NULL) continue;
|
|
int nHeaderCount = pGantryInfo->GetHeaderInfoCount();
|
for(int nHeaderIdx = 0; nHeaderIdx < nHeaderCount; nHeaderIdx++)
|
{
|
const CHeaderInfo *pHeaderInfo = pGantryInfo->GetHeaderInfo(nHeaderIdx);
|
if (pHeaderInfo==NULL) continue;
|
|
// module status
|
CModuleStatus *pModuleStatus = Module_GetModuleStatus(nModuleIndex);
|
if (pModuleStatus==NULL) continue;
|
|
// camera info
|
const CCameraControlInfo_Plus* pCameraInfo = pHeaderInfo->GetCameraInfo(0);
|
if (pCameraInfo==NULL) continue;
|
|
// set camera offset
|
SCoordInfo *pCoordInfo = pModuleStatus->GetCoordInfo();
|
if(pCoordInfo)
|
{
|
pCoordInfo->dOffsetX = pCameraInfo->GetCameraOffsetX();
|
pCoordInfo->dOffsetY = pCameraInfo->GetCameraOffsetY();
|
if (pCoordInfo->dOffsetX!=0.0 && pCoordInfo->dOffsetY!=0.0)
|
{
|
g_pLog->DisplayMessage(_T("[ApplySetting] CameraOffset[%d] Dx:%.3lf mm, Dy:%.3lf mm"), nModuleIndex, pCoordInfo->dOffsetX, pCoordInfo->dOffsetY);
|
}
|
}
|
|
// WSI info
|
const CWsiControlInfo* pWSIInfo = pHeaderInfo->GetWsiInfo(0);
|
|
// motor pos
|
SMotorPosition *pPosition = pModuleStatus->GetMotorPosition();
|
if (pPosition && pWSIInfo)
|
{
|
pPosition->dWSIOffsetX = pWSIInfo->GetOffsetX();
|
pPosition->dWSIOffsetY = pWSIInfo->GetOffsetY();
|
if (pPosition->dWSIOffsetX!=0.0 && pPosition->dWSIOffsetY!=0.0)
|
{
|
g_pLog->DisplayMessage(_T("[ApplySetting] WsiOffset[%d] Dx:%.3lf mm, Dy:%.3lf mm"), nModuleIndex, pPosition->dWSIOffsetX, pPosition->dWSIOffsetY);
|
}
|
}
|
|
// mag info
|
for (int nMagIdx=0; nMagIdx<pModuleStatus->GetMagnificInfoCount(); nMagIdx++)
|
{
|
SMagnificInfo *pModuleMag = pModuleStatus->GetMagnificInfo(nMagIdx);
|
const CMagnificInfo *pHeaderMag = pHeaderInfo->GetMagnificInfo(nMagIdx);
|
if (pModuleMag && pHeaderMag)
|
{
|
pModuleMag->dMagnificOffsetX = pHeaderMag->m_dMagnificOffsetX;
|
pModuleMag->dMagnificOffsetY = pHeaderMag->m_dMagnificOffsetX;
|
//pModuleMag->dTestOffsetX = pHeaderMag->m_dTestOffsetX; //각 배율별 오프셋
|
//pModuleMag->dTestOffsetY = pHeaderMag->m_dTestOffsetY;
|
if (pModuleMag->dMagnificOffsetX!=0.0 && pModuleMag->dMagnificOffsetY!=0.0)
|
{
|
g_pLog->DisplayMessage(_T("[ApplySetting] MagOffset[%d,%d] Dx:%.3lf mm, Dy:%.3lf mm"), nModuleIndex, nMagIdx, pModuleMag->dMagnificOffsetX, pModuleMag->dMagnificOffsetY);
|
}
|
}
|
}
|
|
nModuleIndex++;
|
}
|
}
|
}
|
}
|
|
BOOL CReviewInterface::AlignCamera_CameraControl(int nControlCmd)
|
{
|
if (m_pAlignCameraControl==NULL)
|
{
|
return FALSE;
|
}
|
return (BOOL) m_pAlignCameraControl->Camera_Control(nControlCmd);
|
}
|
|
BOOL CReviewInterface::ReviewCamera_CameraControl(int nModuleIndex, int nControlCmd)
|
{
|
SCameraControl *pCameraControl = Module_GetCameraControl(nModuleIndex);
|
CCameraControlReview *pCameraControlReview = ISP2P_GetReviewCameraControl(nModuleIndex);
|
if (pCameraControl==NULL || pCameraControlReview==NULL)
|
{
|
return FALSE;
|
}
|
|
if (pCameraControl->nCameraControl == nControlCmd)
|
{
|
return TRUE;
|
}
|
Sleep(200);
|
if(pCameraControlReview->Camera_Control(nControlCmd))
|
{
|
pCameraControl->nCameraControl = nControlCmd;
|
UpdateCameraControl(nModuleIndex, pCameraControl, NULL);
|
return TRUE;
|
}
|
|
return FALSE;
|
}
|
|
void CReviewInterface::ReviewCamera_CameraControl(int nControlCmd)
|
{
|
for (VectorModuleStatusIt it=m_vecModuleStatus.begin(); it!=m_vecModuleStatus.end(); it++)
|
{
|
ReviewCamera_CameraControl(it->GetModuleIndex(), nControlCmd);
|
}
|
}
|
|
int CReviewInterface::ReviewCamera_GetReviewCameraControlCount() const
|
{
|
return (int) m_vecReviewCameraControl.size();
|
}
|
|
// common
|
void CReviewInterface::ISP2P_DisplayMessage(const TCHAR* lpstrFormat, ...)
|
{
|
va_list list;
|
TCHAR strText[2000] = {0};
|
|
va_start(list, lpstrFormat);
|
_vstprintf_s(strText, lpstrFormat, list);
|
va_end(list);
|
|
g_pLog->DisplayMessage(strText);
|
}
|
|
void CReviewInterface::ISP2P_MeasureGraph(CGlassResult* pGlassResult)
|
{
|
m_pView->UpdateMeasureGraph(pGlassResult);
|
}
|
|
// system info
|
const CSystemInfo* CReviewInterface::ISP2P_System_GetSystemInfo()
|
{
|
if (m_pDoc==NULL) return NULL;
|
|
return m_pDoc->System_GetSystemInfo();
|
}
|
|
const BOOL CReviewInterface::ISP2P_System_ReadConfigFile()
|
{
|
if (m_bChangeSysConfig==FALSE) return TRUE;
|
|
if (m_pDoc->System_ReadSettingValue()==FALSE) return FALSE;
|
|
ApplySystemSettingValue();
|
|
m_bChangeSysConfig = FALSE;
|
|
return TRUE;
|
}
|
|
const CGlassTypeInfo* CReviewInterface::ISP2P_System_GetGlassTypeInfo(int nIndex)
|
{
|
if (m_pDoc==NULL) return NULL;
|
return m_pDoc->System_GetGlassTypeInfo(nIndex);
|
}
|
|
const CGlassTypeInfo* CReviewInterface::ISP2P_System_GetStandardGlassTypeInfo()
|
{
|
if (m_pDoc==NULL) return NULL;
|
return m_pDoc->System_GetStandardGlassTypeInfo();
|
}
|
|
const CAlignCameraInfo* CReviewInterface::ISP2P_System_GetAlignCameraInfo(int nIndex)
|
{
|
if (m_pDoc==NULL) return NULL;
|
return m_pDoc->System_GetAlignCameraInfo(nIndex);
|
}
|
|
const CSignalControlInfo* CReviewInterface::ISP2P_System_GetPCControlInfo()
|
{
|
if (m_pDoc==NULL) return NULL;
|
return m_pDoc->System_GetSignalInfo();
|
}
|
|
const CMotorControlInfo* CReviewInterface::ISP2P_System_GetMotorInfo()
|
{
|
if (m_pDoc==NULL) return NULL;
|
return m_pDoc->System_GetMotorInfo();
|
}
|
|
const CNetworkInfo* CReviewInterface::ISP2P_System_GetNetworkInfo()
|
{
|
if (m_pDoc==NULL) return NULL;
|
return m_pDoc->System_GetNetworkInfo();
|
}
|
|
// recipe info
|
CRsRecipeManager* CReviewInterface::ISP2P_Recipe_GetRsRecipeManager()
|
{
|
if (m_pDoc==NULL) return NULL;
|
return m_pDoc->Recipe_GetRsRecipeManager();
|
}
|
|
CRsRcpReviewInfo* CReviewInterface::ISP2P_Recipe_GetRsRcpReviewInfo()
|
{
|
if (m_pDoc==NULL) return NULL;
|
return m_pDoc->Recipe_GetRsRcpReviewInfo();
|
}
|
|
CRsRcpMeasureInfo* CReviewInterface::ISP2P_Recipe_GetRsRcpMeasureInfo()
|
{
|
if (m_pDoc==NULL) return NULL;
|
return m_pDoc->Recipe_GetRsRcpMeasureInfo();
|
}
|
|
CRsRcpAlignInfo* CReviewInterface::ISP2P_Recipe_GetRsRcpAlignInfo()
|
{
|
if (m_pDoc==NULL) return NULL;
|
return m_pDoc->Recipe_GetRsRcpAlignInfo();
|
}
|
|
CRsRcpDefectFindInfo* CReviewInterface::ISP2P_Recipe_GetRsRcpDefectFindInfo()
|
{
|
if (m_pDoc==NULL) return NULL;
|
return m_pDoc->Recipe_GetRsRcpDefectFindInfo();
|
}
|
|
// single control
|
CSignalControl* CReviewInterface::ISP2P_GetSignalControl()
|
{
|
return m_pSignalControl;
|
}
|
|
CMotorControl* CReviewInterface::ISP2P_GetMotorControl()
|
{
|
return m_pMotorControl;
|
}
|
|
CAlignServerControl* CReviewInterface::ISP2P_GetAlignServerControl()
|
{
|
return m_pAlignServerControl;
|
}
|
|
CCameraControlAlign* CReviewInterface::ISP2P_GetAlignCameraControl()
|
{
|
return m_pAlignCameraControl;
|
}
|
|
CPrioritySorter* CReviewInterface::ISP2P_GetPrioritySorter()
|
{
|
return m_pPrioritySorter;
|
}
|
|
CDefectPicker* CReviewInterface::ISP2P_GetDefectPicker(int nIdx/*=-1*/)
|
{
|
if (nIdx != -1)
|
{
|
if (m_pDefectPicker)
|
{
|
delete m_pDefectPicker;
|
m_pDefectPicker = NULL;
|
}
|
|
switch (nIdx)
|
{
|
case PICKER_IDX_RANGE:
|
{
|
m_pDefectPicker = new CDefectPicker_Range();
|
}
|
break;
|
|
default:
|
{
|
m_pDefectPicker = new CDefectPicker();
|
}
|
break;
|
}
|
}
|
|
return m_pDefectPicker;
|
}
|
|
CPathScheduler* CReviewInterface::ISP2P_GetReviewScheduler(int nIdx/*=-1*/)
|
{
|
const CSystemInfo* pSystemInfo = m_pDoc->System_GetSystemInfo();
|
if (pSystemInfo == NULL)
|
return NULL;
|
|
CRsRcpReviewInfo* pRsRcpReviewInfo = m_pDoc->Recipe_GetRsRcpReviewInfo();
|
if (pRsRcpReviewInfo == NULL)
|
return FALSE;
|
|
if (nIdx != -1)
|
{
|
if (m_pReviewScheduler)
|
{
|
delete m_pReviewScheduler;
|
m_pReviewScheduler = NULL;
|
}
|
|
switch (nIdx)
|
{
|
case PICKER_IDX_RANGE:
|
{
|
m_pReviewScheduler = new CPathScheduler_Dual_Active_TSP();
|
}
|
break;
|
|
case SchedulerType_Dual_Active_TSP:
|
{
|
m_pReviewScheduler = new CPathScheduler_Dual_Active_TSP();
|
}
|
break;
|
default:
|
{
|
m_pReviewScheduler = new CPathScheduler_TSP();
|
}
|
break;
|
}
|
|
if (m_pReviewScheduler==NULL)
|
{
|
return NULL;
|
}
|
|
m_pReviewScheduler->SetPointInfo(10, 200);
|
|
CString strPath = _REVIEW_SERVER_BASE_PATH_;
|
strPath += _T("\\MotionInfo.ini");
|
|
if (m_pReviewScheduler->LoadPathSchedulerParam(strPath)==FALSE)
|
{
|
delete m_pReviewScheduler;
|
m_pReviewScheduler = NULL;
|
return NULL;
|
}
|
|
//-------------------------------------------------------------------------------------------------
|
// set scheduler param
|
CPathSchedulerParm* pPathSchedulerParm = m_pReviewScheduler->GetPathSchedulerParam();
|
if (pPathSchedulerParm)
|
{
|
pPathSchedulerParm->SetCollisionDistX(int(pSystemInfo->m_dCollisionDistance * 1000));
|
pPathSchedulerParm->SetCollisionDistY(50);
|
pPathSchedulerParm->SetModuleCount(pSystemInfo->GetGantryInfoCount());
|
|
// glass info
|
const CGlassTypeInfo* pGlassTypeInfo = ISP2P_System_GetGlassTypeInfo(pRsRcpReviewInfo->m_nGlassTypeIdx); // set default glass type info
|
|
if (pGlassTypeInfo)
|
{
|
pPathSchedulerParm->SetCenterCoord(pGlassTypeInfo->m_bUseCenterCoodinateSystem);
|
pPathSchedulerParm->SetOriginDir(pGlassTypeInfo->m_nOriginDirection);
|
pPathSchedulerParm->SetGlassSizeX(pGlassTypeInfo->m_nGlassSizeX * 1000);
|
pPathSchedulerParm->SetGlassSizeY(pGlassTypeInfo->m_nGlassSizeY * 1000);
|
}
|
}
|
//-------------------------------------------------------------------------------------------------
|
}
|
|
return m_pReviewScheduler;
|
}
|
/*
|
CMeasureScheduler* CReviewInterface::ISP2P_GetMeasureScheduler()
|
{
|
return m_pMeasureScheduler;
|
}
|
*/
|
CCoordCalibrator* CReviewInterface::ISP2P_GetCoordCalibrator()
|
{
|
return m_pCoordCalibrator;
|
}
|
|
CReviewProcessor* CReviewInterface::ISP2P_GetReviewProcessor()
|
{
|
return m_pReviewProcessor;
|
}
|
|
_ProtocolReview* CReviewInterface::ISP2P_GetAoiMemoryProtocol()
|
{
|
return m_AOISharedMemory.getReviewProtocol();
|
}
|
|
// multi control
|
int CReviewInterface::ISP2P_GetReviewLightControlCount()
|
{
|
return (int)m_vecReviewLightControl.size();
|
}
|
|
int CReviewInterface::ISP2P_GetAlignLightControlCount()
|
{
|
return (int)m_vecAlignLightControl.size();
|
}
|
|
int CReviewInterface::ISP2P_GetRevolverControlCount()
|
{
|
return (int)m_vecRevolverControl.size();
|
}
|
|
int CReviewInterface::ISP2P_GetAFMControlCount()
|
{
|
return (int)m_vecAFMControl.size();
|
}
|
|
int CReviewInterface::ISP2P_GetWSIControlCount()
|
{
|
return (int)m_vecWSIControl.size();
|
}
|
|
int CReviewInterface::ISP2P_GetReviewCameraControlCount()
|
{
|
return (int)m_vecReviewCameraControl.size();
|
}
|
|
int CReviewInterface::ISP2P_GetMotorCalibratorCount()
|
{
|
return (int)m_vecMotorCalibrator.size();
|
}
|
void CReviewInterface::ISP2P_GlassPositionUpdate()
|
{
|
CString strMessage;
|
SAxisIndex* pAxisIndex = NULL;
|
SMotorPosition* pMotorPosition = NULL;
|
|
for (VectorModuleStatusIt it=m_vecModuleStatus.begin(); it!=m_vecModuleStatus.end(); it++)
|
{
|
//SAxisIndex *pAxisIndex = it->GetAxisIndex();
|
SMotorPosition* pMotorPosition = it->GetMotorPosition();
|
|
CMotorCalibrator *pCalibrator = ISP2P_GetMotorCalibrator(it->GetModuleIndex());
|
|
// 좌표변환
|
SCoordInfo* pCoordInfo = it->GetCoordInfo();
|
|
if (pCalibrator!=NULL)
|
{
|
//pCalibrator->FCalibratePosition(pMotorPosition->dMotorPosX, pMotorPosition->dMotorPosY);
|
}
|
|
m_pCoordCalibrator->TransMotor2Glass(pCoordInfo, pMotorPosition);
|
|
UpdateMotorPosition(it->GetModuleIndex(), it->GetSelected(), pMotorPosition);
|
}
|
}
|
|
CLightControl* CReviewInterface::ISP2P_GetReviewLightControl(int nIndex)
|
{
|
if (nIndex<0 || nIndex>=(int)m_vecReviewLightControl.size()) return NULL;
|
return (m_vecReviewLightControl[nIndex]);
|
}
|
|
CLightControl* CReviewInterface::ISP2P_GetAlignLightControl(int nIndex)
|
{
|
if (nIndex<0 || nIndex>=(int)m_vecAlignLightControl.size()) return NULL;
|
return (m_vecAlignLightControl[nIndex]);
|
}
|
|
CLensChangeControl* CReviewInterface::ISP2P_GetRevolverControl(int nIndex)
|
{
|
if (nIndex<0 || nIndex>=(int)m_vecRevolverControl.size()) return NULL;
|
return (m_vecRevolverControl[nIndex]);
|
}
|
|
CAfmControl* CReviewInterface::ISP2P_GetAFMControl(int nIndex)
|
{
|
if (nIndex<0 || nIndex>=(int)m_vecAFMControl.size()) return NULL;
|
return (m_vecAFMControl[nIndex]);
|
}
|
|
CWsiControl* CReviewInterface::ISP2P_GetWSIControl(int nIndex)
|
{
|
if (nIndex<0 || nIndex>=(int)m_vecWSIControl.size()) return NULL;
|
return (m_vecWSIControl[nIndex]);
|
}
|
|
// vcr
|
CVcrControl* CReviewInterface::ISP2P_GetVcrControl(int nIndex)
|
{
|
if (nIndex<0 || nIndex>=(int)m_vecVCRControl.size()) return NULL;
|
return (m_vecVCRControl[nIndex]);
|
}
|
|
CCameraControlReview* CReviewInterface::ISP2P_GetReviewCameraControl(int nIndex)
|
{
|
if (nIndex<0 || nIndex>=(int)m_vecReviewCameraControl.size()) return NULL;
|
return (m_vecReviewCameraControl[nIndex]);
|
}
|
|
CMotorCalibrator* CReviewInterface::ISP2P_GetMotorCalibrator(int nIndex)
|
{
|
if (nIndex<0 || nIndex>=(int)m_vecMotorCalibrator.size()) return NULL;
|
return &(m_vecMotorCalibrator[nIndex]);
|
}
|
|
// single variable
|
CGlassResult* CReviewInterface::ISP2P_GetNewGlassResult(int& nGlassResultCount)
|
{
|
if (m_pDoc==NULL) return NULL;
|
return m_pDoc->GlassResult_GetNewGlassResult(nGlassResultCount);
|
}
|
|
CGlassResult* CReviewInterface::ISP2P_GetGlassResult(int nIndex)
|
{
|
if (m_pDoc==NULL) return NULL;
|
return m_pDoc->GlassResult_GetGlassResult(nIndex);
|
}
|
|
CGlassResult * CReviewInterface::ISP2P_GetNewHistoryResult(int & nHistoryResultCount)
|
{
|
if (m_pDoc == NULL) return NULL;
|
return m_pDoc->HistoryResult_GetNewHistoryResult(nHistoryResultCount);
|
}
|
|
CGlassResult* CReviewInterface::ISP2P_GetHistoryResult(int nIndex)
|
{
|
if (m_pDoc == NULL) return NULL;
|
return m_pDoc->HistoryResult_GetHistoryResult(nIndex); //taek 210201
|
}
|
|
CGlassResult* CReviewInterface::ISP2P_GetCurrentGlassResult()
|
{
|
if (m_pDoc==NULL) return NULL;
|
return m_pDoc->GlassResult_GetCurrentGlassResult();
|
}
|
|
STransferData* CReviewInterface::ISP2P_GetCurrentTransferData()
|
{
|
if (m_pDoc==NULL) return NULL;
|
return m_pDoc->Etc_GetTransferData();
|
}
|
|
SDefectFilter* CReviewInterface::ISP2P_GetDefectFilter()
|
{
|
if (m_pDoc==NULL) return NULL;
|
return m_pDoc->Etc_GetDefectFilter();
|
}
|
|
SSignalIOStatus* CReviewInterface::ISP2P_GetPCControlIOSignal()
|
{
|
if (m_pDoc==NULL) return NULL;
|
return m_pDoc->Etc_GetPCControlIOSignal();
|
}
|
|
CSharedImageData* CReviewInterface::ISP2P_GetSharedImageData()
|
{
|
return m_pSharedImageData;
|
}
|
|
CConnectionStatus* CReviewInterface::ISP2P_GetConnectionStatus()
|
{
|
if (m_pDoc==NULL) return NULL;
|
return m_pDoc->Etc_GetConnectionStatus();
|
}
|
|
SThetaMotorInfo* CReviewInterface::ISP2P_GetThetaMotorInfo()
|
{
|
return &m_sThetaMotorInfo;
|
}
|
|
// multi variable
|
int CReviewInterface::ISP2P_GetModuleStatusCount(int nModuleType)
|
{
|
return Module_GetModuleStatusCount(nModuleType);
|
}
|
|
CModuleStatus* CReviewInterface::ISP2P_GetModuleStatus(int nIndex)
|
{
|
return Module_GetModuleStatus(nIndex);
|
}
|
|
CModuleStatus* CReviewInterface::ISP2P_GetSelectedModuleStatus()
|
{
|
return Module_GetSelectedModuleStatus();
|
}
|
|
// AOI Raw file
|
BOOL CReviewInterface::ISP2P_ReadAOIRawFileToGlassResult(const CString& strRawPath)
|
{
|
if (m_pDoc==NULL) return FALSE;
|
return m_pDoc->ReadGlassResultFile(strRawPath);
|
}
|
|
BOOL CReviewInterface::ISP2P_WriteGlassResultToAOIRawFile(CGlassResult* pGlassResult, const CString& strResultFilePath, int nStackType)
|
{
|
if (m_pDoc==NULL) return FALSE;
|
return m_pDoc->WriteGlassResultFile(pGlassResult, strResultFilePath, nStackType);
|
}
|
|
BOOL CReviewInterface::ISP2P_SetReviewResultData(CGlassResult *pGlassResult)
|
{
|
if (m_pDoc==NULL) return FALSE;
|
return m_pDoc->SetReviewResultData(pGlassResult);
|
}
|
|
BOOL CReviewInterface::ISP2P_SetUserResultData(CGlassResult *pGlassResult)
|
{
|
if (m_pDoc==NULL) return FALSE;
|
return m_pDoc->SetUserResultData(pGlassResult);
|
}
|
|
BOOL CReviewInterface::ISP2P_SetMeasureResultData(CGlassResult *pGlassResult) //Add by Juneki 2016-03-01
|
{
|
if (m_pDoc==NULL) return FALSE;
|
return m_pDoc->SetMeasureResultData(pGlassResult);
|
}
|
|
BOOL CReviewInterface::ISP2P_SetReflowResultData( CGlassResult *pGlassResult )
|
{
|
if (m_pDoc==NULL) return FALSE;
|
return m_pDoc->SetReflowResultData(pGlassResult);
|
}
|
|
BOOL CReviewInterface::ISP2P_SetWsiReflowResultData( CGlassResult *pGlassResult )
|
{
|
if (m_pDoc==NULL) return FALSE;
|
return m_pDoc->SetWsiReflowResultData(pGlassResult);
|
}
|
|
BOOL CReviewInterface::ISP2P_CreateRawDataFormat(int* pnCnt)//Add by Juneki 2016-03-01
|
{
|
if(m_pDoc==NULL) return FALSE;
|
return m_pDoc->CreateRawDataFormat(pnCnt);
|
}
|
|
BOOL CReviewInterface::ISP2P_WriteGlassResultToMeasureRawFile(const CString& strResultFilePath)
|
{
|
if (m_pDoc==NULL) return FALSE;
|
return m_pDoc->WriteGlassMeasureResultFile(strResultFilePath);
|
}
|
|
void CReviewInterface::ISP2P_UpdateAlignResult(int nResultCode, const SAlignResult* pAlignResult)
|
{
|
if (m_pView)
|
{
|
m_pView->SetAlignResult(nResultCode, pAlignResult->dOriginX, pAlignResult->dOriginY, pAlignResult->dDegree);
|
}
|
}
|
|
BOOL CReviewInterface::ISP2P_SaveDefectMap( const CString strPath )
|
{
|
if(m_pView)
|
{
|
m_pView->SaveDefectMap(strPath);
|
}
|
|
return TRUE;
|
}
|
|
CRecipeManager* CReviewInterface::ISP2P_GetEdgeRecipeManager()
|
{
|
return m_pEdgeRecipeManager;
|
}
|
|
// Observer interface
|
void CReviewInterface::ISP2P_UpdateDefectFilter(const SDefectFilter* pDefectFilter)
|
{
|
UpdateDefectFilter(pDefectFilter);
|
}
|
|
void CReviewInterface::ISP2P_UpdateReviewResult(int nModuleIndex, const CGlassResult* pGlassResult)
|
{
|
UpdateReviewResult(nModuleIndex, pGlassResult);
|
}
|
|
void CReviewInterface::ISP2P_UpdateReviewProcessStatus(int nReviewStatus, int nPlanIndex)
|
{
|
UpdateReviewProcessStatus(nReviewStatus, nPlanIndex);
|
}
|
|
void CReviewInterface::ISP2P_UpdateProcessStatus(int nProcessStatus, const CGlassResult* pGlassResult)
|
{
|
const CSystemInfo* pSystemInfo = m_pDoc->System_GetSystemInfo();
|
if(pSystemInfo==NULL) return;
|
|
UpdateProcessStatus(pSystemInfo->m_nLineType, pSystemInfo->m_nMachineType, nProcessStatus, pGlassResult);
|
}
|
|
void CReviewInterface::ISP2P_UpdateCameraControl(int nModuleIndex, const SCameraControl *pCameraControl, const SCameraInfo* pCameraInfo)
|
{
|
UpdateCameraControl(nModuleIndex, pCameraControl, pCameraInfo);
|
}
|
|
void CReviewInterface::ISP2P_UpdateMotorPosition(int nModuleIndex, BOOL bSelected, const SMotorPosition *pMotorPosition)
|
{
|
UpdateMotorPosition(nModuleIndex, bSelected, pMotorPosition);
|
}
|
|
void CReviewInterface::ISP2P_UpdateMotorStatus(int nModuleIndex, const SMotorStatus *pMotorStatus)
|
{
|
UpdateMotorStatus(nModuleIndex, pMotorStatus);
|
}
|
|
void CReviewInterface::ISP2P_UpdatePCControlIOSignal(const SSignalIOStatus *pSignalIOStatus)
|
{
|
UpdateSignalIOStatus(pSignalIOStatus);
|
}
|
|
void CReviewInterface::ISP2P_UpdateConnectionStatus(const CConnectionStatus* pConnectionStatus)
|
{
|
UpdateConnectionStatus(pConnectionStatus);
|
}
|
|
void CReviewInterface::ISP2P_UpdateAlignResultStatus(int nModuleIndex, const CGlassResult* pGlassResult)
|
{
|
m_pView->UpdateAlignResult(pGlassResult);
|
}
|
|
void CReviewInterface::ISP2P_GetDiagnosisHistory()
|
{
|
m_pView->HideHistoryTool();
|
}
|
|
void CReviewInterface::ISP2P_GetDiagnosisHistory2()
|
{
|
m_pView->ShowBHistoryTool();
|
}
|
|
CDiagnosisManager* CReviewInterface::ISP2P_GetDiagnosisManager()
|
{
|
return m_pDiagnosisManager;
|
}
|
|
CDlgSelfDiagnosis* CReviewInterface::ISP2P_GetDlgDiagnosis()
|
{
|
return m_pDlgDiagnosis;
|
}
|
|
CDlgReviewHistoryTool* CReviewInterface::ISP2P_GetDlgHistory()
|
{
|
return m_pDlgHistoryTool;
|
}
|
|
BOOL CReviewInterface::ISP2P_GetFirstReviewLeft()
|
{
|
return m_bFirstReviewLeft;
|
}
|
|
BOOL CReviewInterface::ISP2P_GetFirstReviewRight()
|
{
|
return m_bFirstReviewRight;
|
}
|
|
void CReviewInterface::ISP2P_SetFirstReviewLeft(BOOL b_Check)
|
{
|
m_bFirstReviewLeft = b_Check;
|
}
|
|
void CReviewInterface::ISP2P_SetFirstReviewRight(BOOL b_Check)
|
{
|
m_bFirstReviewRight = b_Check;
|
}
|
|
void CReviewInterface::ILCC2P_DisplayMessage( int nIndex, const TCHAR* lpstrFormat, ... )
|
{
|
|
}
|
|
void CReviewInterface::ILCC2P_ChangePosition( int nIndex, int nPos )
|
{
|
|
}
|
|
BOOL CReviewInterface::ISP2P_MakeDirectory(CString strPath)
|
{
|
int i, nIdx = 0, nCount = 0;
|
CString strTemp;
|
|
strTemp = strPath;
|
|
while(TRUE)
|
{
|
nIdx = strTemp.Find(_T("\\"), nIdx + 1);
|
|
if(nIdx != -1) nCount++;
|
else break;
|
}
|
|
nIdx = strTemp.Find(_T(":\\"));
|
|
for(i = 0; i < nCount; i++)
|
{
|
nIdx = strTemp.Find(_T("\\"), nIdx + 2);
|
|
if(nIdx != -1)
|
{
|
strPath = strTemp.Left(nIdx);
|
CreateDirectory(strPath, NULL);
|
}
|
}
|
|
return CreateDirectory(strTemp, NULL);
|
}
|
|
int CReviewInterface::ISP2P_CopyFolder( TCHAR* strSrc, TCHAR* strDest, bool bSubDir )
|
{
|
HANDLE hSrch;
|
WIN32_FIND_DATA wfd;
|
BOOL bResult=TRUE;
|
TCHAR fname[MAX_PATH];
|
TCHAR WildCard[MAX_PATH];
|
TCHAR SrcFile[MAX_PATH];
|
TCHAR DestFile[MAX_PATH];
|
|
_tcscpy(WildCard, strSrc);
|
_tcscat(WildCard, _T("\\*.*"));
|
CreateDirectory(strDest,NULL);
|
hSrch=FindFirstFile(WildCard,&wfd);
|
if (hSrch == INVALID_HANDLE_VALUE) return FALSE;
|
while (bResult)
|
{
|
_stprintf(fname,_T("%s\\%s"),strSrc,wfd.cFileName);
|
|
if (wfd.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN)
|
continue;
|
|
// 서브 디렉토리가 발견되면 서브 디렉토리를 복사 한다.
|
if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
{
|
if (wfd.cFileName[0] != '.')
|
{
|
_stprintf(SrcFile,_T("%s\\%s"),strSrc,wfd.cFileName);
|
_stprintf(DestFile,_T("%s\\%s"),strDest,wfd.cFileName);
|
ISP2P_CopyFolder(SrcFile, DestFile);
|
}
|
}
|
else
|
{
|
_stprintf(DestFile,_T("%s\\%s"),strDest,wfd.cFileName);
|
CopyFile(fname,DestFile,FALSE);
|
}
|
bResult=FindNextFile(hSrch,&wfd);
|
}
|
FindClose(hSrch);
|
return TRUE;
|
}
|
|
const CNetworkInfo* CReviewInterface::IDL2P_System_GetNetworkInfo()
|
{
|
if (m_pDoc==NULL) return NULL;
|
return m_pDoc->System_GetNetworkInfo();
|
}
|
|
void CReviewInterface::IDL2P_DisplayMessage( const TCHAR* lpstrFormat, ... )
|
{
|
va_list list;
|
TCHAR strText[2000] = {0};
|
|
va_start(list, lpstrFormat);
|
_vstprintf_s(strText, lpstrFormat, list);
|
va_end(list);
|
|
g_pLog->DisplayMessage(strText);
|
}
|
|
void CReviewInterface::IDL2P_OpenOffSetTool()
|
{
|
m_pView->ShowOffSetTool();
|
}
|
|
void CReviewInterface::IDL2P_OpenHistoryTool()
|
{
|
m_pView->ShowHistoryTool();
|
}
|
|
//181203
|
BOOL CReviewInterface::IRP2P_SaveDefectMap(const CString& strPath)
|
{
|
if (m_pView == NULL) return FALSE;
|
|
return m_pView->SaveDefectMap(strPath);
|
}
|
|
|
CakAOISharedSystem* CReviewInterface::GetInstance() //akiPCNetAoiSystem 객체
|
{
|
return &m_AOISharedMemory;
|
}
|
|
BOOL CReviewInterface::ISP2P_ReadAOIResultMemory()
|
{
|
if (m_pDoc==NULL) return FALSE;
|
return m_pDoc->ReadResultAOIMemory();
|
}
|
|
BOOL CReviewInterface::ISP2P_ReadAOIResultMemory2(CGlassResult *pGlassResult)
|
{
|
if (m_pDoc == NULL) return FALSE;
|
return m_pDoc->ReadResultAOIMemory2(pGlassResult);
|
}
|
|
BOOL CReviewInterface::GetCenterCoordinate( double& dPosX, double& dPosY )
|
{
|
CGlassResult *pGlassResult = m_pDoc->GlassResult_GetCurrentGlassResult();
|
if (pGlassResult==NULL) return FALSE;
|
|
int nOriginDir = pGlassResult->GetOriginDir();
|
int nCornerDir = pGlassResult->GetCornerCutDir();
|
|
double dGlassSizeX = double(pGlassResult->GetGlassSizeX())/1000;
|
double dGlassSizeY = double(pGlassResult->GetGlassSizeY())/1000;
|
|
switch(nOriginDir)
|
{
|
case GlassOriginDir_LeftTop:
|
{
|
if(nCornerDir == GlassOriginDir_LeftTop)
|
{
|
dPosX = dGlassSizeX/2. - dPosX;
|
dPosY = dGlassSizeY/2. - dPosY;
|
|
}
|
else if(nCornerDir == GlassOriginDir_RightTop)
|
{
|
dPosX = dGlassSizeX/2. - dPosX;
|
dPosY = (-dGlassSizeY)/2. + dPosY;
|
|
}
|
else if(nCornerDir == GlassOriginDir_LeftBottom)
|
{
|
dPosX = (-dGlassSizeX)/2. + dPosX;
|
dPosY = dGlassSizeY/2. - dPosY;
|
}
|
else if(nCornerDir == GlassOriginDir_RightBottom)
|
{
|
dPosX = (-dGlassSizeX)/2. + dPosX;
|
dPosY = (-dGlassSizeY)/2. + dPosY;
|
}
|
}
|
break;
|
|
case GlassOriginDir_RightTop:
|
{
|
if(nCornerDir == GlassOriginDir_LeftTop)//좌상
|
{
|
dPosX = dGlassSizeX/2. - dPosX;
|
dPosY = (-dGlassSizeY)/2. + dPosY;
|
|
}
|
else if(nCornerDir == GlassOriginDir_RightTop)//우상
|
{
|
dPosX = dGlassSizeX/2. - dPosX;
|
dPosY = dGlassSizeY/2. - dPosY;
|
|
}
|
else if(nCornerDir == GlassOriginDir_LeftBottom)//좌하
|
{
|
dPosX = (-dGlassSizeX)/2. + dPosX;
|
dPosY = (-dGlassSizeY)/2. + dPosY;
|
}
|
else if(nCornerDir == GlassOriginDir_RightBottom)//우하
|
{
|
dPosX = (-dGlassSizeX)/2. + dPosX;
|
dPosY = dGlassSizeY/2. - dPosY;
|
}
|
}
|
break;
|
|
case GlassOriginDir_LeftBottom:
|
{
|
if(nCornerDir == GlassOriginDir_LeftTop)//좌상
|
{
|
//210402
|
/*dPosX = (-dGlassSizeX)/2. + dPosX;
|
dPosY = dGlassSizeY/2. - dPosY;*/
|
dPosX = (-dGlassSizeX) / 2. + dPosX;
|
dPosY = dGlassSizeY / 2. - dPosY;
|
dPosY = dPosY * -1;
|
|
}
|
else if(nCornerDir == GlassOriginDir_RightTop)//우상
|
{
|
dPosX = (-dGlassSizeX)/2. + dPosX;
|
dPosY = (-dGlassSizeY)/2. + dPosY;
|
|
}
|
else if(nCornerDir == GlassOriginDir_LeftBottom)//좌하
|
{
|
//210402
|
/*dPosX = dGlassSizeX/2. - dPosX;
|
dPosY = dGlassSizeY/2. - dPosY;*/
|
dPosX = (-dGlassSizeX) / 2. + dPosX;
|
dPosY = dGlassSizeY / 2. - dPosY;
|
dPosY = dPosY * -1;
|
}
|
else if(nCornerDir == GlassOriginDir_RightBottom)//우하
|
{
|
dPosX = dGlassSizeX/2. - dPosX;
|
dPosY = (-dGlassSizeY)/2. + dPosY;
|
}
|
}
|
break;
|
|
case GlassOriginDir_RightBottom:
|
{
|
if(nCornerDir == GlassOriginDir_LeftTop)//좌상
|
{
|
dPosX = (-dGlassSizeX)/2. + dPosX;
|
dPosY = (-dGlassSizeY)/2. + dPosY;
|
|
}
|
else if(nCornerDir == GlassOriginDir_RightTop)//우상
|
{
|
dPosX = (-dGlassSizeX)/2. + dPosX;
|
dPosY = dGlassSizeY/2. - dPosY;
|
|
}
|
else if(nCornerDir == GlassOriginDir_LeftBottom)//좌하
|
{
|
dPosX = dGlassSizeX/2. - dPosX;
|
dPosY = (-dGlassSizeY)/2. + dPosY;
|
}
|
else if(nCornerDir == GlassOriginDir_RightBottom)//우하
|
{
|
dPosX = dGlassSizeX/2. - dPosX;
|
dPosY = dGlassSizeY/2. - dPosY;
|
}
|
}
|
break;
|
}
|
|
return TRUE;
|
}
|
|
BOOL CReviewInterface::IRP2P_GetCenterCoordinate( double& dPosX, double& dPosY )
|
{
|
return GetCenterCoordinate(dPosX, dPosY);
|
}
|
|
void CReviewInterface::DAC2P_SaveAlignTempImage()
|
{
|
// 장비모드 체크
|
if (IsManualProcessMode()==FALSE)
|
{
|
return;
|
}
|
|
if (m_pAlignCameraControl==NULL) return;
|
|
CString strPath = _T("");
|
VectorString vectorFilename;
|
vectorFilename.push_back(strPath);
|
vectorFilename.push_back(strPath);
|
|
CAlignResult alignResult = m_pAlignCameraControl->FindAlignMark(vectorFilename);
|
|
switch(alignResult.nResultCode)
|
{
|
case Align_Success:
|
g_pLog->DisplayMessage(_T("Align Mark Find Success!"));
|
g_pLog->DisplayMessage(_T("1st PixelX: %d, PixelY : %d"), (int)alignResult.dFindPixelX[0], (int)alignResult.dFindPixelY[0]);
|
g_pLog->DisplayMessage(_T("2nd PixelX: %d, PixelY : %d"), (int)alignResult.dFindPixelX[1], (int)alignResult.dFindPixelY[1]);
|
g_pLog->DisplayMessage(_T("1st Find Score : %d"), (int)(alignResult.dFindScore[0] * 100));
|
g_pLog->DisplayMessage(_T("2st Find Score : %d"), (int)(alignResult.dFindScore[1] * 100));
|
break;
|
|
default:
|
g_pLog->DisplayMessage(_T("Align Mark Template Fail!"));
|
g_pLog->DisplayMessage(_T("Template #1: %s"), vectorFilename[0]);
|
g_pLog->DisplayMessage(_T("Template #2: %s"), vectorFilename[1]);
|
g_pLog->DisplayMessage(_T("1st Find Score : %d"), (int)(alignResult.dFindScore[0] * 100));
|
g_pLog->DisplayMessage(_T("2st Find Score : %d"), (int)(alignResult.dFindScore[1] * 100));
|
break;
|
}
|
|
if(alignResult.nResultCode != Align_Success) return;
|
|
m_pAlignCameraControl->SaveAutoTempImage( (int)alignResult.dFindPixelX[0], (int)alignResult.dFindPixelY[0],(int)alignResult.dFindPixelX[1], (int)alignResult.dFindPixelY[1]);
|
}
|
|
void CReviewInterface::IMC2P_UpdateWsiMotionEnd( int nIndex, int nGantryIdx )
|
{
|
int nModuleIndex=-1, nWsiIndex=-1;
|
for (int nIdx=0; nIdx<Module_GetModuleStatusCount(); nIdx++)
|
{
|
CModuleStatus* pModuleStatus = Module_GetModuleStatus(nIdx);
|
if (pModuleStatus == NULL) continue;
|
|
if (pModuleStatus->GetGantryIndex() == nGantryIdx || pModuleStatus->GetModuleType()&ModuleType_Wsi)
|
{
|
nModuleIndex = pModuleStatus->GetModuleIndex();
|
|
const SExternalIndex* pExternIndex = pModuleStatus->GetExternalIndex();
|
if (pExternIndex->nWSI_Index != nGantryIdx)
|
{
|
continue;
|
}
|
|
if (pExternIndex)
|
{
|
nWsiIndex = pExternIndex->nWSI_Index;
|
}
|
break;
|
}
|
}
|
|
if (nModuleIndex<0 || nWsiIndex<0) return;
|
|
// get current index, motor position
|
long nCurrPointIdx=0;
|
int nDiffOffset=10;
|
double dCurrMotorX=0., dCurrMotorY=0.;
|
|
//200817 인덱스 쉬발 chm
|
nWsiIndex = nGantryIdx;
|
|
|
//Motor_ReadAddress(333, nCurrPointIdx);//싱크 맞추기
|
//Motor_ReadAddress(100, dCurrMotorX);
|
//Motor_ReadAddress(101, dCurrMotorY);
|
|
if (nGantryIdx == 0)
|
{
|
Sleep(10);
|
Motor_ReadAddress(454, nCurrPointIdx);//싱크 맞추기
|
Motor_ReadAddress(100, dCurrMotorX);
|
Motor_ReadAddress(101, dCurrMotorY);
|
}
|
else
|
{
|
Sleep(10);
|
Motor_ReadAddress(455, nCurrPointIdx);//싱크 맞추기
|
Motor_ReadAddress(102, dCurrMotorX);
|
Motor_ReadAddress(103, dCurrMotorY);
|
}
|
|
|
g_pLog->DisplayMessage(_T("[WSI_%d] Receive Motion End from Motor! [%02d][%02d][%02d][%.3f][%.3f]")
|
, nWsiIndex, nModuleIndex, nGantryIdx, nCurrPointIdx, dCurrMotorX, dCurrMotorY);
|
|
CGlassResult* pGlassResult = ISP2P_GetCurrentGlassResult();
|
if (pGlassResult==NULL) return;
|
const CReviewResult* pReviewResult =NULL;
|
|
CWsiControl* pWsiControl = ISP2P_GetWSIControl(nWsiIndex);
|
if (pWsiControl==NULL) return;
|
|
switch(GetCurrentWsiMode())
|
{
|
case WsiMeasureType_Normal:
|
{
|
pReviewResult= pGlassResult->GetWsiResult(nModuleIndex);
|
}
|
break;
|
case WsiMeasureType_Monomer:
|
{
|
pReviewResult= pGlassResult->GetWsiReflowResult(nModuleIndex);
|
}
|
break;
|
case WsiMeasureType_User:
|
{
|
pReviewResult= pGlassResult->GetWsiUserResult(nModuleIndex);
|
}
|
break;
|
case WsiMeasureType_MultiShot:
|
{
|
pReviewResult = pGlassResult->GetWsiMultiShotResult(nModuleIndex);
|
}
|
break;
|
default:
|
break;
|
}
|
|
if (pReviewResult==NULL) return;
|
|
const SReviewResult* pSReviewResult = pReviewResult->GetSReviewResult(nCurrPointIdx);
|
if (pSReviewResult==NULL) return;
|
|
if (dCurrMotorX>pSReviewResult->dTargetMotorX-nDiffOffset && dCurrMotorX<pSReviewResult->dTargetMotorX+nDiffOffset
|
&& dCurrMotorY>pSReviewResult->dTargetMotorY-nDiffOffset&& dCurrMotorY<pSReviewResult->dTargetMotorY+nDiffOffset)
|
{
|
dCurrMotorX = pSReviewResult->dTargetMotorX;
|
dCurrMotorY = pSReviewResult->dTargetMotorY;
|
}
|
else
|
g_pLog->DisplayMessage(_T("[WSI_%d] Motion End MissMatching! [%.3f][%.3f]<->[%.3f][%.3f]")
|
, nWsiIndex, dCurrMotorX, dCurrMotorY, pSReviewResult->dTargetMotorX, pSReviewResult->dTargetMotorY);
|
|
if (pWsiControl->SetWsiMotionEnd(nCurrPointIdx, int(dCurrMotorX*1000), int(dCurrMotorY*1000))==FALSE)
|
g_pLog->DisplayMessage(_T("[WSI_%d] Send Motion End to WSI FAIL! [%02d][%02d]"), nWsiIndex, nModuleIndex, nWsiIndex);
|
else
|
g_pLog->DisplayMessage(_T("[WSI_%d] Send Motion End to WSI SUCCESS! [%02d][%02d]"), nWsiIndex, nModuleIndex, nWsiIndex);
|
}
|
|
void CReviewInterface::IWC2P_SetScanEnd( int nIndex, int nPointIndex, int nPositionX, int nPositionY )
|
{
|
int nModuleIndex=-1, nWsiIndex=-1;
|
for (int nIdx=0; nIdx<Module_GetModuleStatusCount(); nIdx++)
|
{
|
CModuleStatus* pModuleStatus = Module_GetModuleStatus(nIdx);
|
if (pModuleStatus == NULL || !(pModuleStatus->GetModuleType()&ModuleType_Wsi)) continue;
|
|
const SExternalIndex* pExternIndex = pModuleStatus->GetExternalIndex();
|
if (pExternIndex==NULL) continue;
|
|
nWsiIndex = pExternIndex->nWSI_Index;
|
|
if (nWsiIndex==nIndex)
|
{
|
nModuleIndex = pModuleStatus->GetModuleIndex();
|
break;
|
}
|
}
|
|
if (nModuleIndex<0) return;
|
|
g_pLog->DisplayMessage(_T("[WSI_%d] Receive Scan End! [%02d][%02d][%.3f][%.3f]")
|
, nIndex, nModuleIndex, nPointIndex, float(nPositionX)/1000., float(nPositionY)/1000.);
|
|
if (Motor_GantryWsiNextPosMove(nModuleIndex, nPointIndex+1))
|
g_pLog->DisplayMessage(_T("[WSI_%d] Send Move Next Position Success! [%02d][%02d]"), nIndex, nModuleIndex, nPointIndex+1);
|
else
|
g_pLog->DisplayMessage(_T("[WSI_%d] Send Move Next Position FAIL! [%02d][%02d]"), nIndex, nModuleIndex, nPointIndex+1);
|
}
|
|
BOOL CReviewInterface::Motor_GantryWsiNextPosMove( int nModuleIndex, int nNextDefectIndex )
|
{
|
if(m_pMotorControl==NULL) return FALSE;
|
|
const CModuleStatus *pModuleStatus = Module_GetModuleStatus(nModuleIndex);
|
if (pModuleStatus==NULL) return FALSE;
|
|
int nGantryIndex = pModuleStatus->GetGantryIndex();
|
|
return m_pMotorControl->GantryWsiNextPosMove(nGantryIndex, long(nNextDefectIndex));
|
}
|
|
BOOL CReviewInterface::IMC2P_GetUseWsi()
|
{
|
if(int(m_vecWSIControl.size()) < 1) return FALSE;
|
|
return TRUE;
|
}
|
|
void CReviewInterface::IWC2P_DisplayMessage( int nIndex, const TCHAR* lpstrFormat, ... )
|
{
|
va_list list;
|
TCHAR strText[2000] = {0};
|
|
va_start(list, lpstrFormat);
|
_vstprintf_s(strText, lpstrFormat, list);
|
va_end(list);
|
|
g_pLog->DisplayMessage(strText);
|
}
|
|
void CReviewInterface::ISP2P_SetCurrentWsiMode( int nMode )
|
{
|
//if(nMode < WsiMeasureType_Normal || nMode > WsiMeasureType_User) return;
|
|
SetCurrentWsiMode(nMode);
|
}
|
|
int CReviewInterface::IWC2P_GetWsiType()
|
{
|
return GetCurrentWsiMode();
|
}
|
|
int CReviewInterface::InitTotalPitchMeasure()
|
{
|
int nCount = 0;
|
|
if (m_pTotalPitchMeasure)
|
{
|
delete m_pTotalPitchMeasure;
|
m_pTotalPitchMeasure = NULL;
|
}
|
|
m_pTotalPitchMeasure = new CTotalPitchMeasure();
|
|
m_pTotalPitchMeasure->SetTP2P(static_cast<ITotalPitchMeasure2Parnet*>(this));
|
|
nCount++;
|
|
return nCount;
|
}
|
|
void CReviewInterface::DeinitTotalPitchMeasure()
|
{
|
if (m_pTotalPitchMeasure)
|
{
|
delete m_pTotalPitchMeasure;
|
m_pTotalPitchMeasure = NULL;
|
}
|
}
|
|
void CReviewInterface::ITP2P_DisplayMessage( int nIndex, const TCHAR* lpstrFormat, ... )
|
{
|
va_list list;
|
TCHAR strText[2000] = {0};
|
|
va_start(list, lpstrFormat);
|
_vstprintf_s(strText, lpstrFormat, list);
|
va_end(list);
|
|
g_pLog->DisplayMessage(strText);
|
}
|
|
BOOL CReviewInterface::ITP2P_GetAlignMarkPosition( double &dPositionX, double &dPositionY )
|
{
|
const CGlassTypeInfo* pGlassTypeInfo = m_pDoc->System_GetStandardGlassTypeInfo();
|
if(pGlassTypeInfo == NULL) return FALSE;
|
|
dPositionX = pGlassTypeInfo->m_dFirstAlignGlassX;
|
dPositionY = pGlassTypeInfo->m_dFirstAlignGlassY;
|
|
if(dPositionX < 0 || dPositionY < 0) return FALSE;
|
|
return TRUE;
|
}
|
|
BOOL CReviewInterface::ITP2P_GetGlassSize( double &dGlassSizeX, double &dGlassSizeY )
|
{
|
CGlassResult *pGlassResult = m_pDoc->GlassResult_GetCurrentGlassResult();
|
if (pGlassResult==NULL) return FALSE;
|
|
dGlassSizeX = double(pGlassResult->GetGlassSizeX())/1000.0;
|
dGlassSizeY = double(pGlassResult->GetGlassSizeY())/1000.0;
|
|
if(dGlassSizeX < 0 || dGlassSizeY < 0) return FALSE;
|
|
return TRUE;
|
}
|
|
BOOL CReviewInterface::ITP2P_GetAlignMarkCenterPosition( double &dPositionX, double &dPositionY )
|
{
|
const CSystemInfo *pSystemInfo = m_pDoc->System_GetSystemInfo();
|
if(pSystemInfo == NULL) return 0;
|
|
const CGantryInfo* pGantryInfo = pSystemInfo->GetGantryInfo(0);
|
if (pGantryInfo==NULL) return 0;
|
|
const CHeaderInfo* pHeaderInfo = pGantryInfo->GetHeaderInfo(0);
|
if (pHeaderInfo==NULL) return 0;
|
|
const CCameraControlInfo_Plus *pCameraInfo = pHeaderInfo->GetCameraInfo(0);
|
if (pCameraInfo==NULL) return 0;
|
|
int nCameraFovX = pCameraInfo->GetFrameWidth();
|
int nCameraFovY = pCameraInfo->GetFrameHeight();
|
|
dPositionX = double(nCameraFovX/2);
|
dPositionY = double(nCameraFovY/2);
|
|
if(dPositionX < 0 || dPositionY < 0) return FALSE;
|
|
return TRUE;
|
}
|
|
BOOL CReviewInterface::ITP2P_GetMotionEnable()
|
{
|
//sjb Test
|
//return TRUE;
|
|
const CMotorControlInfo* pMotorInfo = m_pDoc->System_GetMotorInfo();
|
CMotorControl* pMotorControl = ISP2P_GetMotorControl();
|
|
if(pMotorInfo == NULL || pMotorControl==NULL) return FALSE;
|
|
const CMotorCommonAddr* pCommonAddr = pMotorInfo->GetMotorCommonAddr();
|
if(pCommonAddr == NULL) return FALSE;
|
|
DWORD dwTick = GetTickCount();
|
|
BOOL bResult = FALSE;
|
|
while (TRUE)
|
{
|
long nEnable = 0;
|
|
pMotorControl->ReadAddressValue(pCommonAddr->m_nAllAutoEnableAddr, nEnable);
|
|
if (nEnable==1)
|
{
|
Sleep(300);
|
bResult = TRUE;
|
break;
|
}
|
|
if (GetTickCount()-dwTick > 15000) break; // Manual Move일시 Motor 속도가 매우느리네...
|
}
|
|
Sleep(500);
|
|
return bResult;
|
}
|
|
BOOL CReviewInterface::ITP2P_MoveMotorGlassPosition( int nModuleIndex, double dPositionX, double dPositionY )
|
{
|
return Motor_CameraGo2(nModuleIndex, dPositionX, dPositionY, 0);
|
}
|
|
BOOL CReviewInterface::ITP2P_StartTemplateMatching(double &dPosX, double &dPosY )
|
{
|
if(m_pTotalPitchMeasure == NULL) return FALSE;
|
|
CCameraControlReview *pCameraControlReview = ISP2P_GetReviewCameraControl(0);
|
if (pCameraControlReview==NULL) return FALSE;
|
|
const CAlignCameraInfo* pCamInfo = ISP2P_System_GetAlignCameraInfo(0);
|
if(pCamInfo == NULL) return FALSE;
|
|
const CCameraControlInfo_Plus* pCameraControlInfo = pCamInfo->GetCameraControlInfo();
|
if(pCameraControlInfo == NULL) return FALSE;
|
|
double dAlignCamResolution = pCameraControlInfo->GetPixelResolution();
|
|
const CModuleStatus* pModuleStatus = Module_GetSelectedModuleStatus();
|
if (pModuleStatus==NULL) return 0;
|
|
const SCameraInfo* pCameraInfo = pModuleStatus->GetCurrentCameraInfo();
|
const SMagnificInfo* pMagnificInfo = pModuleStatus->GetCurrentMagnificInfo();
|
|
if(pCameraInfo == NULL || pMagnificInfo == NULL) return FALSE;
|
|
double dReviewCamResolution = pCameraInfo->dResolution / pMagnificInfo->dMagnification;
|
|
if(dAlignCamResolution < 0.0 || dReviewCamResolution < 0.0)
|
{
|
g_pLog->DisplayMessage(_T("Get Camera Data Fail!! Align : %.3lf, Review : %.3lf"), dAlignCamResolution, dReviewCamResolution);
|
return FALSE;
|
}
|
|
double dRatio = dAlignCamResolution/dReviewCamResolution;
|
|
if(!pCameraControlReview->FindReviewAlignMark(dPosX, dPosY, dRatio)) return FALSE;
|
|
return TRUE;
|
}
|
|
BOOL CReviewInterface::ITP2P_GetAlignTemplateCenterPosition( int nIdx, double &dPositionX, double &dPositionY )
|
{
|
return TRUE;
|
}
|
|
BOOL CReviewInterface::ITP2P_SetMinMagChange(int nModuleIndex)
|
{
|
int nValue = 0;
|
|
CModuleStatus *pModuleStatus = Module_GetModuleStatus(nModuleIndex);
|
if (pModuleStatus==NULL) return FALSE;
|
|
SCameraControl *pCameraControl = Module_GetCameraControl(nModuleIndex);
|
if (pCameraControl==NULL) return FALSE;
|
|
// afm tracking off
|
SExternalIndex *pExternalIndex = Module_GetExternalIndex(nModuleIndex);
|
if (pExternalIndex)
|
{
|
CLensChangeControl *pRevolverControl = ISP2P_GetRevolverControl(pExternalIndex->nRevolver_Index);
|
if (pRevolverControl && pRevolverControl->GetControlType()!=LensChangeController_DualTube)
|
{
|
if (pCameraControl->bAFMTracking)
|
{
|
if (AFM_SetAFMTracking(nModuleIndex, FALSE))
|
{
|
g_pLog->DisplayMessage(_T("[User] Module(%d) AFM Tracking Stop Success!"), nModuleIndex);
|
}
|
else
|
{
|
g_pLog->DisplayMessage(_T("[User] Module(%d) AFM Tracking Stop Fail!"), nModuleIndex);
|
}
|
::Sleep(100);
|
}
|
}
|
}
|
|
// set revolver level
|
if (Revolver_SetRevolverLevel(nModuleIndex, nValue))
|
{
|
g_pLog->DisplayMessage(_T("[User] Module(%d) Revolver Level %d Success!"), nModuleIndex, nValue);
|
|
if (pExternalIndex)
|
{
|
CLensChangeControl *pRevolverControl = ISP2P_GetRevolverControl(pExternalIndex->nRevolver_Index);
|
if (pRevolverControl && pRevolverControl->GetControlType()!=LensChangeController_DualTube)
|
{
|
if (AFM_SetAFMZoomLevel(nModuleIndex, nValue))
|
{
|
g_pLog->DisplayMessage(_T("[User] Module(%d) AFM Zoom Level %d Success!"), nModuleIndex, nValue);
|
}
|
else
|
{
|
g_pLog->DisplayMessage(_T("[User] Module(%d) AFM Zoom Level %d Fail!"), nModuleIndex, nValue);
|
}
|
}
|
}
|
}
|
else
|
{
|
g_pLog->DisplayMessage(_T("[User] Module(%d) Revolver Level %d Fail!"), nModuleIndex, nValue);
|
}
|
|
AFM_SetAFMTracking(nModuleIndex, TRUE);
|
|
return TRUE;
|
}
|
|
CTotalPitchMeasure* CReviewInterface::ISP2P_GetTotalPitchMeasure()
|
{
|
if(m_pTotalPitchMeasure == NULL) return NULL;
|
|
return m_pTotalPitchMeasure;
|
}
|
|
double CReviewInterface::ITP2P_GetCurrentResolution()
|
{
|
const CModuleStatus* pModuleStatus = Module_GetSelectedModuleStatus();
|
if (pModuleStatus==NULL) return 0;
|
|
const SCameraInfo* pCameraInfo = pModuleStatus->GetCurrentCameraInfo();
|
const SMagnificInfo* pMagnificInfo = pModuleStatus->GetCurrentMagnificInfo();
|
|
if(pCameraInfo == NULL || pMagnificInfo == NULL) return 0;
|
|
double dCurrentResolution = pCameraInfo->dResolution / pMagnificInfo->dMagnification;
|
|
g_pLog->DisplayMessage(_T("[CurrentResolt] Resulution : %.3lf, CamResolution : %.3lf, Mag : %.3lf!"), dCurrentResolution, pCameraInfo->dResolution, pMagnificInfo->dMagnification);
|
|
return dCurrentResolution;
|
}
|
|
BOOL CReviewInterface::ISP2P_Motor_CameraGo( int nModuleIndex, double dPosX, double dPosY, int nMoveAxis, BOOL bAutoSelectCamera/*=FALSE*/, BOOL bGoEnd/*=FALSE*/ )
|
{
|
return Motor_CameraGo2(nModuleIndex,dPosX,dPosY,nMoveAxis);
|
}
|
|
void CReviewInterface::IWC2P_SetWSIErrorCheck( int nIndex,CString strAlarmMessage )
|
{
|
g_pLog->DisplayMessage(_T("[ReviewInterface] Error Index : [%d] Alarm :[%s]"),nIndex,strAlarmMessage);
|
return IRP2P_GetSequenceProcessor()->SendWsiErrorAlarm();
|
}
|
|
void CReviewInterface::IWC2P_SetWSIAliveCheck()
|
{
|
return IRP2P_GetSequenceProcessor()->SendWsiAlive_CPJT();
|
}
|
|
void CReviewInterface::WsiAliveCheckThread()
|
{
|
return IRP2P_GetSequenceProcessor()->WSIAliveCheckRunThread();
|
}
|
|
CString CReviewInterface::IRCC2P_GetTotalPitchImageName()
|
{
|
CRsRcpAlignInfo* pRcpinfo = m_pDoc->Recipe_GetRsRcpAlignInfo();
|
|
if(pRcpinfo==NULL) return _T("");
|
|
return pRcpinfo->m_strTotalPitchImageFile;
|
|
}
|
|
//akIPCNetAOISystem CReviewInterface::m_AOISharedMemory; //protected
|
|
CakAOISharedSystem CReviewInterface::m_AOISharedMemory; //20171017
|