|
|
|
|
#include "StdAfx.h"
|
|
|
|
|
#include "WorkCmdWaitMotorStop.h"
|
|
|
|
|
#include "MotionCard_PCI1245.h"
|
|
|
|
|
#include "GlobalFunction.h"
|
|
|
|
|
#include "PlatformXY.h"
|
|
|
|
|
#include "DeviceState.h"
|
|
|
|
|
#include "Program_SZ_XL.h"
|
|
|
|
|
#include "ExceptionMsg.h"
|
|
|
|
|
|
|
|
|
|
CWorkCmdWaitMotorStop::CWorkCmdWaitMotorStop()
|
|
|
|
|
{
|
|
|
|
|
m_bWaitMotorX = false;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7>˶<EFBFBD>ֹͣ
|
|
|
|
|
m_bWaitMotorX2 = false;//
|
|
|
|
|
m_bWaitMotorY = false;//
|
|
|
|
|
m_bWaitMotorZ = false;//
|
|
|
|
|
m_bCheckActCoord = false;//<2F>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD>ʹ<EFBFBD>դ<EFBFBD>ߵ<EFBFBD><DFB5><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
}
|
|
|
|
|
CWorkCmdWaitMotorStop::~CWorkCmdWaitMotorStop(void)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
bool CWorkCmdWaitMotorStop::Excute()
|
|
|
|
|
{
|
|
|
|
|
if(gLogMgr->IsDebuging())//<2F><><EFBFBD><EFBFBD>״ֻ̬<CCAC><D6BB>ʱ
|
|
|
|
|
{
|
|
|
|
|
Sleep(gLogMgr->GetDebugCmdDelay());
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Sleep(300);
|
|
|
|
|
|
|
|
|
|
bool bMotorXMoveStop = true;//<2F><><EFBFBD>Ƿ<EFBFBD><C7B7>˶<EFBFBD>ֹͣ
|
|
|
|
|
bool bMotorX2MoveStop = true;
|
|
|
|
|
bool bMotorYMoveStop = true;
|
|
|
|
|
bool bMotorZMoveStop = true;
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if(m_bWaitMotorX)
|
|
|
|
|
{
|
|
|
|
|
bMotorXMoveStop = gMotionCard_PCI1245->IsbMotorXMoveStop();
|
|
|
|
|
}
|
|
|
|
|
if(m_bWaitMotorX2)
|
|
|
|
|
{
|
|
|
|
|
bMotorX2MoveStop = gMotionCard_PCI1245->IsbMotorX2MoveStop();
|
|
|
|
|
}
|
|
|
|
|
if(m_bWaitMotorY)
|
|
|
|
|
{
|
|
|
|
|
bMotorYMoveStop = gMotionCard_PCI1245->IsbMotorYMoveStop();
|
|
|
|
|
}
|
|
|
|
|
if(m_bWaitMotorZ)
|
|
|
|
|
{
|
|
|
|
|
bMotorZMoveStop = gMotionCard_PCI1245->IsbMotorZMoveStop();
|
|
|
|
|
}
|
|
|
|
|
//ȫ<><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>˳<EFBFBD>
|
|
|
|
|
if(bMotorXMoveStop && bMotorX2MoveStop && bMotorYMoveStop && bMotorZMoveStop)
|
|
|
|
|
break;
|
|
|
|
|
Sleep(100);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD>µ<EFBFBD><C2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if(m_bWaitMotorX)
|
|
|
|
|
{
|
|
|
|
|
CMotor &MotorX = *(CMotor::GetMotor(MOTOR_X));
|
|
|
|
|
MotorX.SetCoord(gMotionCard_PCI1245->GetMotorCoord(MotorX));
|
|
|
|
|
}
|
|
|
|
|
if(m_bWaitMotorX2)
|
|
|
|
|
{
|
|
|
|
|
CMotor &MotorX2 = *(CMotor::GetMotor(MOTOR_X2));
|
|
|
|
|
MotorX2.SetCoord(gMotionCard_PCI1245->GetMotorCoord(MotorX2));
|
|
|
|
|
}
|
|
|
|
|
if(m_bWaitMotorY)
|
|
|
|
|
{
|
|
|
|
|
CMotor &MotorY = *(CMotor::GetMotor(MOTOR_Y));
|
|
|
|
|
MotorY.SetCoord(gMotionCard_PCI1245->GetMotorCoord(MotorY));
|
|
|
|
|
}
|
|
|
|
|
if(m_bWaitMotorZ)
|
|
|
|
|
{
|
|
|
|
|
CMotor &MotorZ = *(CMotor::GetMotor(MOTOR_Z));
|
|
|
|
|
MotorZ.SetCoord(gMotionCard_PCI1245->GetMotorCoord(MotorZ));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CPlatformXY &PlatformXY = *gPlatformXY;
|
|
|
|
|
PlatformXY.NotifyObservers();
|
|
|
|
|
|
|
|
|
|
Sleep(300);
|
|
|
|
|
#if 0
|
|
|
|
|
if(m_bCheckActCoord)//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>դ<EFBFBD><D5A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD>ƥ<EFBFBD><C6A5>
|
|
|
|
|
{
|
|
|
|
|
bool bRet = true;
|
|
|
|
|
if(m_bWaitMotorX)
|
|
|
|
|
{
|
|
|
|
|
CMotor &MotorX = *(CMotor::GetMotor(MOTOR_X));
|
|
|
|
|
bRet = gMotionCard_PCI1245->CheckMotorActCoord(MotorX);
|
|
|
|
|
}
|
|
|
|
|
if(m_bWaitMotorX2)
|
|
|
|
|
{
|
|
|
|
|
CMotor &MotorX2 = *(CMotor::GetMotor(MOTOR_X2));
|
|
|
|
|
bRet = gMotionCard_PCI1245->CheckMotorActCoord(MotorX2);
|
|
|
|
|
}
|
|
|
|
|
if(m_bWaitMotorY)
|
|
|
|
|
{
|
|
|
|
|
CMotor &MotorY = *(CMotor::GetMotor(MOTOR_Y));
|
|
|
|
|
bRet = gMotionCard_PCI1245->CheckMotorActCoord(MotorY);
|
|
|
|
|
}
|
|
|
|
|
if(!bRet)
|
|
|
|
|
{
|
|
|
|
|
//ֹͣ<CDA3>ӹ<EFBFBD>
|
|
|
|
|
gProgram_SZ_XL->StopAutoWork();
|
|
|
|
|
//ȡ<><C8A1><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>״̬
|
|
|
|
|
CDeviceState &DeviceState = CDeviceState::GetInstance();
|
|
|
|
|
DeviceState.SetIniState(false);
|
|
|
|
|
|
|
|
|
|
CString str = _T("<EFBFBD><EFBFBD>դ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>귴<EFBFBD><EFBFBD><EFBFBD>쳣!");
|
|
|
|
|
CExceptionMsg Msg;
|
|
|
|
|
Msg.SetMsg(str);
|
|
|
|
|
throw Msg;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CWorkCmdWaitMotorStop::WirteLog()
|
|
|
|
|
{
|
|
|
|
|
CString str1 = "[WorkCmd][WaitMotorStop]";
|
|
|
|
|
gLogMgr->WriteDebugLog(str1);
|
|
|
|
|
}
|