增加了关于双步进电机同步运行
This commit is contained in:
@ -11,10 +11,16 @@ VinceControl::VinceControl(ProTools proto)
|
||||
{
|
||||
protools = proto;
|
||||
initme();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void VinceControl::setSyncMode()
|
||||
{
|
||||
isSyncMotor = true;
|
||||
}
|
||||
|
||||
VinceControl::~VinceControl()
|
||||
{
|
||||
if (protools == RS232 || protools == RS485)
|
||||
@ -139,6 +145,10 @@ void VinceControl::SendCommandtoMotor(QString str)
|
||||
}
|
||||
else if (protools==NETTCP)
|
||||
{
|
||||
if (isSyncMotor)
|
||||
{
|
||||
str = "0 " + str;
|
||||
}
|
||||
if (tcpSocket.length() == 0)
|
||||
{
|
||||
return;
|
||||
@ -160,6 +170,10 @@ void VinceControl::SendCommandtoMotor(QString str, QString modor)
|
||||
|
||||
}
|
||||
|
||||
if (protools!=NETTCP)
|
||||
{
|
||||
return;
|
||||
}
|
||||
int lenth = tcpSocket.length();
|
||||
int lenthstring = Motorlist.length();
|
||||
if (lenthstring!=lenth)
|
||||
@ -170,6 +184,10 @@ void VinceControl::SendCommandtoMotor(QString str, QString modor)
|
||||
{
|
||||
if (Motorlist.at(i)==modor)
|
||||
{
|
||||
if (isSyncMotor)
|
||||
{
|
||||
str = "0 " + str;
|
||||
}
|
||||
tcpSocket[i]->write(str.toUtf8().data());
|
||||
tcpSocket[i]->waitForBytesWritten(1000);
|
||||
return;
|
||||
@ -372,6 +390,7 @@ void VinceControl::initme()
|
||||
RS485ID = "0";
|
||||
Speednow = 0;
|
||||
SpeedisSet = false;
|
||||
isSyncMotor = false;
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user