修改了电机部分控制代码&错误打印,优化了电机错误的信息输出。温湿度传感器修改

This commit is contained in:
卓 张
2023-12-19 10:52:21 +08:00
committed by xin
parent 70f0a01882
commit fba6becf7c
6 changed files with 58 additions and 25 deletions

View File

@ -222,7 +222,7 @@ bool CVSMD12XControl::InitController()
bool CVSMD12XControl::GetStatus(MSInfo &stuMotorParam)
{
std::string strCMD = "cts\n";
std::string strCMD = "sts\n";
if (m_iProtocolType)
{
@ -1432,7 +1432,7 @@ bool CVSMD12XControl::IsMotionFinished()
QThread::msleep(200);
//Delay_MSec(200);
GetStatus(m_stuMSInfo);
ZZ_U8 ucFlag = m_stuMSInfo.uiFlags & 0x000000FF;
ZZ_U8 ucFlag = m_stuMSInfo.uiFlags & 0x00FFFFFF;
ucFlag = ucFlag & 0x10;
if (m_stuMSInfo.fVelocity == 0)
{
@ -1445,15 +1445,21 @@ bool CVSMD12XControl::IsMotionFinished()
}
if (iCountStopped>=50)
{
QString str = QString("%1").arg(m_stuMSInfo.uiFlags, 30, 2, QChar('0'));
qDebug() <<"Warning.Motion Err,should be stopped already.checking register and retry...";
qDebug() <<"motion status:"<<ucFlag<<"all status:"<<QString::number(m_stuMSInfo.uiFlags,2);
qDebug() << "velocity:" << m_stuMSInfo.fVelocity;
qDebug() << "position:" << m_stuMSInfo.iPosition;
qDebug() << "motion status:" << ucFlag << "all status:" << str;
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);
QString str = QString("%1").arg(m_stuMSInfo.uiFlags, 30, 2, QChar('0'));
qDebug() << "Warning.Motion Err,should be stopped already.checking register and retry...";
qDebug() << "velocity:" << m_stuMSInfo.fVelocity;
qDebug() << "position:" << m_stuMSInfo.iPosition;
qDebug() << "motion status:" << ucFlag << "all status:" << str;
bFlagIsStopped = true;
return false;
}