// SequenceProcessor.cpp : 구현 파일입니다.
|
//
|
|
#include "stdafx.h"
|
#include "SequenceProcessor.h"
|
#include "CHReviewSetting/NetworkInfo.h"
|
|
#include "CHReviewResult/GlassResult.h"
|
#include "CHSignalControls/SignalControl.h"
|
#include "CHSignalControls/SignalControlInfo.h"
|
#include "CHReviewRecipe/RsRecipeManager.h"
|
#include "CameraControlAlign.h"
|
#include "ReviewProcessor.h"
|
#include "CHReviewPrioritySorter/PrioritySorter.h"
|
#include "CHReviewRecipe/RsRcpReviewInfo.h"
|
#include "CHReviewSetting/GlassTypeInfo.h"
|
#include "CHMotorControls/MotorControlInfo.h"
|
#include "CHReviewRecipe/RcpSchedulingInfo.h"
|
#include "CHDefectPicker/DefectPicker.h"
|
#include "CHReviewSetting/AlignCalibrator.h"
|
#include "CoordCalibrator.h"
|
#include "CHReviewRecipe/RsRcpAlignInfo.h"
|
#include "CHReviewSetting/Sys_AlignManager.h"
|
#include "CameraControlReview.h"
|
#include "CHLensChangeControls/LensChangeControl.h"
|
#include "CHAfmControls/AfmControl.h"
|
#include "CHWsiControls/WsiControl.h"
|
#include "CHPathScheduler/PathScheduler.h"
|
#include "CHMotorControls/MotorControl.h"
|
#include "CHReviewSetting/SystemInfo.h"
|
#include "CoordCalibrator.h"
|
#include "CHMotorControls/MotorControl.h"
|
#include "CHMotorCalibrator/MotorCalibrator.h"
|
|
#include "AlignServerControl.h"
|
#include <algorithm>
|
|
enum PlanType {
|
PlanReview = 0, PlanUser, PlanWSI, PlanMeasure, PlanReflow, PlanWsiReflow, PlanWsiUser, PlanWsiMultiShot
|
};
|
|
enum WSI_REFLOW_POINTINDEX_P { W_LEFTTOP=0, W_TOP, W_RIGHTTOP, W_LEFT, W_RIGHT, W_LEFTBOTTOM, W_BOTTOM, W_RIGHTBOTTOM, W_LEFTNOTCH, W_RIGHTNOTCH};
|
enum WSI_REFLOW_CELLSIDE_INDX_P { W_CELL_TOP=0, W_CELL_LEFT, W_CELL_RIGHT, W_CELL_LEFTTOP, W_CELL_RIGHTTOP, W_CELL_LEFTBOTTOM, W_CELL_RIGHTBOTTOM, W_CELL_BOTTOM, W_CELL_LEFTNOTCH, W_CELL_RIGHTNOTCH};
|
|
enum GlassDataType { GLASS_DATA_GLASS_ID = 0,
|
GLASS_DATA_LOT_ID,
|
GLASS_DATA_SLOT_NUM,
|
GLASS_DATA_STEP_ID,
|
GLASS_DATA_PPID,
|
GLASS_DATA_FLOW_ID,
|
GLASS_DATA_TYPE_COUNT };
|
|
// [2017:1:9]-[WEZASW] : PCControl GlassData 항목 재정의.(ING)
|
enum GlassDataTypeB7 { B7_GLASS_DATA_LOT_ID = 0,
|
B7_GLASS_DATA_GLASS_ID,
|
B7_GLASS_DATA_OPER_ID,
|
B7_GLASS_DATA_GLASS_CODE,
|
B7_GLASS_DATA_PPID,
|
B7_GLASS_DATA_TYPE_COUNT };
|
|
// CSequenceProcessor
|
CSequenceProcessor::CSequenceProcessor() : CWorkThreadPools(1)
|
{
|
m_nProcessMode = ProcessModeManual;
|
m_nProcessStatus = ProcessNA;
|
m_nPreProcessStatus = ProcessNA;
|
m_nReviewProcessStatus = ReviewProcessStatus_None;
|
m_nReviewPlanIndex = 0;
|
m_pSP2P = NULL;
|
|
m_bChangeSysConfig = FALSE;
|
m_nLineType = -1;
|
m_nMachineType = -1;
|
|
m_nAFMDelay = 200;
|
m_nSNAPDelay = 50;
|
m_nWSIDelay = 3000;
|
|
m_bLongRunMode = FALSE;
|
m_bLongRunStop = FALSE;
|
m_nLongRunCount = 0;
|
|
m_nAlive = 0;
|
|
m_nWsiTotalCount = 0;
|
//#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 ADD START
|
m_bSimulationMode = FALSE;
|
//#3584 210817 LYW CF AOI Review 시뮬레이션 기능 정상화 ADD END
|
InitializeCriticalSection(&m_csProcessStatus);
|
}
|
|
CSequenceProcessor::~CSequenceProcessor()
|
{
|
DeleteCriticalSection(&m_csProcessStatus);
|
}
|
|
BOOL CompareRawFileWriteTimeAscendingOrder(const SRawFile& lhs, const SRawFile& rhs)
|
{
|
return (lhs.dWriteTime < rhs.dWriteTime);
|
}
|
|
BOOL CompareRawFileWriteTimeDescendingOrder(const SRawFile& lhs, const SRawFile& rhs)
|
{
|
return (lhs.dWriteTime > rhs.dWriteTime);
|
}
|
|
void CSequenceProcessor::SortingFindAOIRawFile(VectorSRawFile& vectorSRowFile, int nSortingType)
|
{
|
if(nSortingType == RESULT_SORTING_ASCENDING)
|
{
|
std::sort(vectorSRowFile.begin(), vectorSRowFile.end(), CompareRawFileWriteTimeAscendingOrder);
|
}
|
else if(nSortingType == RESULT_SORTING_DESCENDING)
|
{
|
std::sort(vectorSRowFile.begin(), vectorSRowFile.end(), CompareRawFileWriteTimeDescendingOrder);
|
}
|
else
|
{
|
;
|
}
|
}
|
|
void CSequenceProcessor::UpdateReviewProcessStatus(int nReviewStatus, int nPlanIndex)
|
{
|
m_nReviewProcessStatus = nReviewStatus;
|
m_nReviewPlanIndex = nPlanIndex;
|
}
|
|
BOOL CSequenceProcessor::SetProcessMode(int nMode)
|
{
|
EnterCriticalSection(&m_csProcessStatus);
|
|
// manual -> auto
|
if (m_nProcessMode==ProcessModeManual && nMode==ProcessModeAuto)
|
{
|
m_nProcessStatus = ProcessNA;
|
}
|
|
BOOL bReturn = FALSE;
|
m_nProcessMode = nMode;
|
bReturn = TRUE;
|
|
LeaveCriticalSection(&m_csProcessStatus);
|
|
return bReturn;
|
}
|
|
void CSequenceProcessor::CalibrateMotorPos(int nModuleIdx, double &dPosX, double &dPosY)
|
{
|
CMotorCalibrator* pMotorCalibrator = m_pSP2P->ISP2P_GetMotorCalibrator(nModuleIdx);
|
if(pMotorCalibrator == NULL) return ;
|
|
CString strTemp, strValue;
|
strValue.Format(_T("[SequenceProcessor] CalibrateMotor[%d] %lfmm, %lfmm => "), dPosX, dPosY);
|
|
pMotorCalibrator->BCalibratePosition(dPosX, dPosY);
|
|
strTemp.Format(_T("%lfmm, %lfmm"), dPosX, dPosY);
|
strValue += strTemp;
|
|
m_pSP2P->ISP2P_DisplayMessage(strValue);
|
}
|
|
void CSequenceProcessor::ApplyMotorOffset(int nModuleIdx, int nMagIdx, int nOffsetType, double &dPosX, double &dPosY)
|
{
|
CModuleStatus* pModuleStatus = m_pSP2P->ISP2P_GetModuleStatus(nModuleIdx);
|
if(pModuleStatus == NULL) return ;
|
const CRsRcpReviewInfo* pRsRcpReviewInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo();
|
|
//181130 글라스타입 OFFSET 적용// cmark
|
if (nOffsetType & MotorOffset_Glass)
|
{
|
CGlassResult* pGlassResult = m_pSP2P->ISP2P_GetCurrentGlassResult();
|
if(pGlassResult == NULL) return;
|
|
|
STransferData* pTransferData = m_pSP2P->ISP2P_GetCurrentTransferData();
|
if ( pTransferData==NULL) return;
|
|
|
const CGlassTypeInfo* pGlassTypeInfo = m_pSP2P->ISP2P_System_GetGlassTypeInfo(_ttoi(pTransferData->strGlassScanSchedule));
|
if(pGlassResult == NULL) return;
|
|
dPosX += pGlassTypeInfo->GetMotorOffsetX();
|
dPosY += pGlassTypeInfo->GetMotorOffsetY();
|
}
|
|
///////////////////////////////////
|
|
|
if (nOffsetType & MotorOffsetCamera)
|
{
|
SCameraInfo* pCameraInfo = pModuleStatus->GetCurrentCameraInfo();
|
if(pCameraInfo)
|
{
|
dPosX += pCameraInfo->dOffsetX;
|
dPosY += pCameraInfo->dOffsetY;
|
}
|
}
|
|
if (nOffsetType & MotorOffsetMag)
|
{
|
SMagnificInfo* pMagnificInfo = pModuleStatus->GetMagnificInfo(nMagIdx);
|
if(pMagnificInfo)
|
{
|
dPosX += pMagnificInfo->dMagnificOffsetX;
|
dPosY += pMagnificInfo->dMagnificOffsetY;
|
}
|
}
|
|
if (nOffsetType & MotorOffsetWSI)
|
{
|
SMotorPosition* pMotorPosition = pModuleStatus->GetMotorPosition();
|
if(pMotorPosition)
|
{
|
// [2016:11:10]-[WEZASW] : 리뷰 수동 이동 방향과 Offset 방향 동일시 수정. ( '+=' -> '-=' )
|
dPosX -= pMotorPosition->dWSIOffsetX;
|
dPosY -= pMotorPosition->dWSIOffsetY;
|
}
|
}
|
}
|
|
void CSequenceProcessor::SetSP2P(ISequenceProcessor2Parent* pSP2P)
|
{
|
m_pSP2P = pSP2P;
|
}
|
|
void CSequenceProcessor::SetLineMachineType(int nLineType, int nMachineType, CString strEqpID)
|
{
|
m_nLineType = nLineType;
|
m_nMachineType = nMachineType;
|
m_strEqpID = strEqpID;
|
}
|
|
int CSequenceProcessor::GetProcessMode() const
|
{
|
return m_nProcessMode;
|
}
|
|
int CSequenceProcessor::GetProcessStatus() const
|
{
|
return m_nProcessStatus;
|
}
|
|
BOOL CSequenceProcessor::SetProcessStatus(int nProcessStatus)
|
{
|
EnterCriticalSection(&m_csProcessStatus);
|
|
BOOL bReturn = FALSE;
|
|
// 현재 상태가 이전 상태와 다른가?
|
if (nProcessStatus!=m_nProcessStatus)
|
{
|
if (nProcessStatus==0) // 초기(0) 상태이면..
|
{
|
bReturn = TRUE;
|
}
|
else if (nProcessStatus==(m_nProcessStatus+1)) // 이전 상태 다음(+1)이면..
|
{
|
bReturn = TRUE;
|
}
|
|
if (bReturn) // 수행이면...
|
{
|
// Thread 생성 후 Thread 수행
|
CSequenceProcessData* pThreadData = new CSequenceProcessData(this);
|
if (pThreadData)
|
{
|
pThreadData->nProcessStatus = nProcessStatus;
|
bReturn = CreateWorkThread(pThreadData);
|
}
|
}
|
}
|
|
LeaveCriticalSection(&m_csProcessStatus);
|
|
return bReturn;
|
}
|
|
int CSequenceProcessor::GetDirectionX(int nGlassDirection, int nMotorDirection)
|
{
|
if(nGlassDirection == GlassOriginDir_LeftTop || nGlassDirection == GlassOriginDir_LeftBottom)
|
{
|
if(nMotorDirection == MotorOriginDir_LeftTop || nMotorDirection == MotorOriginDir_LeftBottom)
|
{
|
return COORDINATE_DIRECTION_FORWARD;
|
}
|
else
|
{
|
return COORDINATE_DIRECTION_BACKWARD;
|
}
|
}
|
|
if(nGlassDirection == GlassOriginDir_RightTop || nGlassDirection == GlassOriginDir_RightBottom)
|
{
|
if(nMotorDirection == MotorOriginDir_RightTop || nMotorDirection == MotorOriginDir_RightBottom)
|
{
|
return COORDINATE_DIRECTION_FORWARD;
|
}
|
else
|
{
|
return COORDINATE_DIRECTION_BACKWARD;
|
}
|
}
|
|
return COORDINATE_DIRECTION_BACKWARD;
|
}
|
|
int CSequenceProcessor::GetDirectionY(int nGlassDirection, int nMotorDirection)
|
{
|
if(nGlassDirection == GlassOriginDir_LeftTop || nGlassDirection == GlassOriginDir_RightTop)
|
{
|
if(nMotorDirection == MotorOriginDir_LeftTop || nMotorDirection == MotorOriginDir_RightTop)
|
{
|
return COORDINATE_DIRECTION_FORWARD;
|
}
|
else
|
{
|
return COORDINATE_DIRECTION_BACKWARD;
|
}
|
}
|
|
if(nGlassDirection == GlassOriginDir_LeftBottom || nGlassDirection == GlassOriginDir_RightBottom)
|
{
|
if(nMotorDirection == MotorOriginDir_LeftBottom || nMotorDirection == MotorOriginDir_RightBottom)
|
{
|
return COORDINATE_DIRECTION_FORWARD;
|
}
|
else
|
{
|
return COORDINATE_DIRECTION_BACKWARD;
|
}
|
}
|
|
return COORDINATE_DIRECTION_BACKWARD;
|
}
|
|
void CSequenceProcessor::DeleteDirectoryInsideFile(const CString& strPath)
|
{
|
BOOL bRet;
|
CFileFind finder;
|
int nDeleteFileIdx;
|
CString strSearchPath, strDeleteFilePath, strMessage;
|
CProcessTimer processTimer;
|
|
nDeleteFileIdx = 0;
|
strSearchPath.Format(_T("%s\\*.*"), strPath);
|
|
processTimer.Start();
|
bRet = finder.FindFile(strSearchPath);
|
|
while(bRet)
|
{
|
bRet = finder.FindNextFile();
|
|
if(finder.IsDots()) continue;
|
if(finder.IsDirectory()) continue;
|
|
strDeleteFilePath = finder.GetFilePath();
|
DeleteFile(strDeleteFilePath);
|
nDeleteFileIdx++;
|
}
|
|
finder.Close();
|
|
processTimer.End();
|
strMessage.Format(_T("%s File Delete Time[Count %d ea, %.3f ms]"), strPath, nDeleteFileIdx, processTimer.GetDurationMilliSecond());
|
g_pLog->DisplayMessage(strMessage);
|
}
|
|
|
|
void CSequenceProcessor::SetDefaultValue()
|
{
|
if (m_pSP2P==NULL) return;
|
|
const CGlassTypeInfo* pGlassTypeInfo = m_pSP2P->ISP2P_System_GetStandardGlassTypeInfo();
|
const CMotorControlInfo* pMotorInfo = m_pSP2P->ISP2P_System_GetMotorInfo();
|
CCoordCalibrator* pCoordCalibrator = m_pSP2P->ISP2P_GetCoordCalibrator();
|
|
//기본 글라스 타입 적용
|
if(pGlassTypeInfo && pMotorInfo && pCoordCalibrator)
|
{
|
int nDirectionX = GetDirectionX(pGlassTypeInfo->m_nOriginDirection, pMotorInfo->GetOriginDirection());
|
int nDirectionY = GetDirectionY(pGlassTypeInfo->m_nOriginDirection, pMotorInfo->GetOriginDirection());
|
|
//좌표계 설정
|
pCoordCalibrator->SetTransDirection(nDirectionX, nDirectionY);
|
pCoordCalibrator->SetOriginMotorPosition(pGlassTypeInfo->m_dOriginMotorX, pGlassTypeInfo->m_dOriginMotorY);
|
|
if (fabs(pGlassTypeInfo->m_dAlignAngle) > 0.0000001)
|
{
|
pCoordCalibrator->SetRotationInfo(pGlassTypeInfo->m_dFirstAlignMotorX, pGlassTypeInfo->m_dFirstAlignMotorY,
|
pGlassTypeInfo->m_dFirstAlignGlassX, pGlassTypeInfo->m_dFirstAlignGlassY, pGlassTypeInfo->m_dAlignAngle);
|
}
|
|
int nTotalCount = 0;
|
CGlassResult* pGlassResult = m_pSP2P->ISP2P_GetNewGlassResult(nTotalCount);
|
if(pGlassResult)
|
{
|
pGlassResult->SetGlassSize(pGlassTypeInfo->m_nGlassSizeX * 1000, pGlassTypeInfo->m_nGlassSizeY * 1000);
|
pGlassResult->SetGlassOriginDirection(pGlassTypeInfo->m_nOriginDirection);
|
pGlassResult->SetCornerCutDirection(pGlassTypeInfo->m_nCornerCutDirection);
|
pGlassResult->SetGlassCenterCoordinate(pGlassTypeInfo->m_bUseCenterCoodinateSystem);
|
pGlassResult->SetGlassInverseCoordinate(pGlassTypeInfo->m_bUseInverseCoordinate);
|
|
// 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_pSP2P->ISP2P_System_GetSystemInfo();
|
if(pSystemInfo)
|
{
|
int nZoomLevel = 1;
|
for(int i = 0; i < pSystemInfo->GetGantryInfoCount(); i++)
|
{
|
const CGantryInfo* pGantryInfo = pSystemInfo->GetGantryInfo(i);
|
if (pGantryInfo==NULL) continue;
|
|
if (pGantryInfo->m_bStandardGantry==FALSE) continue;
|
|
//DRC2P_SetSelectedCamera(i, nZoomLevel);
|
|
break;
|
}
|
}
|
|
// 조명 기본값
|
|
// 얼라인 조명 기본값
|
|
// 리볼버 기본값
|
Revolver_SetRevolverLevel(0, 0);
|
|
// AFM 기본값
|
AFM_SetAFMZoomLevel(0, 0);
|
|
}
|
|
// PCControl Control command
|
BOOL CSequenceProcessor::Signal_SendSignal(int nSignalIndex)
|
{
|
CSignalControl* pSignalControl = m_pSP2P->ISP2P_GetSignalControl();
|
|
if (pSignalControl==NULL) return FALSE;
|
|
if (pSignalControl->IsConnected() == FALSE) return FALSE;
|
|
int nAddrIdx = 0;
|
if (pSignalControl->Write_SendSignal(nAddrIdx, nSignalIndex, 1, 2000))
|
{
|
m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Send Fail! "));
|
return FALSE;
|
}
|
|
return TRUE;
|
}
|
|
BOOL CSequenceProcessor::PCControl_ReadTransferData(STransferData* pTransferData)
|
{
|
const CSignalControlInfo* pSignalInfo = m_pSP2P->ISP2P_System_GetPCControlInfo();
|
CSignalControl* pSignalControl = m_pSP2P->ISP2P_GetSignalControl();
|
|
if (pSignalInfo==NULL || pSignalControl==NULL) return FALSE;
|
|
if (pSignalControl->IsConnected() == FALSE) return FALSE;
|
|
// reset transfer data
|
pTransferData->Reset();
|
|
int nPCControlReadDataCount = pSignalInfo->GetReadDataAddressCount();
|
|
// [2017:1:9]-[WEZASW] : PCControl GlassData 항목 재정의.
|
if(pSignalInfo->GetUseContinuousReadAddress())
|
{
|
CString strReadAddress = _T("");
|
int nReadTotalSize = 0;
|
for(int i=0; i<nPCControlReadDataCount; i++)
|
{
|
const SSignalSettingData *pInfo = pSignalInfo->GetReadDataAddress(i);
|
if (pInfo==NULL) continue;
|
|
if (i==0) strReadAddress = pInfo->strAddr;
|
nReadTotalSize += pInfo->nSize;
|
}
|
|
CString strData = _T("");
|
if (pSignalControl->ReadData(strReadAddress, nReadTotalSize, strData))
|
{
|
m_pSP2P->ISP2P_DisplayMessage(_T("[ReadTransferData] Addr: %s, Size: %d, Data: %s"), strReadAddress, nReadTotalSize, strData);
|
}
|
else
|
{
|
m_pSP2P->ISP2P_DisplayMessage(_T("[ReadTransferData] Read Fail! Addr: %s"), strReadAddress);
|
}
|
|
int nReadSize = 0;
|
CString strTemp = strData;
|
for(int i=0; i<nPCControlReadDataCount; i++)
|
{
|
const SSignalSettingData *pInfo = pSignalInfo->GetReadDataAddress(i);
|
if (pInfo==NULL) continue;
|
|
nReadSize = pInfo->nSize;
|
if(i == nPCControlReadDataCount - 1)
|
{
|
strData = strTemp;
|
}
|
else
|
{
|
strData = strTemp.Left(nReadSize*2);
|
strTemp = strTemp.Mid(nReadSize*2);
|
}
|
|
switch(i)
|
{
|
case B7_GLASS_DATA_LOT_ID:
|
pTransferData->strLotID = strData.TrimRight(_T(" "));
|
break;
|
case B7_GLASS_DATA_GLASS_ID:
|
pTransferData->strGlassID = strData.TrimRight(_T(" "));
|
break;
|
case B7_GLASS_DATA_OPER_ID:
|
pTransferData->strOperID = strData.TrimRight(_T(" "));
|
break;
|
case B7_GLASS_DATA_GLASS_CODE:
|
pTransferData->strGlassCode = strData.TrimRight(_T(" "));
|
break;
|
case B7_GLASS_DATA_PPID:
|
pTransferData->strPPID = strData.TrimRight(_T(" "));
|
break;
|
}
|
}
|
}
|
else
|
{
|
CString strData = _T("");
|
int nReadSize = 0;
|
CString strReadAddress = _T("");
|
int nReadTotalSize = 0;
|
for(int i=0; i<nPCControlReadDataCount; i++)
|
{
|
const SSignalSettingData *pInfo = pSignalInfo->GetReadDataAddress(i);
|
if (pInfo==NULL) continue;
|
|
strReadAddress = pInfo->strAddr;
|
nReadSize = pInfo->nSize;
|
nReadTotalSize += pInfo->nSize;
|
pSignalControl->ReadData(strReadAddress, nReadSize, strData);
|
m_pSP2P->ISP2P_DisplayMessage(_T("[ReadTransferData] Addr: %s, Size: %d, Data: %s"), strReadAddress, nReadTotalSize, strData);
|
|
switch(i)
|
{
|
case B7_GLASS_DATA_LOT_ID:
|
pTransferData->strLotID = strData.TrimRight(_T(" "));
|
break;
|
case B7_GLASS_DATA_GLASS_ID:
|
pTransferData->strGlassID = strData.TrimRight(_T(" "));
|
break;
|
case B7_GLASS_DATA_OPER_ID:
|
pTransferData->strOperID = strData.TrimRight(_T(" "));
|
break;
|
case B7_GLASS_DATA_GLASS_CODE:
|
pTransferData->strGlassCode = strData.TrimRight(_T(" "));
|
break;
|
case B7_GLASS_DATA_PPID:
|
pTransferData->strPPID = strData.TrimRight(_T(" "));
|
break;
|
}
|
}
|
}
|
|
return TRUE;
|
}
|
|
// Align Camera Control command
|
BOOL CSequenceProcessor::AlignCamera_CameraControl(int nControlCmd)
|
{
|
CCameraControlAlign* pAlignCameraControl = m_pSP2P->ISP2P_GetAlignCameraControl();
|
if (pAlignCameraControl==NULL)
|
{
|
return FALSE;
|
}
|
|
return (BOOL) pAlignCameraControl->Camera_Control(nControlCmd);
|
}
|
|
// Review Camera Control Command
|
void CSequenceProcessor::ReviewCamera_CameraControl(int nControlCmd)
|
{
|
int nModuleCount = Module_GetModuleStatusCount();
|
|
for (int nModuleIdx=0; nModuleIdx<nModuleCount; nModuleIdx++)
|
{
|
SCameraControl *pCameraControl = Module_GetCameraControl(nModuleIdx);
|
CCameraControlReview *pReviewCameraControl = ReviewCamera_GetReviewCameraControl(nModuleIdx);
|
|
if (pCameraControl==NULL || pReviewCameraControl==NULL) continue;
|
|
if (pCameraControl->nCameraControl != nControlCmd)
|
{
|
// 현재 카메라상태가 stop가 아니고, 현재 명령이 stop이 아니면..
|
if (pCameraControl->nCameraControl!=CameraControlStop && nControlCmd!=CameraControlStop)
|
{
|
pReviewCameraControl->Camera_Control(CameraControlStop);
|
Sleep(50);
|
}
|
|
pReviewCameraControl->Camera_Control(nControlCmd);
|
|
// 현재 명령이 stop이면.
|
if (nControlCmd==CameraControlStop)
|
{
|
Sleep(50);
|
}
|
|
|
pCameraControl->nCameraControl = nControlCmd;
|
|
m_pSP2P->ISP2P_UpdateCameraControl(nModuleIdx, pCameraControl, NULL);
|
}
|
}
|
}
|
|
BOOL CSequenceProcessor::ReviewCamera_CameraControl(int nModuleIndex, int nControlCmd)
|
{
|
SCameraControl *pCameraControl = Module_GetCameraControl(nModuleIndex);
|
CCameraControlReview *pReviewCameraControl = ReviewCamera_GetReviewCameraControl(nModuleIndex);
|
if (pCameraControl==NULL || pReviewCameraControl==NULL)
|
{
|
return FALSE;
|
}
|
|
if (nControlCmd!=CameraControlStop)
|
{
|
pReviewCameraControl->Camera_Control(CameraControlStop);
|
}
|
|
if(pReviewCameraControl->Camera_Control(nControlCmd))
|
{
|
pCameraControl->nCameraControl = nControlCmd;
|
m_pSP2P->ISP2P_UpdateCameraControl(nModuleIndex, pCameraControl, NULL);
|
return TRUE;
|
}
|
|
return FALSE;
|
}
|
|
int CSequenceProcessor::ReviewCamera_GetReviewCameraControlCount() const
|
{
|
return m_pSP2P->ISP2P_GetReviewCameraControlCount();
|
}
|
|
CCameraControlReview* CSequenceProcessor::ReviewCamera_GetReviewCameraControl(int nModuleIndex)
|
{
|
return m_pSP2P->ISP2P_GetReviewCameraControl(nModuleIndex);
|
}
|
|
// Align Network Command
|
void CSequenceProcessor::AlignNetwork_SendAlignResult(const CGlassResult* pGlassResult)
|
{
|
CAlignServerControl *pAlignServerControl = m_pSP2P->ISP2P_GetAlignServerControl();
|
|
if (pAlignServerControl==NULL)
|
{
|
return;
|
}
|
|
const CAlignRecipe* pRecipe = pGlassResult->GetAlignRecipe();
|
const CAlignResult* pResult = pGlassResult->GetAlignResult();
|
|
// [2016:10:28]-[WEZASW] : Align Result 임시 저장(AOI에서 요청시 전송 예정)
|
// [2017:04:17]-[WEZASW] : B7 Align 보정 점검을 위한 활성화 : 실 검증 필요.
|
pAlignServerControl->SetAlignResult(pRecipe, pResult);
|
pAlignServerControl->SendAlignResult(pRecipe, pResult);
|
}
|
|
// Review Light Control command
|
BOOL CSequenceProcessor::ReviewLight_SetLightStatus(int nModuleIndex, int nValue)
|
{
|
CModuleStatus* pModuelStatus = m_pSP2P->ISP2P_GetModuleStatus(nModuleIndex);
|
if(pModuelStatus == NULL) return FALSE;
|
|
SExternalIndex* pExternalIndex = pModuelStatus->GetExternalIndex();
|
if(pExternalIndex == NULL) return FALSE;
|
|
SCameraControl *pCameraControl = Module_GetCameraControl(nModuleIndex);
|
CLightControl *pLightControl = m_pSP2P->ISP2P_GetReviewLightControl(pExternalIndex->nLight_Index);
|
if (pCameraControl==NULL || pLightControl==NULL) return FALSE;
|
|
if (pCameraControl->nLightStatus!=nValue)
|
{
|
if(pLightControl->SetLightStatus(nValue, pExternalIndex->nLight_Channel))
|
{
|
pCameraControl->nLightStatus = nValue;
|
m_pSP2P->ISP2P_UpdateCameraControl(nModuleIndex, pCameraControl, NULL);
|
return TRUE;
|
}
|
}
|
|
return FALSE;
|
}
|
|
BOOL CSequenceProcessor::ReviewLight_SetLightLevel(int nModuleIndex, int nValue)
|
{
|
CModuleStatus* pModuelStatus = m_pSP2P->ISP2P_GetModuleStatus(nModuleIndex);
|
if(pModuelStatus == NULL) return FALSE;
|
|
SExternalIndex* pExternalIndex = pModuelStatus->GetExternalIndex();
|
if(pExternalIndex == NULL) return FALSE;
|
|
SCameraControl *pCameraControl = Module_GetCameraControl(nModuleIndex);
|
CLightControl *pLightControl = m_pSP2P->ISP2P_GetReviewLightControl(pExternalIndex->nLight_Index);
|
if (pCameraControl==NULL || pLightControl==NULL) return FALSE;
|
|
if (pCameraControl->nLightLevel!=nValue)
|
{
|
if(pLightControl->SetLightLevel(nValue, pExternalIndex->nLight_Channel))
|
{
|
pCameraControl->nLightLevel = nValue;
|
m_pSP2P->ISP2P_UpdateCameraControl(nModuleIndex, pCameraControl, NULL);
|
return TRUE;
|
}
|
}
|
|
return FALSE;
|
}
|
|
BOOL CSequenceProcessor::ReviewLight_GetLightStatus(int nModuleIndex, int& nValue)
|
{
|
CModuleStatus* pModuelStatus = m_pSP2P->ISP2P_GetModuleStatus(nModuleIndex);
|
if(pModuelStatus == NULL) return FALSE;
|
|
SExternalIndex* pExternalIndex = pModuelStatus->GetExternalIndex();
|
if(pExternalIndex == NULL) return FALSE;
|
|
SCameraControl *pCameraControl = Module_GetCameraControl(nModuleIndex);
|
CLightControl *pLightControl = m_pSP2P->ISP2P_GetReviewLightControl(pExternalIndex->nLight_Index);
|
if (pCameraControl==NULL || pLightControl==NULL) return FALSE;
|
|
if(pLightControl->GetLightStatus(nValue, pExternalIndex->nLight_Channel))
|
{
|
pCameraControl->nLightStatus = nValue;
|
return TRUE;
|
}
|
|
return FALSE;
|
}
|
|
BOOL CSequenceProcessor::ReviewLight_GetLightLevel(int nModuleIndex, int& nValue)
|
{
|
CModuleStatus* pModuelStatus = m_pSP2P->ISP2P_GetModuleStatus(nModuleIndex);
|
if(pModuelStatus == NULL) return FALSE;
|
|
SExternalIndex* pExternalIndex = pModuelStatus->GetExternalIndex();
|
if(pExternalIndex == NULL) return FALSE;
|
|
SCameraControl *pCameraControl = Module_GetCameraControl(nModuleIndex);
|
CLightControl *pLightControl = m_pSP2P->ISP2P_GetReviewLightControl(pExternalIndex->nLight_Index);
|
if (pCameraControl==NULL || pLightControl==NULL) return FALSE;
|
|
if(pLightControl->GetLightLevel(nValue, pExternalIndex->nLight_Channel))
|
{
|
pCameraControl->nLightLevel = nValue;
|
return TRUE;
|
}
|
|
return FALSE;
|
}
|
|
// Align Light Control command
|
BOOL CSequenceProcessor::AlignLight_SetLightStatus(int nCameraIndex, int nValue)
|
{
|
CLightControl *pLightControl = m_pSP2P->ISP2P_GetAlignLightControl(nCameraIndex);
|
if (pLightControl==NULL) return FALSE;
|
|
if(pLightControl->SetLightStatus(nValue))
|
{
|
return TRUE;
|
}
|
|
return FALSE;
|
}
|
|
BOOL CSequenceProcessor::AlignLight_SetLightLevel(int nCameraIndex, int nValue)
|
{
|
CLightControl *pLightControl = m_pSP2P->ISP2P_GetAlignLightControl(nCameraIndex);
|
if (pLightControl==NULL) return FALSE;
|
|
if(pLightControl->SetLightLevel(nValue))
|
{
|
return TRUE;
|
}
|
|
return FALSE;
|
}
|
|
BOOL CSequenceProcessor::AlignLight_GetLightStatus(int nCameraIndex, int& nValue)
|
{
|
CLightControl *pLightControl = m_pSP2P->ISP2P_GetAlignLightControl(nCameraIndex);
|
if (pLightControl==NULL) return FALSE;
|
|
if(pLightControl->GetLightStatus(nValue))
|
{
|
return TRUE;
|
}
|
|
return FALSE;
|
}
|
|
BOOL CSequenceProcessor::AlignLight_GetLightLevel(int nCameraIndex, int& nValue)
|
{
|
CLightControl *pLightControl = m_pSP2P->ISP2P_GetAlignLightControl(nCameraIndex);
|
if (pLightControl==NULL) return FALSE;
|
|
if(pLightControl->GetLightLevel(nValue))
|
{
|
return TRUE;
|
}
|
|
return FALSE;
|
}
|
|
// Revolver Control Command
|
BOOL CSequenceProcessor::Revolver_SetRevolverLevel(int nModuleIndex, int nValue)
|
{
|
CModuleStatus* pModuleStatus = m_pSP2P->ISP2P_GetModuleStatus(nModuleIndex);
|
if(pModuleStatus == NULL) return FALSE;
|
|
SExternalIndex* pExternalIndex = pModuleStatus->GetExternalIndex();
|
if(pExternalIndex == NULL) return FALSE;
|
|
// Zoom 변경
|
SCameraControl *pCameraControl = Module_GetCameraControl(nModuleIndex);
|
CLensChangeControl *pRevolverControl = m_pSP2P->ISP2P_GetRevolverControl(pExternalIndex->nRevolver_Index);
|
|
if (pCameraControl==NULL || pRevolverControl==NULL) { return FALSE; }
|
|
if (pCameraControl->nZoomLevel != nValue)
|
{
|
if (pRevolverControl->SetPosition(nValue+1))
|
{
|
pCameraControl->nZoomLevel = nValue;
|
SCameraInfo* pCameraInfo = Module_GetCameraInfo(nModuleIndex, nValue);
|
m_pSP2P->ISP2P_UpdateCameraControl(nModuleIndex, pCameraControl, pCameraInfo);
|
}
|
}
|
|
return TRUE;
|
}
|
|
BOOL CSequenceProcessor::Revolver_GetRevolverLevel(int nModuleIndex, int& nValue)
|
{
|
CModuleStatus* pModuleStatus = m_pSP2P->ISP2P_GetModuleStatus(nModuleIndex);
|
if(pModuleStatus == NULL) return FALSE;
|
|
SExternalIndex* pExternalIndex = pModuleStatus->GetExternalIndex();
|
if(pExternalIndex == NULL) return FALSE;
|
|
// Zoom 변경
|
SCameraControl *pCameraControl = Module_GetCameraControl(nModuleIndex);
|
CLensChangeControl *pRevolverControl = m_pSP2P->ISP2P_GetRevolverControl(pExternalIndex->nRevolver_Index);
|
if (pCameraControl==NULL || pRevolverControl==NULL)
|
{
|
return FALSE;
|
}
|
|
if (pRevolverControl->GetPosition(nValue))
|
{
|
pCameraControl->nZoomLevel = nValue;
|
SCameraInfo* pCameraInfo = Module_GetCameraInfo(nModuleIndex, nValue);
|
m_pSP2P->ISP2P_UpdateCameraControl(nModuleIndex, pCameraControl, pCameraInfo);
|
}
|
|
return TRUE;
|
}
|
|
// AFM Control Command
|
BOOL CSequenceProcessor::AFM_SetAFMRecipeIndex(int nRecipeIndex, int nValue)
|
{
|
BOOL bReturn = TRUE;
|
for (int nModuleIdx=0; nModuleIdx<Module_GetModuleStatusCount(); nModuleIdx++)
|
{
|
bReturn = bReturn & AFM_SetAFMRecipeIndex(nModuleIdx, nRecipeIndex, nValue);
|
}
|
return bReturn;
|
}
|
|
BOOL CSequenceProcessor::AFM_SetAFMRecipeName(const CString& strRecipeName, int nValue)
|
{
|
BOOL bReturn = TRUE;
|
for (int nModuleIdx=0; nModuleIdx<Module_GetModuleStatusCount(); nModuleIdx++)
|
{
|
bReturn = bReturn & AFM_SetAFMRecipeName(nModuleIdx, strRecipeName, nValue);
|
}
|
return bReturn;
|
}
|
|
|
BOOL CSequenceProcessor::AFM_SetAFMZoomLevel(int nValue)
|
{
|
BOOL bReturn = TRUE;
|
for (int nModuleIdx=0; nModuleIdx<Module_GetModuleStatusCount(); nModuleIdx++)
|
{
|
bReturn = bReturn & AFM_SetAFMZoomLevel(nModuleIdx, nValue);
|
}
|
return bReturn;
|
}
|
|
BOOL CSequenceProcessor::AFM_SetAFMTracking(BOOL bValue)
|
{
|
BOOL bReturn = TRUE;
|
for (int nModuleIdx=0; nModuleIdx<Module_GetModuleStatusCount(); nModuleIdx++)
|
{
|
bReturn = bReturn & AFM_SetAFMTracking(nModuleIdx, bValue);
|
}
|
return bReturn;
|
}
|
|
BOOL CSequenceProcessor::AFM_SetAFMJogCommand(int nCmd)
|
{
|
BOOL bReturn = TRUE;
|
for (int nModuleIdx=0; nModuleIdx<Module_GetModuleStatusCount(); nModuleIdx++)
|
{
|
bReturn = bReturn & AFM_SetAFMJogCommand(nModuleIdx, nCmd);
|
}
|
return bReturn;
|
}
|
|
BOOL CSequenceProcessor::AFM_SetAFMJogSpeed(double dSpeed)
|
{
|
BOOL bReturn = TRUE;
|
for (int nModuleIdx=0; nModuleIdx<Module_GetModuleStatusCount(); nModuleIdx++)
|
{
|
bReturn = bReturn & AFM_SetAFMJogSpeed(nModuleIdx, dSpeed);
|
}
|
return bReturn;
|
}
|
|
BOOL CSequenceProcessor::AFM_SetAFMJogCommand(int nModuleIndex, int nCmd)
|
{
|
CModuleStatus* pModuleStatus = m_pSP2P->ISP2P_GetModuleStatus(nModuleIndex);
|
if(pModuleStatus == NULL) return FALSE;
|
|
SExternalIndex* pExternalIndex = pModuleStatus->GetExternalIndex();
|
if(pExternalIndex == NULL) return FALSE;
|
|
// camera control 변경
|
SCameraControl *pCameraControl = Module_GetCameraControl(nModuleIndex);
|
CAfmControl *pAFMControl = m_pSP2P->ISP2P_GetAFMControl(pExternalIndex->nAFM_Index);
|
if (pCameraControl==NULL || pAFMControl==NULL)
|
{
|
return FALSE;
|
}
|
|
if (pAFMControl->RecipeJogCommand(nCmd)==FALSE)
|
{
|
return FALSE;
|
}
|
|
return TRUE;
|
}
|
|
BOOL CSequenceProcessor::AFM_SetAFMJogSpeed(int nModuleIndex, double dSpeed)
|
{
|
CModuleStatus* pModuleStatus = m_pSP2P->ISP2P_GetModuleStatus(nModuleIndex);
|
if(pModuleStatus == NULL) return FALSE;
|
|
SExternalIndex* pExternalIndex = pModuleStatus->GetExternalIndex();
|
if(pExternalIndex == NULL) return FALSE;
|
|
// camera control 변경
|
SCameraControl *pCameraControl = Module_GetCameraControl(nModuleIndex);
|
CAfmControl *pAFMControl = m_pSP2P->ISP2P_GetAFMControl(pExternalIndex->nAFM_Index);
|
if (pCameraControl==NULL || pAFMControl==NULL)
|
{
|
return FALSE;
|
}
|
|
if (pAFMControl->RecipeJogSpeed(dSpeed)==FALSE)
|
{
|
return FALSE;
|
}
|
|
return TRUE;
|
}
|
|
BOOL CSequenceProcessor::AFM_SetAFMRecipeIndex(int nModuleIndex, int nRecipeIndex, int nValue)
|
{
|
CModuleStatus* pModuleStatus = m_pSP2P->ISP2P_GetModuleStatus(nModuleIndex);
|
if(pModuleStatus == NULL) return FALSE;
|
|
SExternalIndex* pExternalIndex = pModuleStatus->GetExternalIndex();
|
if(pExternalIndex == NULL) return FALSE;
|
|
// camera control 변경
|
SCameraControl *pCameraControl = Module_GetCameraControl(nModuleIndex);
|
CAfmControl *pAFMControl = m_pSP2P->ISP2P_GetAFMControl(pExternalIndex->nAFM_Index);
|
if (pCameraControl==NULL || pAFMControl==NULL)
|
{
|
return FALSE;
|
}
|
|
if (pAFMControl->SetRecipeIndex(nRecipeIndex, nValue)==FALSE)
|
{
|
return FALSE;
|
}
|
|
pCameraControl->nAFMRecipe = nRecipeIndex;
|
pCameraControl->nAFMLevel = nValue;
|
SCameraInfo* pCameraInfo = Module_GetCameraInfo(nModuleIndex, nValue);
|
|
m_pSP2P->ISP2P_UpdateCameraControl(nModuleIndex, pCameraControl, pCameraInfo);
|
|
return TRUE;
|
}
|
|
BOOL CSequenceProcessor::AFM_GetAFMRecipeIndex(int nModuleIndex, int& nRecipeIndex, int& nValue)
|
{
|
CModuleStatus* pModuleStatus = m_pSP2P->ISP2P_GetModuleStatus(nModuleIndex);
|
if(pModuleStatus == NULL) return FALSE;
|
|
SExternalIndex* pExternalIndex = pModuleStatus->GetExternalIndex();
|
if(pExternalIndex == NULL) return FALSE;
|
|
SCameraControl *pCameraControl = Module_GetCameraControl(nModuleIndex);
|
CAfmControl *pAFMControl = m_pSP2P->ISP2P_GetAFMControl(pExternalIndex->nAFM_Index);
|
if (pCameraControl==NULL || pAFMControl==NULL)
|
{
|
return FALSE;
|
}
|
|
if (pAFMControl->GetRecipeIndex(nRecipeIndex, nValue)==FALSE)
|
{
|
return FALSE;
|
}
|
|
pCameraControl->nAFMRecipe = nRecipeIndex;
|
pCameraControl->nAFMLevel = nValue;
|
SCameraInfo* pCameraInfo = Module_GetCameraInfo(nModuleIndex, nValue);
|
m_pSP2P->ISP2P_UpdateCameraControl(nModuleIndex, pCameraControl, pCameraInfo);
|
|
return TRUE;
|
}
|
|
BOOL CSequenceProcessor::AFM_SetAFMRecipeName(int nModuleIndex, const CString& strRecipeName, int nValue)
|
{
|
CModuleStatus* pModuleStatus = m_pSP2P->ISP2P_GetModuleStatus(nModuleIndex);
|
if(pModuleStatus == NULL) return FALSE;
|
|
SExternalIndex* pExternalIndex = pModuleStatus->GetExternalIndex();
|
if(pExternalIndex == NULL) return FALSE;
|
|
SCameraControl *pCameraControl = Module_GetCameraControl(nModuleIndex);
|
CAfmControl *pAFMControl = m_pSP2P->ISP2P_GetAFMControl(pExternalIndex->nAFM_Index);
|
|
if (pCameraControl==NULL || pAFMControl==NULL) { return FALSE; }
|
if (pAFMControl->SetRecipeName(strRecipeName, nValue)==FALSE) { return FALSE; }
|
|
pCameraControl->strAFMRecipe = strRecipeName;
|
pCameraControl->nAFMLevel = nValue;
|
SCameraInfo* pCameraInfo = Module_GetCameraInfo(nModuleIndex, nValue);
|
m_pSP2P->ISP2P_UpdateCameraControl(nModuleIndex, pCameraControl, pCameraInfo);
|
|
return TRUE;
|
}
|
|
BOOL CSequenceProcessor::AFM_GetAFMRecipeName(int nModuleIndex, CString& strRecipeName, int& nValue)
|
{
|
CModuleStatus* pModuleStatus = m_pSP2P->ISP2P_GetModuleStatus(nModuleIndex);
|
if(pModuleStatus == NULL) return FALSE;
|
|
SExternalIndex* pExternalIndex = pModuleStatus->GetExternalIndex();
|
if(pExternalIndex == NULL) return FALSE;
|
|
SCameraControl *pCameraControl = Module_GetCameraControl(nModuleIndex);
|
CAfmControl *pAFMControl = m_pSP2P->ISP2P_GetAFMControl(pExternalIndex->nAFM_Index);
|
if (pCameraControl==NULL || pAFMControl==NULL)
|
{
|
return FALSE;
|
}
|
|
if (pAFMControl->GetRecipeName(strRecipeName, nValue)==FALSE)
|
{
|
return FALSE;
|
}
|
|
pCameraControl->strAFMRecipe = strRecipeName;
|
pCameraControl->nAFMLevel = nValue;
|
SCameraInfo* pCameraInfo = Module_GetCameraInfo(nModuleIndex, nValue);
|
m_pSP2P->ISP2P_UpdateCameraControl(nModuleIndex, pCameraControl, pCameraInfo);
|
|
return TRUE;
|
}
|
|
BOOL CSequenceProcessor::AFM_SetAFMZoomLevel(int nModuleIndex, int nValue)
|
{
|
CModuleStatus* pModuleStatus = m_pSP2P->ISP2P_GetModuleStatus(nModuleIndex);
|
if(pModuleStatus == NULL) return FALSE;
|
|
SExternalIndex* pExternalIndex = pModuleStatus->GetExternalIndex();
|
if(pExternalIndex == NULL) return FALSE;
|
|
SCameraControl *pCameraControl = Module_GetCameraControl(nModuleIndex);
|
CAfmControl *pAFMControl = m_pSP2P->ISP2P_GetAFMControl(pExternalIndex->nAFM_Index);
|
if (pCameraControl==NULL || pAFMControl==NULL)
|
{
|
return FALSE;
|
}
|
|
if (pCameraControl->nAFMLevel != nValue)
|
{
|
if (pAFMControl->SetZoomIndex(nValue)==FALSE)
|
{
|
return FALSE;
|
}
|
|
pCameraControl->nAFMLevel = nValue;
|
SCameraInfo* pCameraInfo = Module_GetCameraInfo(nModuleIndex, nValue);
|
m_pSP2P->ISP2P_UpdateCameraControl(nModuleIndex, pCameraControl, pCameraInfo);
|
}
|
|
return FALSE;
|
}
|
|
BOOL CSequenceProcessor::AFM_GetAFMZoomLevel(int nModuleIndex, int& nValue)
|
{
|
CModuleStatus* pModuleStatus = m_pSP2P->ISP2P_GetModuleStatus(nModuleIndex);
|
if(pModuleStatus == NULL) return FALSE;
|
|
SExternalIndex* pExternalIndex = pModuleStatus->GetExternalIndex();
|
if(pExternalIndex == NULL) return FALSE;
|
|
SCameraControl *pCameraControl = Module_GetCameraControl(nModuleIndex);
|
CAfmControl *pAFMControl = m_pSP2P->ISP2P_GetAFMControl(pExternalIndex->nAFM_Index);
|
if (pCameraControl==NULL || pAFMControl==NULL)
|
{
|
return FALSE;
|
}
|
|
if (pAFMControl->GetZoomIndex(nValue)==FALSE)
|
{
|
return FALSE;
|
}
|
|
pCameraControl->nAFMLevel = nValue;
|
SCameraInfo* pCameraInfo = Module_GetCameraInfo(nModuleIndex, nValue);
|
m_pSP2P->ISP2P_UpdateCameraControl(nModuleIndex, pCameraControl, pCameraInfo);
|
|
return TRUE;
|
}
|
|
BOOL CSequenceProcessor::AFM_SetAFMTracking(int nModuleIndex, BOOL bValue)
|
{
|
CModuleStatus* pModuleStatus = m_pSP2P->ISP2P_GetModuleStatus(nModuleIndex);
|
if(pModuleStatus == NULL) return FALSE;
|
|
SExternalIndex* pExternalIndex = pModuleStatus->GetExternalIndex();
|
if(pExternalIndex == NULL) return FALSE;
|
|
SCameraControl *pCameraControl = Module_GetCameraControl(nModuleIndex);
|
CAfmControl *pAFMControl = m_pSP2P->ISP2P_GetAFMControl(pExternalIndex->nAFM_Index);
|
if (pCameraControl==NULL || pAFMControl==NULL)
|
{
|
return FALSE;
|
}
|
|
if (pCameraControl->bAFMTracking != bValue)
|
{
|
if (pAFMControl->SetTracking(bValue))
|
{
|
pCameraControl->bAFMTracking = bValue;
|
m_pSP2P->ISP2P_UpdateCameraControl(nModuleIndex, pCameraControl, NULL);
|
}
|
else
|
{
|
m_pSP2P->ISP2P_UpdateCameraControl(nModuleIndex, pCameraControl, NULL);
|
return FALSE;
|
}
|
}
|
|
return TRUE;
|
}
|
|
BOOL CSequenceProcessor::AFM_GetAFMTracking(int nModuleIndex, BOOL& bValue)
|
{
|
CModuleStatus* pModuleStatus = m_pSP2P->ISP2P_GetModuleStatus(nModuleIndex);
|
if(pModuleStatus == NULL) return FALSE;
|
|
SExternalIndex* pExternalIndex = pModuleStatus->GetExternalIndex();
|
if(pExternalIndex == NULL) return FALSE;
|
|
SCameraControl *pCameraControl = Module_GetCameraControl(nModuleIndex);
|
CAfmControl *pAFMControl = m_pSP2P->ISP2P_GetAFMControl(pExternalIndex->nAFM_Index);
|
if (pCameraControl==NULL || pAFMControl==NULL)
|
{
|
return FALSE;
|
}
|
|
int nValue = 0;
|
if (pAFMControl->GetTracking(nValue))
|
{
|
pCameraControl->bAFMTracking = bValue = (BOOL)nValue;
|
m_pSP2P->ISP2P_UpdateCameraControl(nModuleIndex, pCameraControl, NULL);
|
}
|
|
return TRUE;
|
}
|
|
BOOL CSequenceProcessor::WSI_SetWSIEnd()
|
{
|
BOOL bReturn = TRUE;
|
for (int i=0; i<Module_GetModuleStatusCount(); i++)
|
{
|
bReturn = bReturn & WSI_SetWSIEnd(i);
|
}
|
return bReturn;
|
}
|
|
BOOL CSequenceProcessor::WSI_SetWSITimeOver()
|
{
|
BOOL bReturn = TRUE;
|
for (int i=0; i<Module_GetModuleStatusCount(); i++)
|
{
|
bReturn = bReturn & WSI_SetWSITimeOver(i);
|
}
|
return bReturn;
|
}
|
|
BOOL CSequenceProcessor::WSI_SetWSIEnd(int nModuleIndex)
|
{
|
CModuleStatus* pModuleStatus = m_pSP2P->ISP2P_GetModuleStatus(nModuleIndex);
|
if(pModuleStatus == NULL) return FALSE;
|
|
SExternalIndex* pExternalIndex = pModuleStatus->GetExternalIndex();
|
if(pExternalIndex == NULL) return FALSE;
|
|
if (nModuleIndex<0 || nModuleIndex>=Module_GetModuleStatusCount())
|
{
|
return FALSE;
|
}
|
|
CWsiControl *pWSIControl = m_pSP2P->ISP2P_GetWSIControl(pExternalIndex->nWSI_Index);
|
if (pWSIControl==NULL) return FALSE;
|
|
return pWSIControl->SetWsiEnd();
|
}
|
|
BOOL CSequenceProcessor::WSI_SetWSITimeOver(int nModuleIndex)
|
{
|
CModuleStatus* pModuleStatus = m_pSP2P->ISP2P_GetModuleStatus(0);
|
if(pModuleStatus == NULL) return FALSE;
|
|
SExternalIndex* pExternalIndex = pModuleStatus->GetExternalIndex();
|
if(pExternalIndex == NULL) return FALSE;
|
|
if (nModuleIndex<0 || nModuleIndex>=Module_GetModuleStatusCount())
|
{
|
return FALSE;
|
}
|
|
CWsiControl *pWSIControl = m_pSP2P->ISP2P_GetWSIControl(pExternalIndex->nWSI_Index);
|
if (pWSIControl==NULL) return FALSE;
|
|
return pWSIControl->SetWsiTimeOver();
|
}
|
|
//////////////////////////////////////////////////////////////////////////
|
BOOL CSequenceProcessor::WSI_WSIManualReady()
|
{
|
CGlassResult* pGlassResult = m_pSP2P->ISP2P_GetCurrentGlassResult();
|
if(pGlassResult == NULL) return FALSE;
|
|
CRsRcpReviewInfo* pRsRcpReviewInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo();
|
if (pRsRcpReviewInfo==NULL) return FALSE;
|
|
int nWsiControlCount = m_pSP2P->ISP2P_GetWSIControlCount();
|
|
for(int nWsiControlIdx = 0; nWsiControlIdx < nWsiControlCount; nWsiControlIdx++)
|
{
|
CWsiControl* pWsiControl = m_pSP2P->ISP2P_GetWSIControl(nWsiControlIdx);
|
if(pWsiControl == NULL) continue ;
|
|
CRcpAFMRecipeInfo *pRcpAFMInfo = pRsRcpReviewInfo->GetRcpWsiAFMRecipeInfo(nWsiControlIdx);
|
if(pRcpAFMInfo == NULL) continue ;
|
|
// [2017:6:2]-[WEZASW] : WSI의 AFM 배율 별도 관리(Review RecipeEditor의 배율 Index와 AFM의 배율 Idex는 실제 확인 필요)
|
// pGlassResult->GetGlassID() -> pGlassResult->GetJobID()
|
pWsiControl->SetWsiReady(*pGlassResult->GetJobID(), *pGlassResult->GetRecipeID(), pRcpAFMInfo->m_nZoomIndex); // Manual Mode
|
|
}
|
|
return true;
|
}
|
|
BOOL CSequenceProcessor::WSI_WSIManualStart(int nDefectPosX, int nDefectPosY, int nDefectgPosX, int nDefectgPosY)
|
{
|
BOOL bWSIStart = FALSE;
|
|
CGlassResult* pGlassResult = m_pSP2P->ISP2P_GetCurrentGlassResult();
|
|
int nWsiControlCount = m_pSP2P->ISP2P_GetWSIControlCount();
|
|
const CCoordCalibrator* pCoordCalibrator = m_pSP2P->ISP2P_GetCoordCalibrator();
|
if (pCoordCalibrator == NULL) return -3;
|
|
// get direction
|
int nDirectionX, nDirectionY;
|
pCoordCalibrator->GetTransDirection(nDirectionX, nDirectionY);
|
|
for(int nWsiControlIdx = 0; nWsiControlIdx < nWsiControlCount; nWsiControlIdx++)
|
{
|
CWsiControl* pWsiControl = m_pSP2P->ISP2P_GetWSIControl(nWsiControlIdx);
|
if(pWsiControl == NULL) continue ;
|
|
// WSI result count
|
for (int nModuleIdx=0; nModuleIdx<Module_GetModuleStatusCount(); nModuleIdx++)
|
{
|
CReviewResult* pWsiResult = pGlassResult->GetWsiResult(nModuleIdx);
|
if(pWsiResult == NULL) continue ;
|
const SCoordInfo* pCoordInfo = Module_GetCoordInfo(nModuleIdx);
|
if (pCoordInfo==NULL) continue;
|
CModuleStatus* pModuleStatus = Module_GetModuleStatus(nModuleIdx);
|
if (pModuleStatus == NULL) continue;
|
|
int nDefectCount = 1;
|
|
// get wsi pos
|
double dDefectmPosX, dDefectmPosY;
|
VectorDouble vectormPosX, vectormPosY;
|
|
double dDefectgPosX, dDefectgPosY;
|
VectorDouble vectorgPosX, vectorgPosY;
|
|
// set defect pos
|
//dDefectPosX = double(pWsi->nUMOriginX) / 1000.0;
|
//dDefectPosY = double(pWsi->nUMOriginY) / 1000.0;
|
|
dDefectmPosX = double(nDefectPosX) / 1000.0;
|
dDefectmPosY = double(nDefectPosY) / 1000.0;
|
|
dDefectgPosX = double(nDefectgPosX) / 1000.0;
|
dDefectgPosY = double(nDefectgPosY) / 1000.0;
|
|
|
// trans glass to motor pos
|
pCoordCalibrator->TransGlass2Motor(pCoordInfo, dDefectmPosX, dDefectmPosY);
|
|
// set offset
|
ApplyMotorOffset(0, -1, MotorOffsetCamera + MotorOffsetWSI +MotorOffset_Glass, dDefectmPosX, dDefectmPosY);
|
|
// motor calibrate
|
CalibrateMotorPos(0, dDefectmPosX, dDefectmPosY);
|
|
vectormPosX.push_back(dDefectmPosY);
|
vectormPosY.push_back(dDefectmPosY);
|
|
vectorgPosX.push_back(dDefectgPosY);
|
vectorgPosY.push_back(dDefectgPosY);
|
|
// [2016:11:18]-[WEZASW] : 전달 항목 수정 => nModuleIndex, nDefectCount, nDefectIndex ( n+0), nUMOriginX ( n+1), nUMOriginY ( n+2)
|
//bWSIStart = pWsiControl->SetWsiStart(nDefectCount, vectormPosX, vectormPosY, vectorgPosX, vectorgPosY);
|
}
|
}
|
return bWSIStart;
|
}
|
|
// getter module status
|
int CSequenceProcessor::Module_GetModuleStatusCount(int nModuleType) const
|
{
|
return m_pSP2P->ISP2P_GetModuleStatusCount(nModuleType);
|
}
|
|
CModuleStatus* CSequenceProcessor::Module_GetModuleStatus(int nModuleIdx)
|
{
|
return m_pSP2P->ISP2P_GetModuleStatus(nModuleIdx);
|
}
|
|
SCameraControl* CSequenceProcessor::Module_GetCameraControl(int nModuleIdx)
|
{
|
CModuleStatus *pModuleStatus = Module_GetModuleStatus(nModuleIdx);
|
if (pModuleStatus==NULL) return NULL;
|
return pModuleStatus->GetCameraControl();
|
}
|
|
SMotorPosition* CSequenceProcessor::Module_GetMotorPosition(int nModuleIdx)
|
{
|
CModuleStatus *pModuleStatus = Module_GetModuleStatus(nModuleIdx);
|
if (pModuleStatus==NULL) return NULL;
|
return pModuleStatus->GetMotorPosition();
|
}
|
|
SMotorStatus* CSequenceProcessor::Module_GetMotorStatus(int nModuleIdx)
|
{
|
CModuleStatus *pModuleStatus = Module_GetModuleStatus(nModuleIdx);
|
if (pModuleStatus==NULL) return NULL;
|
return pModuleStatus->GetMotorStatus();
|
}
|
|
SAxisIndex* CSequenceProcessor::Module_GetAxisIndex(int nModuleIdx)
|
{
|
CModuleStatus *pModuleStatus = Module_GetModuleStatus(nModuleIdx);
|
if (pModuleStatus==NULL) return NULL;
|
return pModuleStatus->GetAxisIndex();
|
}
|
|
SCoordInfo* CSequenceProcessor::Module_GetCoordInfo(int nModuleIdx)
|
{
|
CModuleStatus *pModuleStatus = Module_GetModuleStatus(nModuleIdx);
|
if (pModuleStatus==NULL) return NULL;
|
return pModuleStatus->GetCoordInfo();
|
}
|
|
SCameraInfo* CSequenceProcessor::Module_GetCurrentCameraInfo(int nModuleIdx)
|
{
|
CModuleStatus *pModuleStatus = Module_GetModuleStatus(nModuleIdx);
|
if (pModuleStatus==NULL) return NULL;
|
return pModuleStatus->GetCurrentCameraInfo();
|
}
|
|
SCameraInfo* CSequenceProcessor::Module_GetCameraInfo(int nModuleIdx, int nZoomIdx)
|
{
|
CModuleStatus *pModuleStatus = Module_GetModuleStatus(nModuleIdx);
|
if (pModuleStatus==NULL) return NULL;
|
return pModuleStatus->GetCameraInfo(nZoomIdx);
|
}
|
|
void CSequenceProcessor::GetRangeName(int nRangeIdx, SRangePoint* pRange)
|
{
|
if (pRange == NULL) return;
|
|
if (nRangeIdx == Range_Left)
|
pRange->strName.Format(_T("Left"));
|
else if (nRangeIdx == Range_Middle)
|
pRange->strName.Format(_T("Middle"));
|
else if (nRangeIdx == Range_Right)
|
pRange->strName.Format(_T("Right"));
|
}
|
|
void CSequenceProcessor::GetRangeSize(int nRangeIdx, SRangePoint* pRange)
|
{
|
const CSystemInfo* pSystemInfo = m_pSP2P->ISP2P_System_GetSystemInfo();
|
if (pSystemInfo == NULL) return;
|
|
STransferData* pTransferData = m_pSP2P->ISP2P_GetCurrentTransferData();
|
if (pTransferData==NULL) return;
|
|
const CGlassTypeInfo* pGlassTypeInfo = m_pSP2P->ISP2P_System_GetGlassTypeInfo(_ttoi(pTransferData->strGlassScanSchedule));
|
if (pGlassTypeInfo==NULL) return;
|
|
int nRangeSizeLeft=0, nRangeSizeMid=0, nRangeSizeRight=0;
|
|
nRangeSizeLeft = int((pGlassTypeInfo->m_nGlassSizeX)*1000 * RANGE_RATE - int(pSystemInfo->m_dCollisionDistance)*1000);
|
nRangeSizeMid = int(pSystemInfo->m_dCollisionDistance)*1000;
|
nRangeSizeRight = (pGlassTypeInfo->m_nGlassSizeX)*1000 - nRangeSizeLeft - nRangeSizeMid;
|
|
if (nRangeIdx == Range_Left)
|
pRange->nSizeX = nRangeSizeLeft;
|
else if (nRangeIdx == Range_Middle)
|
pRange->nSizeX = nRangeSizeMid;
|
else if (nRangeIdx == Range_Right)
|
pRange->nSizeX = nRangeSizeRight;
|
|
pRange->nSizeY = (pGlassTypeInfo->m_nGlassSizeY)*1000;
|
}
|
|
void CSequenceProcessor::GetRangeStartEnd(CRcpSchedulingInfo* pScheduleInfo)
|
{
|
if (pScheduleInfo == NULL) return;
|
|
// glasstype info
|
const CSystemInfo* pSystemInfo = m_pSP2P->ISP2P_System_GetSystemInfo();
|
STransferData* pTransferData = m_pSP2P->ISP2P_GetCurrentTransferData();
|
if (pSystemInfo==NULL || pTransferData==NULL) return;
|
|
const CGlassTypeInfo* pGlassTypeInfo = m_pSP2P->ISP2P_System_GetGlassTypeInfo(_ttoi(pTransferData->strGlassScanSchedule));
|
if (pGlassTypeInfo==NULL) return;
|
|
// range size info
|
int nLeftSize=0, nMidSize=0, nRightSize=0;
|
for (int nIdx=0; nIdx<Range_Count; nIdx++)
|
{
|
SRangePoint* pRange = pScheduleInfo->GetRangePointInfo(nIdx);
|
if (pRange == NULL) continue;
|
|
if (nIdx == Range_Left)
|
nLeftSize = pRange->nSizeX;
|
else if (nIdx == Range_Middle)
|
nMidSize = pRange->nSizeX;
|
else if (nIdx == Range_Right)
|
nRightSize = pRange->nSizeX;
|
}
|
|
// cal range start,end
|
CRect rtRangeLeft(0, 0, 0, 0), rtRangeMid(0, 0, 0, 0), rtRangeRight(0, 0, 0, 0);
|
switch(pGlassTypeInfo->m_nOriginDirection)
|
{
|
case 0: // left top
|
case 2: // left bottom
|
rtRangeLeft.left = 0;
|
rtRangeLeft.right = nLeftSize;
|
rtRangeMid.left = rtRangeLeft.right;
|
rtRangeMid.right = rtRangeLeft.right + int(pSystemInfo->m_dCollisionDistance)*1000;
|
rtRangeRight.left = rtRangeMid.right;
|
rtRangeRight.right = pGlassTypeInfo->m_nGlassSizeX*1000;
|
break;
|
|
case 1: // right top
|
case 3: // right bottom
|
rtRangeLeft.left = pGlassTypeInfo->m_nGlassSizeX*1000;
|
rtRangeLeft.right = rtRangeLeft.left - nLeftSize;
|
rtRangeMid.left = rtRangeLeft.right;
|
rtRangeMid.right = rtRangeLeft.right - int(pSystemInfo->m_dCollisionDistance)*1000;
|
rtRangeRight.left = rtRangeMid.right;
|
rtRangeRight.right = 0;
|
break;
|
}
|
|
// set range start x,y
|
for (int nIdx=0; nIdx<Range_Count; nIdx++)
|
{
|
SRangePoint* pRange = pScheduleInfo->GetRangePointInfo(nIdx);
|
if (pRange == NULL) continue;
|
|
if (nIdx == Range_Left)
|
{
|
pRange->nStartX = rtRangeLeft.left<rtRangeLeft.right ? rtRangeLeft.left : rtRangeLeft.right;
|
pRange->nStartY = 0;
|
}
|
else if (nIdx == Range_Middle)
|
{
|
pRange->nStartX = rtRangeMid.left<rtRangeMid.right ? rtRangeMid.left : rtRangeMid.right;
|
pRange->nStartY = 0;
|
|
// set range order
|
pRange->nRangeOrder = 1;
|
}
|
else if (nIdx == Range_Right)
|
{
|
pRange->nStartX = rtRangeRight.left<rtRangeRight.right ? rtRangeRight.left : rtRangeRight.right;
|
pRange->nStartY = 0;
|
}
|
}
|
}
|
|
|
BOOL CSequenceProcessor::SendSignalReviewAlive(long alive)
|
{
|
CSignalControl* pSignalControl = m_pSP2P->ISP2P_GetSignalControl();
|
|
if (pSignalControl==NULL) return FALSE;
|
|
if (pSignalControl->IsConnected() == FALSE) return FALSE;
|
|
if (pSignalControl->Write_SendSignal(0, 0, int(alive)) != TRUE)
|
{
|
m_pSP2P->ISP2P_DisplayMessage(_T("[PCControl_Send] Send Fail! "));
|
return FALSE;
|
}
|
|
return TRUE;
|
}
|
|
BOOL CSequenceProcessor::PCControl_SendAFMAlarmSignal()
|
{
|
g_pLog->DisplayMessage(_T("[SequenceProcessor] PCControl_SendAFMAlarmSignal IN"));
|
|
// Align Alarm 시그널 발생.
|
SendCIMSignalToSignalControl(PCControlSend_D2320, PCControlSend_AlignAlarm);
|
|
g_pLog->DisplayMessage(_T("[SequenceProcessor] PCControl_SendAFMAlarmSignal OUT"));
|
return TRUE;
|
}
|
|
BOOL CSequenceProcessor::ReadAOIMemory( CGlassResult *pGlassResult )
|
{
|
if(m_pSP2P == NULL) return FALSE;
|
|
return m_pSP2P->ISP2P_ReadAOIResultMemory();
|
}
|
|
BOOL CSequenceProcessor::ReadAOIMemory2(CGlassResult *pGlassResult)
|
{
|
if (m_pSP2P == NULL) return FALSE;
|
|
return m_pSP2P->ISP2P_ReadAOIResultMemory2(pGlassResult);
|
}
|
|
int CSequenceProcessor::FirstReviewPlanStart()
|
{
|
CGlassResult *pGlassResult = m_pSP2P->ISP2P_GetCurrentGlassResult();
|
if (pGlassResult==NULL) return 0;
|
|
// get recipe
|
CRsRcpReviewInfo* pRsRcpReviewInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo();
|
if(pRsRcpReviewInfo == NULL) return 0;
|
|
int nTotalCount = 0;
|
BOOL bExcute = FALSE;
|
int nPlanCount = pRsRcpReviewInfo->GetRcpPlanInfoCount();
|
for (int nPlanIdx=0; nPlanIdx<nPlanCount; nPlanIdx++)
|
{
|
CRcpPlanInfo *pPlanInfo = pRsRcpReviewInfo->GetRcpPlanInfo(nPlanIdx);
|
if(pPlanInfo == NULL) continue;
|
|
// plan motion
|
switch(pPlanInfo->m_nReviewType)
|
{
|
case PlanReview:
|
if (( nTotalCount += pGlassResult->GetTotalSReviewResultCount()) > 0)
|
{
|
m_pSP2P->ISP2P_GetReviewProcessor()->ResetGantryDone();
|
m_pSP2P->ISP2P_DisplayMessage(_T("[Sequence Processor] Review Plan Start!"));
|
bExcute = ReviewStartProcessing(pGlassResult, nPlanIdx);
|
m_pSP2P->ISP2P_DisplayMessage(_T("[Sequence Processor] Review Plan End!"));
|
}
|
break;
|
|
case PlanUser:
|
if (( nTotalCount += pGlassResult->GetTotalSUserResultCount()) > 0)
|
{
|
m_pSP2P->ISP2P_GetReviewProcessor()->ResetGantryDone();
|
m_pSP2P->ISP2P_DisplayMessage(_T("[Sequence Processor] User Plan Start!"));
|
bExcute = UserStartProcessing(pGlassResult, nPlanIdx);
|
m_pSP2P->ISP2P_DisplayMessage(_T("[Sequence Processor] User Plan End!"));
|
}
|
break;
|
|
case PlanWSI:
|
if (( nTotalCount += pGlassResult->GetTotalSWsiResultCount()) > 0)
|
{
|
m_pSP2P->ISP2P_GetReviewProcessor()->ResetGantryDone();
|
m_pSP2P->ISP2P_DisplayMessage(_T("[Sequence Processor] WSI Plan Start!"));
|
bExcute = WsiStartProcessing(pGlassResult, nPlanIdx);
|
m_pSP2P->ISP2P_DisplayMessage(_T("[Sequence Processor] WSI Plan End!"));
|
}
|
break;
|
// 미사용
|
case PlanMeasure:
|
if ((nTotalCount += pGlassResult->GetTotalSMeasureResultCount()) > 0)
|
{
|
m_pSP2P->ISP2P_DisplayMessage(_T("[Sequence Processor] Measure Plan Start!"));
|
bExcute = MeasureStartProcessing(pGlassResult, nPlanIdx);
|
m_pSP2P->ISP2P_DisplayMessage(_T("[Sequence Processor] Measure Plan End!"));
|
}
|
break;
|
|
case PlanReflow:
|
{
|
if (( nTotalCount += pGlassResult->GetTotalSReflowResultCount()) > 0)
|
{
|
m_pSP2P->ISP2P_DisplayMessage(_T("[Sequence Processor] Reflow Plan Start!"));
|
bExcute = ReflowStartProcessing(pGlassResult, nPlanIdx);
|
m_pSP2P->ISP2P_DisplayMessage(_T("[Sequence Processor] Reflow Plan End!"));
|
}
|
}
|
break;
|
case PlanWsiReflow:
|
{
|
if (( nTotalCount += pGlassResult->GetTotalSWsiReflowResultCount()) > 0)
|
{
|
m_pSP2P->ISP2P_DisplayMessage(_T("[Sequence Processor] WsiReflow Plan Start!"));
|
bExcute = WsiReflowStartProcessing(pGlassResult, nPlanIdx);
|
m_pSP2P->ISP2P_DisplayMessage(_T("[Sequence Processor] WsiReflow Plan End!"));
|
}
|
}
|
break;
|
|
case PlanWsiUser:
|
{
|
if (( nTotalCount += pGlassResult->GetTotalSWsiUserResultCount()) > 0)
|
{
|
m_pSP2P->ISP2P_DisplayMessage(_T("[Sequence Processor] WsiUser Plan Start!"));
|
bExcute = WsiUserStartProcessing(pGlassResult, nPlanIdx);
|
m_pSP2P->ISP2P_DisplayMessage(_T("[Sequence Processor] WsiUser Plan End!"));
|
}
|
}
|
break;
|
case PlanWsiMultiShot:
|
{
|
//200520 수정 사항
|
//거대결함에 대한 카운트를 만들어줘야됨
|
if ((nTotalCount += pGlassResult->GetWsiMultiShotResultCount()) > 0)
|
{
|
m_pSP2P->ISP2P_DisplayMessage(_T("[Sequence Processor] WsiMultishot Plan Start!"));
|
bExcute = WsiMultiShotStartProcessing(pGlassResult, nPlanIdx);
|
m_pSP2P->ISP2P_DisplayMessage(_T("[Sequence Processor] WsiMultishot Plan End!"));
|
}
|
}
|
break;
|
|
|
}
|
if (nTotalCount>0) break;
|
}
|
return nTotalCount;
|
}
|
|
int CSequenceProcessor::CalculatePlanData( CGlassResult* pGlassResult )
|
{
|
if(m_pSP2P == NULL) return FALSE;
|
|
CRsRcpReviewInfo* pRsRcpReviewInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo();
|
CRsRcpMeasureInfo* pRsRcpMeasureInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpMeasureInfo();
|
CPrioritySorter* pPrioritySorter = m_pSP2P->ISP2P_GetPrioritySorter();
|
CDefectPicker* pDefectPicker = m_pSP2P->ISP2P_GetDefectPicker();
|
|
if (pRsRcpReviewInfo == NULL && pRsRcpMeasureInfo == NULL && pPrioritySorter == NULL && pDefectPicker == NULL) return FALSE;
|
|
int nTotalCount = 0;
|
|
// review defect filtering & sorting
|
int nFilterSortingCount = 0;
|
nFilterSortingCount = pPrioritySorter->FilteringAndSorting(pGlassResult, pRsRcpReviewInfo, pRsRcpMeasureInfo, TRUE);
|
m_pSP2P->ISP2P_DisplayMessage(_T("[Plan Data] Defect Filter and Sorting Count : %d ea"), nFilterSortingCount);
|
if(nFilterSortingCount < 1) return FALSE;
|
|
CRcpSchedulingInfo* pScheduleInfo = pRsRcpReviewInfo->GetRcpSchedulingInfo();
|
if (pScheduleInfo == NULL) return FALSE;
|
|
// Picking & Scheduler Scheduler는 각 Line별 맞춰서 알아서 사용
|
for(int nPlanCnt=0; nPlanCnt < pRsRcpReviewInfo->GetRcpPlanInfoCount(); nPlanCnt++)
|
{
|
CRcpPlanInfo* pRcpPlanInfo = pRsRcpReviewInfo->GetRcpPlanInfo(nPlanCnt);
|
if (pRcpPlanInfo == NULL) continue;
|
|
int nPlanType = pRcpPlanInfo->GetReviewType();
|
|
int nPointCount = 0;
|
|
switch(pRcpPlanInfo->m_nReviewType)
|
{
|
case PlanReview:
|
{
|
nPointCount = pDefectPicker->DefectPicking(pPrioritySorter->GetSortingVectorResult(), pScheduleInfo, pRsRcpReviewInfo->GetRcpReviewSortInfo()->m_nSortPriority);
|
m_pSP2P->ISP2P_DisplayMessage(_T("[Plan Data] ReviewPlan Picking Count : %d ea"), nPointCount);
|
if(nPointCount < 1) continue;
|
|
CalculateReviewPathPlan(pDefectPicker, pGlassResult);
|
}
|
break;
|
|
case PlanUser:
|
{
|
nPointCount = pPrioritySorter->GetSortingResultUserCount();
|
m_pSP2P->ISP2P_DisplayMessage(_T("[Plan Data] UserPlan Picking Count : %d ea"), nPointCount);
|
if(nPointCount < 1) continue;
|
|
CalculateUserPathPlan(pPrioritySorter, pGlassResult);
|
}
|
break;
|
|
case PlanWSI:
|
{
|
nPointCount = pDefectPicker->DefectPicking(pPrioritySorter->GetSortingVectorResultWsi(), pScheduleInfo, pRsRcpReviewInfo->GetRcpWSISortInfo()->m_nSortPriority, TRUE);
|
m_pSP2P->ISP2P_DisplayMessage(_T("[Plan Data] WsiPlan Picking Count : %d ea"), nPointCount);
|
if(nPointCount < 1) continue;
|
|
CalculateWsiPathPlan(pDefectPicker, pGlassResult);
|
}
|
break;
|
|
case PlanMeasure:
|
{
|
nPointCount = pPrioritySorter->GetSortingResultMeasureCount();
|
m_pSP2P->ISP2P_DisplayMessage(_T("[Plan Data] MeasurePlan Picking Count : %d ea"), nPointCount);
|
if(nPointCount < 1) continue;
|
|
CalculateMeasurePathPlan(pPrioritySorter, pGlassResult);
|
}
|
break;
|
|
case PlanReflow:
|
{
|
nPointCount = pPrioritySorter->GetSortingResultReflowCount();
|
m_pSP2P->ISP2P_DisplayMessage(_T("[Plan Data] ReflowPlan Picking Count : %d ea"), nPointCount);
|
if(nPointCount < 1) continue;
|
|
CalculateReflowPathPlan(pPrioritySorter, pGlassResult);
|
|
}
|
break;
|
|
case PlanWsiReflow:
|
{
|
nPointCount = pPrioritySorter->GetSortingResultWsiReflowCount();
|
m_pSP2P->ISP2P_DisplayMessage(_T("[Plan Data] WsiReflowPlan Picking Count : %d ea"), nPointCount);
|
if(nPointCount < 1) continue;
|
|
|
CalculateWsiReflowPathPlan(pPrioritySorter, pGlassResult);
|
|
}
|
break;
|
case PlanWsiUser:
|
{
|
nPointCount = pPrioritySorter->GetSortingResultWsiUserCount();
|
m_pSP2P->ISP2P_DisplayMessage(_T("[Plan Data] WsiUserPlan Picking Count : %d ea"), nPointCount);
|
if(nPointCount < 1) continue;
|
|
CalculateWsiUserPathPlan(pPrioritySorter, pGlassResult);
|
|
}
|
break;
|
case PlanWsiMultiShot:
|
{
|
nPointCount = pDefectPicker->DefectPickingMultiShot(pPrioritySorter->GetSortingVectorResultWsiMultiShot(), pScheduleInfo, pRsRcpReviewInfo->GetRcpWSISortInfo()->m_nSortPriority);
|
m_pSP2P->ISP2P_DisplayMessage(_T("[Plan Data] WsiMultiShotPlan Picking Count : %d ea"), nPointCount);
|
if (nPointCount < 1) continue;
|
CalculateWsiMultiShotPathPlan(pDefectPicker, pGlassResult);
|
}
|
break;
|
|
|
|
}
|
nTotalCount+=nPointCount;
|
}
|
|
return nTotalCount;
|
}
|
|
int CSequenceProcessor::GetRealMagnification( int nModuleIdx, int nRcpMagnification )
|
{
|
int nMagIdx = 0;
|
double dbMagValue = 0.0;
|
int nMagInfoIdx = 0;
|
CModuleStatus* pModuleStatus = m_pSP2P->ISP2P_GetModuleStatus(nModuleIdx);
|
if(pModuleStatus == NULL) return 0;
|
|
VectorSMagnificInfo* pvMagnificInfo = pModuleStatus->GetVectorSMagnificInfo();
|
|
for(VectorSMagnificInfoIt it=pvMagnificInfo->begin() ; it!=pvMagnificInfo->end() ; it++)
|
{
|
if (nMagInfoIdx == nRcpMagnification)
|
{
|
dbMagValue = it->dMagnification;
|
break;
|
}
|
nMagInfoIdx++;
|
}
|
|
// 배율값이 0이면 Recipe AFM Info error
|
if (dbMagValue == 0)
|
{
|
m_pSP2P->ISP2P_DisplayMessage(_T("[ApplyRecipeData] Recipe Magnification Matching Error! [ErrMag:%lf=>MagIdx:%d]"), dbMagValue, nMagInfoIdx);
|
return nMagInfoIdx;
|
}
|
|
// 배율값이 0이면 Recipe AFM Info error
|
if (dbMagValue == int(pvMagnificInfo->size()))
|
{
|
m_pSP2P->ISP2P_DisplayMessage(_T("[ApplyRecipeData] Magnification Setting Error! [ErrIdx:%d=>MagIdx:%d]"), nMagInfoIdx, 0);
|
return 0;
|
}
|
|
return nMagInfoIdx;
|
}
|
|
BOOL CSequenceProcessor::WSIAllReadySignal(int nAFMHome)
|
{
|
CGlassResult* pGlassResult = m_pSP2P->ISP2P_GetCurrentGlassResult();
|
if(pGlassResult == NULL) return FALSE;
|
|
CRsRcpReviewInfo* pRsRcpReviewInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo();
|
if (pRsRcpReviewInfo==NULL) return FALSE;
|
|
int nWsiControlCount = m_pSP2P->ISP2P_GetWSIControlCount();
|
|
if(nWsiControlCount > 0)
|
{
|
CMotorControl* pMotorControl = m_pSP2P->ISP2P_GetMotorControl();
|
if(pMotorControl != NULL) pMotorControl->SetUseWsi(TRUE);
|
}
|
|
for(int nWsiControlIdx = 0; nWsiControlIdx < nWsiControlCount; nWsiControlIdx++)
|
{
|
CWsiControl* pWsiControl = m_pSP2P->ISP2P_GetWSIControl(nWsiControlIdx);
|
if(pWsiControl == NULL) continue ;
|
|
CRcpAFMRecipeInfo *pRcpWsiAFMInfo = pRsRcpReviewInfo->GetRcpWsiAFMRecipeInfo(nWsiControlIdx);
|
// if(pRcpWsiAFMInfo == NULL) continue ;
|
//
|
// int nRealMagIndex = GetRealMagnification(nWsiControlIdx, pRcpWsiAFMInfo->m_nZoomIndex);
|
|
int nRealMagIndex = 0;
|
|
//pWsiControl->SetWsiReady(*pGlassResult->GetJobID(),_T("LGDemo"),2, 0); //TEST0716
|
|
if (GetWsiType() == 5) //Reflow
|
{
|
pWsiControl->SetWsiReady(*pGlassResult->GetJobID(), *pGlassResult->GetPPID(), nRealMagIndex, 0, nAFMHome); //마지막 인자는 WSI Auto or Manual 선택, WSI 에서 수동측정 상태에서 Auto로 전환되도록 설정
|
m_pSP2P->ISP2P_DisplayMessage(_T("[WsiControl] GlassID :%s Send PPID : %s HomeUse: %d"), *pGlassResult->GetJobID(), *pGlassResult->GetPPID(), nAFMHome);
|
}
|
else if (GetWsiType() == 7) //MultiShot
|
{
|
int nCount=0;
|
//CReviewResult* pWsiResult = pGlassResult->GetWsiResult(nWsiControlIdx);
|
//if (pWsiResult == NULL) continue;
|
CReviewResult* pWsiResult=pGlassResult->GetWsiMultiShotResult(nWsiControlIdx);
|
if (pWsiResult == NULL) continue;
|
|
int nStartIdx = pWsiResult->GetStartSReviewResultIndex();
|
int nEndIdx = pWsiResult->GetEndSReviewResultIndex();
|
|
//맥스 카운트이상함 고쳐야됨 0917chm
|
for (int nResultIdx = nStartIdx; nResultIdx < nEndIdx; nResultIdx++)
|
{
|
SReviewResult* pWsi = pWsiResult->GetSReviewResult(nResultIdx);
|
if (pWsi == NULL) continue;
|
|
// if (pWsi->bBigSizeDefect == TRUE)
|
//{
|
// nCount += 4;
|
nCount += 1;
|
///}
|
}
|
|
pWsiControl->SetMultiShotWsiReady(*pGlassResult->GetJobID(), *pGlassResult->GetPPID(), nRealMagIndex, 0, nAFMHome, 1, nCount, 0);
|
}
|
else if (GetWsiType() == 9)
|
{
|
//표준시편
|
pWsiControl->SetWsiReady(*pGlassResult->GetJobID(), _T("VLSI"), nRealMagIndex, 0, nAFMHome); //마지막 인자는 WSI Auto or Manual 선택, WSI 에서 수동측정 상태에서 Auto로 전환되도록 설정
|
|
}
|
else {
|
pWsiControl->SetWsiReady(*pGlassResult->GetJobID(), *pGlassResult->GetPPID(), nRealMagIndex, 0, nAFMHome); //마지막 인자는 WSI Auto or Manual 선택, WSI 에서 수동측정 상태에서 Auto로 전환되도록 설정
|
//pWsiControl->SetWsiReady(*pGlassResult->GetJobID(), _T("Default"), nRealMagIndex, 0, nAFMHome);
|
}
|
|
}
|
|
return TRUE;
|
}
|
|
|
|
BOOL CSequenceProcessor::WSIAllStartSignal()
|
{
|
|
BOOL bWSIStart = FALSE;
|
|
CGlassResult* pGlassResult = m_pSP2P->ISP2P_GetCurrentGlassResult();
|
|
int nWsiControlCount = m_pSP2P->ISP2P_GetWSIControlCount();
|
|
m_pSP2P->ISP2P_SetCurrentWsiMode(WsiMeasureType_Normal);
|
|
const CCoordCalibrator* pCoordCalibrator = m_pSP2P->ISP2P_GetCoordCalibrator();
|
if (pCoordCalibrator == NULL) return -3;
|
|
// get direction
|
int nDirectionX, nDirectionY;
|
pCoordCalibrator->GetTransDirection(nDirectionX, nDirectionY);
|
|
int nTotalWsiCount = 0;
|
|
//for(int nWsiControlIdx = 0; nWsiControlIdx < nWsiControlCount; nWsiControlIdx++)
|
//{
|
|
|
// WSI result count
|
for (int nModuleIdx=0; nModuleIdx<Module_GetModuleStatusCount(); nModuleIdx++)
|
{
|
CWsiControl* pWsiControl = m_pSP2P->ISP2P_GetWSIControl(nModuleIdx);
|
if (pWsiControl == NULL) continue;
|
|
CReviewResult* pWsiResult = pGlassResult->GetWsiResult(nModuleIdx);
|
if(pWsiResult == NULL) continue ;
|
const SCoordInfo* pCoordInfo = Module_GetCoordInfo(nModuleIdx);
|
if (pCoordInfo==NULL) continue;
|
CModuleStatus* pModuleStatus = Module_GetModuleStatus(nModuleIdx);
|
if (pModuleStatus == NULL) continue;
|
|
int nDefectCount = pWsiResult->GetSReviewResultCount();
|
|
// get result index
|
int nStartIdx = pWsiResult->GetStartSReviewResultIndex();
|
int nEndIdx = pWsiResult->GetEndSReviewResultIndex();
|
nEndIdx = min(nEndIdx, (pWsiResult->GetSReviewResultCount()-1)) + 1; // set End Index
|
|
// [2017:3:8]-[WEZASW] : CameraOffset 범위 변경 (-1~1 => -5~5)
|
double m_dMinOffset = -5.0;
|
double m_dMaxOffset = 5.0;
|
|
// get wsi pos
|
double dDefectPosX, dDefectPosY;
|
VectorInteger vectorPosX, vectorPosY,vectorModel;
|
double xpostemp, ypostemp;
|
for (int nResultIdx=nStartIdx; nResultIdx<nEndIdx; nResultIdx++)
|
{
|
SReviewResult* pWsi = pWsiResult->GetSReviewResult(nResultIdx);
|
if (pWsi==NULL) continue;
|
|
// set defect pos
|
dDefectPosX = double(pWsi->nUMOriginX) / 1000.0;
|
dDefectPosY = double(pWsi->nUMOriginY) / 1000.0;
|
|
// trans glass to motor pos
|
pCoordCalibrator->TransGlass2Motor(pCoordInfo, dDefectPosX, dDefectPosY);
|
|
// set offset
|
ApplyMotorOffset(pWsi->nModuleIdx, -1, MotorOffsetCamera + MotorOffsetWSI+MotorOffset_Glass, dDefectPosX, dDefectPosY);
|
|
// motor calibrate
|
CalibrateMotorPos(pWsi->nModuleIdx, dDefectPosX, dDefectPosY);
|
|
m_pSP2P->GetOffSetValue(nModuleIdx, pWsi->nAOICameraIdx, pWsi->nAOIScanIdx, dDefectPosX, xpostemp, ypostemp);
|
|
xpostemp = floor(xpostemp * 1000);
|
ypostemp = floor(ypostemp * 1000);
|
|
//ypostemp = ypostemp * -1;
|
|
dDefectPosX += xpostemp / 1000;
|
dDefectPosY += ypostemp / 1000;
|
|
// add move pos
|
if((int)vectorPosX.size() < MAX_MOTOR_ADDRESS_SIZE)
|
{
|
pWsi->dTargetMotorX = dDefectPosX;
|
pWsi->dTargetMotorY = dDefectPosY;
|
vectorPosX.push_back(int(dDefectPosX*1000));
|
vectorPosY.push_back(int(dDefectPosY*1000));
|
vectorModel.push_back(pWsi->nMultiModel);
|
}
|
|
}
|
|
// [2016:11:18]-[WEZASW] : 전달 항목 수정 => nModuleIndex, nDefectCount, nDefectIndex ( n+0), nUMOriginX ( n+1), nUMOriginY ( n+2)
|
bWSIStart = pWsiControl->SetWsiStart_CPJT(nDefectCount, vectorPosX, vectorPosY, 0, vectorModel);
|
nTotalWsiCount += nDefectCount;
|
}
|
//}
|
|
return bWSIStart;
|
}
|
|
BOOL CSequenceProcessor::WSIUserAllStartSignal()
|
{
|
BOOL bWSIStart = FALSE;
|
|
CGlassResult* pGlassResult = m_pSP2P->ISP2P_GetCurrentGlassResult();
|
|
int nWsiControlCount = m_pSP2P->ISP2P_GetWSIControlCount();
|
|
m_pSP2P->ISP2P_SetCurrentWsiMode(WsiMeasureType_User);
|
|
const CCoordCalibrator* pCoordCalibrator = m_pSP2P->ISP2P_GetCoordCalibrator();
|
if (pCoordCalibrator == NULL) return -3;
|
|
// get direction
|
int nDirectionX, nDirectionY;
|
pCoordCalibrator->GetTransDirection(nDirectionX, nDirectionY);
|
|
int nTotalWsiCount = 0;
|
|
for(int nWsiControlIdx = 0; nWsiControlIdx < nWsiControlCount; nWsiControlIdx++)
|
{
|
CWsiControl* pWsiControl = m_pSP2P->ISP2P_GetWSIControl(nWsiControlIdx);
|
if(pWsiControl == NULL) continue ;
|
|
// WSI result count
|
for (int nModuleIdx=0; nModuleIdx<Module_GetModuleStatusCount(); nModuleIdx++)
|
{
|
CReviewResult* pWsiUserResult = pGlassResult->GetWsiUserResult(nModuleIdx);
|
if(pWsiUserResult == NULL) continue ;
|
const SCoordInfo* pCoordInfo = Module_GetCoordInfo(nModuleIdx);
|
if (pCoordInfo==NULL) continue;
|
CModuleStatus* pModuleStatus = Module_GetModuleStatus(nModuleIdx);
|
if (pModuleStatus == NULL) continue;
|
|
int nDefectCount = pWsiUserResult->GetSReviewResultCount();
|
|
// get result index
|
int nStartIdx = pWsiUserResult->GetStartSReviewResultIndex();
|
int nEndIdx = pWsiUserResult->GetEndSReviewResultIndex();
|
nEndIdx = min(nEndIdx, (pWsiUserResult->GetSReviewResultCount()-1)) + 1; // set End Index
|
|
// [2017:3:8]-[WEZASW] : CameraOffset 범위 변경 (-1~1 => -5~5)
|
double m_dMinOffset = -5.0;
|
double m_dMaxOffset = 5.0;
|
|
// get wsi pos
|
double dDefectPosX, dDefectPosY;
|
VectorInteger vectorPosX, vectorPosY;
|
|
for (int nResultIdx=nStartIdx; nResultIdx<nEndIdx; nResultIdx++)
|
{
|
SReviewResult* pWsi = pWsiUserResult->GetSReviewResult(nResultIdx);
|
if (pWsi==NULL) continue;
|
|
// set defect pos
|
dDefectPosX = double(pWsi->nUMOriginX) / 1000.0;
|
dDefectPosY = double(pWsi->nUMOriginY) / 1000.0;
|
|
// trans glass to motor pos
|
pCoordCalibrator->TransGlass2Motor(pCoordInfo, dDefectPosX, dDefectPosY);
|
|
// set offset
|
ApplyMotorOffset(pWsi->nModuleIdx, -1, MotorOffsetCamera + MotorOffsetWSI+MotorOffset_Glass, dDefectPosX, dDefectPosY);
|
|
// motor calibrate
|
CalibrateMotorPos(pWsi->nModuleIdx, dDefectPosX, dDefectPosY);
|
|
// add move pos
|
if((int)vectorPosX.size() < MAX_MOTOR_ADDRESS_SIZE)
|
{
|
pWsi->dTargetMotorX = dDefectPosX;
|
pWsi->dTargetMotorY = dDefectPosY;
|
vectorPosX.push_back(int(dDefectPosX*1000));
|
vectorPosY.push_back(int(dDefectPosY*1000));
|
}
|
}
|
|
// [2016:11:18]-[WEZASW] : 전달 항목 수정 => nModuleIndex, nDefectCount, nDefectIndex ( n+0), nUMOriginX ( n+1), nUMOriginY ( n+2)
|
bWSIStart = pWsiControl->SetWsiStart(nDefectCount, vectorPosX, vectorPosY, 1);
|
|
nTotalWsiCount+=nDefectCount;
|
}
|
}
|
|
return bWSIStart;
|
}
|
|
int CSequenceProcessor::ChangeWsiReflowPointIndex_P( int nIdx )
|
{
|
switch(nIdx)
|
{
|
case W_CELL_TOP:
|
return W_TOP;
|
break;
|
case W_CELL_LEFT:
|
return W_LEFT;
|
break;
|
case W_CELL_RIGHT:
|
return W_RIGHT;
|
break;
|
case W_CELL_LEFTTOP:
|
return W_LEFTTOP;
|
break;
|
case W_CELL_RIGHTTOP:
|
return W_RIGHTTOP;
|
break;
|
case W_CELL_LEFTBOTTOM:
|
return W_LEFTBOTTOM;
|
break;
|
case W_CELL_RIGHTBOTTOM:
|
return W_RIGHTBOTTOM;
|
break;
|
case W_CELL_BOTTOM:
|
return W_BOTTOM;
|
break;
|
case W_CELL_LEFTNOTCH:
|
return W_LEFTNOTCH;
|
break;
|
case W_CELL_RIGHTNOTCH:
|
return W_RIGHTNOTCH;
|
break;
|
}
|
return 0;
|
}
|
|
BOOL CSequenceProcessor::WSIReflowAllStartSignal()
|
{
|
BOOL bWSIStart = FALSE;
|
|
CGlassResult* pGlassResult = m_pSP2P->ISP2P_GetCurrentGlassResult();
|
|
int nWsiControlCount = m_pSP2P->ISP2P_GetWSIControlCount();
|
|
m_pSP2P->ISP2P_SetCurrentWsiMode(WsiMeasureType_Monomer);
|
|
const CCoordCalibrator* pCoordCalibrator = m_pSP2P->ISP2P_GetCoordCalibrator();
|
if (pCoordCalibrator == NULL) return -3;
|
|
// get direction
|
int nDirectionX, nDirectionY;
|
pCoordCalibrator->GetTransDirection(nDirectionX, nDirectionY);
|
|
int nTotalWsiCount = 0;
|
|
for(int nWsiControlIdx = 0; nWsiControlIdx < nWsiControlCount; nWsiControlIdx++)
|
{
|
CWsiControl* pWsiControl = m_pSP2P->ISP2P_GetWSIControl(nWsiControlIdx);
|
if(pWsiControl == NULL) continue ;
|
|
// WSI result count
|
for (int nModuleIdx=0; nModuleIdx<Module_GetModuleStatusCount(); nModuleIdx++)
|
{
|
CReviewResult* pWsiResult = pGlassResult->GetWsiReflowResult(nModuleIdx);
|
if(pWsiResult == NULL) continue ;
|
const SCoordInfo* pCoordInfo = Module_GetCoordInfo(nModuleIdx);
|
if (pCoordInfo==NULL) continue;
|
CModuleStatus* pModuleStatus = Module_GetModuleStatus(nModuleIdx);
|
if (pModuleStatus == NULL) continue;
|
|
int nDefectCount = pWsiResult->GetSReviewResultCount();
|
|
// get result index
|
int nStartIdx = pWsiResult->GetStartSReviewResultIndex();
|
int nEndIdx = pWsiResult->GetEndSReviewResultIndex();
|
nEndIdx = min(nEndIdx, (pWsiResult->GetSReviewResultCount()-1)) + 1; // set End Index
|
|
// [2017:3:8]-[WEZASW] : CameraOffset 범위 변경 (-1~1 => -5~5)
|
double m_dMinOffset = -5.0;
|
double m_dMaxOffset = 5.0;
|
|
// get wsi pos
|
double dDefectPosX, dDefectPosY;
|
VectorInteger vectorPosX, vectorPosY;
|
VectorInt vectorPositionIndex;
|
int nCellSide;
|
for (int nResultIdx=nStartIdx; nResultIdx<nEndIdx; nResultIdx++)
|
{
|
SReviewResult* pWsi = pWsiResult->GetSReviewResult(nResultIdx);
|
if (pWsi==NULL) continue;
|
|
// set defect pos
|
dDefectPosX = double(pWsi->nUMOriginX) / 1000.0;
|
dDefectPosY = double(pWsi->nUMOriginY) / 1000.0;
|
|
// trans glass to motor pos
|
pCoordCalibrator->TransGlass2Motor(pCoordInfo, dDefectPosX, dDefectPosY);
|
|
// set offset
|
ApplyMotorOffset(pWsi->nModuleIdx, -1, MotorOffsetCamera + MotorOffsetWSI, dDefectPosX, dDefectPosY);
|
|
// motor calibrate
|
CalibrateMotorPos(pWsi->nModuleIdx, dDefectPosX, dDefectPosY);
|
|
|
//맞는 CellSide 가지고 오기 20190910chm
|
for(int i=0;i<m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo()->GetRcpUserDefectInfoCount(); i++)
|
{
|
CRsRcpReviewInfo* pRsRcpReviewInfo =m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo();
|
if(pRsRcpReviewInfo==NULL)
|
{
|
g_pLog->DisplayMessage(_T("[WSIReflowAllStartSignal] pRsRcpReviewInfo==NULL"));
|
break;
|
}
|
CRcpUserDefectInfo* pRcpUserDefectInfo =pRsRcpReviewInfo->GetRcpUserDefectInfo(i);
|
if(pRcpUserDefectInfo==NULL)
|
{
|
g_pLog->DisplayMessage(_T("[WSIReflowAllStartSignal] pRcpUserDefectInfo==NULL"));
|
break;
|
}
|
|
if(pRcpUserDefectInfo->m_nSharedDefectIndex == pWsi->nDefectIdx)
|
{
|
nCellSide= pRcpUserDefectInfo->GetCellSide();
|
pWsi->nWsiReflowPositionIndex = ChangeWsiReflowPointIndex_P(nCellSide); //WSI 레시피에서 쓰는 인덱스로 변환
|
}
|
}
|
|
// add move pos
|
if((int)vectorPosX.size() < MAX_MOTOR_ADDRESS_SIZE)
|
{
|
pWsi->dTargetMotorX = dDefectPosX;
|
pWsi->dTargetMotorY = dDefectPosY;
|
vectorPosX.push_back(int(dDefectPosX*1000));
|
vectorPosY.push_back(int(dDefectPosY*1000));
|
|
vectorPositionIndex.push_back(pWsi->nWsiReflowPositionIndex);// cell side
|
}
|
}
|
|
bWSIStart = pWsiControl->SetWsiReflowStart(nDefectCount, vectorPositionIndex ,vectorPosX, vectorPosY);
|
nTotalWsiCount += nDefectCount;
|
}
|
}
|
|
return bWSIStart;
|
}
|
|
BOOL CSequenceProcessor::WSIMultiShotAllStartSignal()
|
{
|
BOOL bWSIStart = FALSE;
|
|
CGlassResult* pGlassResult = m_pSP2P->ISP2P_GetCurrentGlassResult();
|
|
int nWsiControlCount = m_pSP2P->ISP2P_GetWSIControlCount();
|
|
m_pSP2P->ISP2P_SetCurrentWsiMode(WsiMeasureType_MultiShot);
|
|
const CCoordCalibrator* pCoordCalibrator = m_pSP2P->ISP2P_GetCoordCalibrator();
|
if (pCoordCalibrator == NULL) return -3;
|
|
// get direction
|
int nDirectionX, nDirectionY;
|
pCoordCalibrator->GetTransDirection(nDirectionX, nDirectionY);
|
|
int nTotalWsiCount = 0;
|
|
//for (int nWsiControlIdx = 0; nWsiControlIdx < nWsiControlCount; nWsiControlIdx++)
|
//{
|
|
|
// WSI result count
|
for (int nModuleIdx = 0; nModuleIdx < Module_GetModuleStatusCount(); nModuleIdx++)
|
{
|
CWsiControl* pWsiControl = m_pSP2P->ISP2P_GetWSIControl(nModuleIdx);
|
if (pWsiControl == NULL) continue;
|
|
CReviewResult* pWsiMultiShotResult = pGlassResult->GetWsiMultiShotResult(nModuleIdx);
|
if (pWsiMultiShotResult == NULL) continue;
|
const SCoordInfo* pCoordInfo = Module_GetCoordInfo(nModuleIdx);
|
if (pCoordInfo == NULL) continue;
|
CModuleStatus* pModuleStatus = Module_GetModuleStatus(nModuleIdx);
|
if (pModuleStatus == NULL) continue;
|
|
int nDefectCount = pWsiMultiShotResult->GetSReviewResultCount();
|
|
// get result index
|
int nStartIdx = pWsiMultiShotResult->GetStartSReviewResultIndex();
|
int nEndIdx = pWsiMultiShotResult->GetEndSReviewResultIndex();
|
nEndIdx = min(nEndIdx, (pWsiMultiShotResult->GetSReviewResultCount() - 1)) + 1; // set End Index
|
|
// [2017:3:8]-[WEZASW] : CameraOffset 범위 변경 (-1~1 => -5~5)
|
double m_dMinOffset = -5.0;
|
double m_dMaxOffset = 5.0;
|
|
// get wsi pos
|
double dDefectPosX, dDefectPosY;
|
VectorInteger vectorPosX, vectorPosY;
|
|
for (int nResultIdx = nStartIdx; nResultIdx < nEndIdx; nResultIdx++)
|
{
|
SReviewResult* pWsi = pWsiMultiShotResult->GetSReviewResult(nResultIdx);
|
if (pWsi == NULL) continue;
|
|
// set defect pos
|
dDefectPosX = double(pWsi->nUMOriginX) / 1000.0;
|
dDefectPosY = double(pWsi->nUMOriginY) / 1000.0;
|
|
// trans glass to motor pos
|
pCoordCalibrator->TransGlass2Motor(pCoordInfo, dDefectPosX, dDefectPosY);
|
|
// set offset
|
ApplyMotorOffset(pWsi->nModuleIdx, -1, MotorOffsetCamera + MotorOffsetWSI + MotorOffset_Glass, dDefectPosX, dDefectPosY);
|
|
// motor calibrate
|
CalibrateMotorPos(pWsi->nModuleIdx, dDefectPosX, dDefectPosY);
|
|
// add move pos
|
if ((int)vectorPosX.size() < MAX_MOTOR_ADDRESS_SIZE)
|
{
|
pWsi->dTargetMotorX = dDefectPosX;
|
pWsi->dTargetMotorY = dDefectPosY;
|
vectorPosX.push_back(int(dDefectPosX * 1000));
|
vectorPosY.push_back(int(dDefectPosY * 1000));
|
}
|
}
|
|
// [2016:11:18]-[WEZASW] : 전달 항목 수정 => nModuleIndex, nDefectCount, nDefectIndex ( n+0), nUMOriginX ( n+1), nUMOriginY ( n+2)
|
bWSIStart = pWsiControl->SetMultiShotWsiStart(nDefectCount, vectorPosX, vectorPosY, 0, nDefectCount, 4);
|
nTotalWsiCount += nDefectCount;
|
}
|
|
|
return bWSIStart;
|
}
|
|
BOOL CSequenceProcessor::MoveAFMHomePosition()
|
{
|
int nMagInfoIdx = 0;
|
BOOL bHomeSuccess = FALSE;
|
int nModuleCount = m_pSP2P->ISP2P_GetModuleStatusCount();
|
|
CRsRcpReviewInfo *pRsRcpReviewInfo = m_pSP2P->ISP2P_Recipe_GetRsRcpReviewInfo();
|
if (pRsRcpReviewInfo==NULL) return 0;
|
|
int dbMsgHomeValue = 0;
|
|
for(int nModuleIdx = 0; nModuleIdx < nModuleCount; nModuleIdx++)
|
{
|
CAfmControl* pAFMControl = m_pSP2P->ISP2P_GetAFMControl(nModuleIdx);
|
if(pAFMControl == NULL) continue ;
|
|
CRcpAFMRecipeInfo *pRcpAFMRecipeInfo = pRsRcpReviewInfo->GetRcpAFMRecipeInfo(nModuleIdx);
|
if (pRcpAFMRecipeInfo==NULL) continue ;
|
|
CModuleStatus* pModuleStatus = m_pSP2P->ISP2P_GetModuleStatus(pAFMControl->GetIndex());
|
if (pModuleStatus==NULL) continue ;
|
|
VectorSMagnificInfo* pvMagnificInfo = pModuleStatus->GetVectorSMagnificInfo();
|
if (pvMagnificInfo==NULL) continue ;
|
|
for(VectorSMagnificInfoIt it=pvMagnificInfo->begin() ; it!=pvMagnificInfo->end() ; it++)
|
{
|
if (nMagInfoIdx == pRcpAFMRecipeInfo->GetZoomIndex())
|
{
|
dbMsgHomeValue = it->nMsgHomePosition;
|
break;
|
}
|
nMagInfoIdx++;
|
}
|
|
int nResult;
|
nResult = pAFMControl->MoveToHomePosition(dbMsgHomeValue);
|
|
if(nResult==1){
|
bHomeSuccess=nResult;
|
}
|
else if (nResult ==2){
|
g_pLog->DisplayMessage(_T("[AFM Homfail] atf_SetComIdx()==FALSE"));
|
}
|
else if (nResult ==3)
|
{
|
g_pLog->DisplayMessage(_T("[AFM Homfail] atf_ReadObjNum ==FALSE"));
|
|
}
|
else if (nResult ==4)
|
{
|
g_pLog->DisplayMessage(_T("[AFM Homfail] atf_ReadSpeed == FALSE //Read current Speed "));
|
|
}
|
else if (nResult ==5)
|
{
|
g_pLog->DisplayMessage(_T("[AFM Homfail] atf_ReadStepPerMmConversion ==FALSE"));
|
|
}
|
else if (nResult ==6)
|
{
|
g_pLog->DisplayMessage(_T("[AFM Homfail] atf_MoveZ ==FALSE //Move to Limit "));
|
|
}
|
else if (nResult ==7)
|
{
|
g_pLog->DisplayMessage(_T("[AFM Homfail] atf_ReadHwStat ==FALSE //Read Limit Sensor"));
|
|
}
|
else if (nResult ==8)
|
{
|
g_pLog->DisplayMessage(_T("[AFM Homfail] ~hw_status & limit_sw ==FALSE //Read Limit Sensor"));
|
|
}
|
else if (nResult ==9)
|
{
|
g_pLog->DisplayMessage(_T("[AFM Homfail] atf_MoveZ ==FALSE //move out ( not Limit / small down)"));
|
|
}
|
else if (nResult ==10)
|
{
|
g_pLog->DisplayMessage(_T("[AFM Homfail] atf_ReadHwStat ==FALSE //check Limit ( not Limit )"));
|
|
}
|
else if (nResult ==11)
|
{
|
g_pLog->DisplayMessage(_T("[AFM Homfail] atf_WriteAbsZPos ==FALSE //Current Position is Zero"));
|
|
}
|
else if (nResult ==12)
|
{
|
g_pLog->DisplayMessage(_T("[AFM Homfail] atf_WriteSpeed atf_MoveZ ==FALSE //Target Position"));
|
|
}
|
else {
|
g_pLog->DisplayMessage(_T("[AFM Homfail] AFM is not connect "));
|
bHomeSuccess = FALSE;
|
}
|
//bHomeSuccess = pAFMControl->MoveToHomePosition(dbMsgHomeValue);
|
}
|
|
return bHomeSuccess;
|
}
|
|
BOOL CSequenceProcessor::MoveAFMReferencePosition()
|
{
|
BOOL bHomeSuccess = FALSE;
|
int nModuleCount = m_pSP2P->ISP2P_GetModuleStatusCount();
|
|
for(int nModuleIdx = 0; nModuleIdx < nModuleCount; nModuleIdx++)
|
{
|
CAfmControl* pAFMControl = m_pSP2P->ISP2P_GetAFMControl(nModuleIdx);
|
|
if(pAFMControl == NULL) continue ;
|
|
bHomeSuccess = pAFMControl->MoveToBasePosition(nModuleIdx);
|
}
|
|
return bHomeSuccess;
|
}
|
|
BOOL CSequenceProcessor::SetMotionStop()
|
{
|
for (int nModuleIdx=0; nModuleIdx<Module_GetModuleStatusCount(); nModuleIdx++)
|
{
|
const SMotorPosition *pPosition = Module_GetMotorPosition(nModuleIdx);
|
if (pPosition==NULL) continue;
|
if (pPosition->bUseWSI==FALSE) continue;
|
|
BOOL bCheck = WSI_SetWSITimeOver(nModuleIdx);
|
if(bCheck)
|
g_pLog->DisplayMessage(_T("TRUE [%d]"), nModuleIdx);
|
else
|
g_pLog->DisplayMessage(_T("FAIL [%d]"), nModuleIdx);
|
}
|
|
CMotorControl* pMotorControl = m_pSP2P->ISP2P_GetMotorControl();
|
if(pMotorControl) pMotorControl->CommonSetAutoStop();
|
|
return TRUE;
|
}
|
|
BOOL CSequenceProcessor::Revolver_SetGoHome( int nModuleIndex )//리니어 터렛 틀어짐으로 인해 로딩시 home 동작 진행 0529chm
|
{
|
CModuleStatus* pModuleStatus = m_pSP2P->ISP2P_GetModuleStatus(nModuleIndex);
|
if(pModuleStatus == NULL) return FALSE;
|
|
SExternalIndex* pExternalIndex = pModuleStatus->GetExternalIndex();
|
if(pExternalIndex == NULL) return FALSE;
|
|
// Zoom 변경
|
SCameraControl *pCameraControl = Module_GetCameraControl(nModuleIndex);
|
CLensChangeControl *pRevolverControl = m_pSP2P->ISP2P_GetRevolverControl(pExternalIndex->nRevolver_Index);
|
|
if (pCameraControl==NULL || pRevolverControl==NULL) { return FALSE; }
|
|
pRevolverControl->GoHoming();
|
pCameraControl->nZoomLevel = -1;
|
|
return TRUE;
|
}
|
|
void CSequenceProcessor::SendWsiErrorAlarm()
|
{
|
return SendWsiErrorAlarm_CPJT(0);
|
}
|
void CSequenceProcessor::WSIAliveCheckRunThread()
|
{
|
return WSIAliveCheckRunThread_CPJT();
|
}
|
|
BOOL ISequenceProcessor2Parent::ISP2P_SetReflowResultData( CGlassResult *pGlassResult )
|
{
|
return FALSE;
|
}
|