mirror of
http://172.16.0.230/r/SIF/TowerOptoSifAndSpectral.git
synced 2025-10-19 19:49:42 +08:00
修改moving backzero
This commit is contained in:
@ -423,6 +423,7 @@ bool CVSMD12XControl::StartBackZero()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return IsMotionFinished();
|
||||
|
||||
bool bFlagIsStopped = false;
|
||||
while (!bFlagIsStopped)
|
||||
@ -440,7 +441,49 @@ bool CVSMD12XControl::StartBackZero()
|
||||
// return ParseReturnedString(strRecv, -1);
|
||||
|
||||
}
|
||||
bool CVSMD12XControl::IsMotionFinished()
|
||||
{
|
||||
//true means stopped
|
||||
//false means unknown status
|
||||
int iCountTotal = 0;
|
||||
int iCountStopped = 0;
|
||||
bool bFlagIsStopped = false;
|
||||
|
||||
while (!bFlagIsStopped)
|
||||
{
|
||||
iCountTotal++;
|
||||
QThread::msleep(200);
|
||||
//Delay_MSec(200);
|
||||
GetStatus(m_stuMSInfo);
|
||||
ZZ_U8 ucFlag = m_stuMSInfo.uiFlags & 0x000000FF;
|
||||
ucFlag = ucFlag & 0x10;
|
||||
if (m_stuMSInfo.fVelocity == 0)
|
||||
{
|
||||
iCountStopped++;
|
||||
}
|
||||
if (ucFlag == 0x10 && m_stuMSInfo.fVelocity == 0)
|
||||
{
|
||||
bFlagIsStopped = true;
|
||||
return true;
|
||||
}
|
||||
if (iCountStopped>=50)
|
||||
{
|
||||
qDebug() <<"Warning.Motion Err,should be stopped already.checking register and retry...";
|
||||
qDebug() <<"motion status:"<<ucFlag<<"all status:"<<QString::number(m_stuMSInfo.uiFlags,2);
|
||||
bFlagIsStopped = true;
|
||||
return false;
|
||||
}
|
||||
if (iCountTotal>1000)
|
||||
{
|
||||
qDebug() << "Err.Motor Hardware Err,should be stopped already";
|
||||
qDebug() << "motion status:" << ucFlag << "all status:" << QString::number(m_stuMSInfo.uiFlags, 2);
|
||||
bFlagIsStopped = true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
bool CVSMD12XControl::StopBackZero()
|
||||
{
|
||||
std::string strCMD = "zero stop\n";
|
||||
|
Reference in New Issue
Block a user