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

Solved a problem when starting a new scan when the previous one was stopped....

Solved a problem when starting a new scan when the previous one was stopped. The new one never started.
parent 18ca4ba6
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,6 @@
#include "dynamixelserver.h"
#include "eventexceptions.h"
#include <sstream>
#include <iostream>
const unsigned short crc_table[256] = {
0x0000, 0x8005, 0x800F, 0x000A, 0x801B, 0x001E, 0x0014, 0x8011,
......@@ -591,7 +590,6 @@ void *CDynamixelServer::scan_thread(void *param)
}
for(freq=0;freq<9;freq++)
{
std::cout << "trying frequency: " << frequencies[freq] << std::endl;
dyn_server->set_baudrate(frequencies[freq]);
for(id=0;id<0xFD;id++)
{
......@@ -605,9 +603,7 @@ void *CDynamixelServer::scan_thread(void *param)
else
{
try{
std::cout << "checking device ID: " << id << std::endl;
dyn_server->ping(id,20,dyn_server->scan_version);
std::cout << "Found device with ID: " << id << std::endl;
}catch(CEventTimeoutException &e){
continue;
}
......@@ -661,6 +657,10 @@ void CDynamixelServer::start_scan(dyn_version_t version)
this->stop_scan();
this->devices_v1.clear();
this->devices_v2.clear();
if(this->event_server->event_is_set(this->stop_scan_event_id))
this->event_server->reset_event(this->stop_scan_event_id);
if(this->event_server->event_is_set(this->scan_error_event_id))
this->event_server->reset_event(this->scan_error_event_id);
this->thread_server->start_thread(this->scan_thread_id);
}
}
......
......@@ -41,7 +41,6 @@ int main(int argc, char *argv[])
}
else
std::cout << "Error while scanning the bus: " << dyn_server->get_scan_error() << std::endl;
return 0;
try{
dyn_server->config_bus(0,1000000);
dyn_server->start_scan();
......
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