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

Solved a bug in the deletion of an operation: The master index was not reset.

Solved a bug when re-scanning: previously seen devides were not updated.
parent c92a51ce
No related branches found
No related tags found
1 merge request!9Solved a bug in the deletion of an operation: The master index was not reset.
......@@ -145,6 +145,7 @@ void dyn_manager_delete_op_single_master(TDynManager *manager,unsigned char mast
manager->operations[master_index].single_op[op->op_index[master_index]].data=0x00000000;
}
manager->operations[master_index].num_single_op--;
op->op_index[master_index]=0xFF;
break;
case DYN_MANAGER_SYNC: if(op->op_index[master_index]<(DYN_MANAGER_MAX_NUM_SYNC_OP-1))
{
......@@ -180,6 +181,7 @@ void dyn_manager_delete_op_single_master(TDynManager *manager,unsigned char mast
manager->operations[master_index].sync_op[op->op_index[master_index]].num_devices=0x00;
}
manager->operations[master_index].num_sync_op--;
op->op_index[master_index]=0xFF;
break;
case DYN_MANAGER_BULK: if(op->op_index[master_index]<(DYN_MANAGER_MAX_NUM_BULK_OP-1))
{
......@@ -215,6 +217,7 @@ void dyn_manager_delete_op_single_master(TDynManager *manager,unsigned char mast
manager->operations[master_index].bulk_op[op->op_index[master_index]].num_devices=0x00;
}
manager->operations[master_index].num_bulk_op--;
op->op_index[master_index]=0xFF;
break;
}
}
......@@ -375,17 +378,14 @@ void dyn_manager_scan(TDynManager *manager)
// get the servo module
dyn_master_read_word(manager->masters[i],servo_ids[j],0x0000,&model);
// store internal info
if(manager->devices[servo_ids[j]].master_index==0xFF && manager->devices[servo_ids[j]].model==0xFFFF)// device not yet initialized
{
manager->devices[servo_ids[j]].model=model;
manager->devices[servo_ids[j]].master_index=i;
manager->num_devices++;
manager->present_devices|=(0x00000001<<servo_ids[j]);
// pass the infor to each of the modules
for(k=0;k<DYN_MANAGER_MAX_NUM_MODULES;k++)
if(manager->modules[k]!=0x00000000)
dyn_module_add_device(manager->modules[k],servo_ids[j],model);
}
manager->devices[servo_ids[j]].model=model;
manager->devices[servo_ids[j]].master_index=i;
manager->num_devices++;
manager->present_devices|=(0x00000001<<servo_ids[j]);
// pass the infor to each of the modules
for(k=0;k<DYN_MANAGER_MAX_NUM_MODULES;k++)
if(manager->modules[k]!=0x00000000)
dyn_module_add_device(manager->modules[k],servo_ids[j],model);
// else ignore device
}
}
......
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