Skip to content
Snippets Groups Projects
Commit ccf8ff3c authored by Sergi Hernandez's avatar Sergi Hernandez
Browse files

The new serial number is compared with the previous one to avoid...

The new serial number is compared with the previous one to avoid reinitializing the same bus over and over.
parent 3cdf3407
No related branches found
No related tags found
No related merge requests found
......@@ -252,22 +252,25 @@ void CDynamixelServer::set_bus_id(std::string &bus_id)
}
else
{
if(this->comm_dev!=NULL)
if(this->bus_info.serial!=bus_id)
{
this->comm_dev->close();
delete this->comm_dev;
this->comm_dev=NULL;
}
this->comm_dev=ftdi_server->get_device(bus_id);
if(this->comm_dev==NULL)
{
/* handle exception */
throw CDynamixelServerException(_HERE_,"No device found with the given serial number");
}
else
{
this->bus_info.bus_id=-1;
this->bus_info.serial=bus_id;
if(this->comm_dev!=NULL)
{
this->comm_dev->close();
delete this->comm_dev;
this->comm_dev=NULL;
}
this->comm_dev=ftdi_server->get_device(bus_id);
if(this->comm_dev==NULL)
{
/* handle exception */
throw CDynamixelServerException(_HERE_,"No device found with the given serial number");
}
else
{
this->bus_info.bus_id=-1;
this->bus_info.serial=bus_id;
}
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment