diff --git a/dynamixel_manager/src/modules/action.c b/dynamixel_manager/src/modules/action.c index 24eff30c71aba47ebf8ac33f3fb018a36e35132c..e901e01264cd3153a919c00899412317c73b4373 100755 --- a/dynamixel_manager/src/modules/action.c +++ b/dynamixel_manager/src/modules/action.c @@ -8,7 +8,18 @@ // private functions void action_write_cmd(TActionMModule *module,unsigned short int address,unsigned short int length,unsigned char *data) { - ram_write_table(module->memory,address,length,data); + unsigned int ram_offset; + + ram_offset=address-module->ram_base_address; + if(ram_in_range(module->ram_base_address+ACTION_MM_CONTROL_OFFSET,address,length)) + { + if(data[ACTION_MM_CONTROL_OFFSET-ram_offset]&ACTION_MM_START) + action_start_page(module); + if(data[ACTION_MM_CONTROL_OFFSET-ram_offset]&ACTION_MM_STOP) + action_stop_page(module); + } + if(ram_in_range(module->ram_base_address+ACTION_MM_PAGE_OFFSET,address,length))// load the page identifier + action_load_page(module,data[ACTION_MM_PAGE_OFFSET-ram_offset]); } void action_read_cmd(TActionMModule *module,unsigned short int address,unsigned short int length,unsigned char *data) @@ -202,6 +213,7 @@ void action_finish(TActionMModule *action) action->end=0x00; // change the internal state action->running=0x00; + action->memory->data[action->ram_base_address+ACTION_MM_CONTROL_OFFSET]&=(~ACTION_MM_RUNNING); } void action_set_period(void *module,unsigned short int period_ms) @@ -508,6 +520,7 @@ unsigned char action_load_page(TActionMModule *action,unsigned char page_id) return 0x00; if(!pages_check_checksum(&action->next_page)) return 0x00; + action->memory->data[action->ram_base_address+ACTION_MM_PAGE_OFFSET]=page_id; return 0x01; } @@ -524,6 +537,7 @@ void action_start_page(TActionMModule *action) action->current_step_index=-1; /* clear the interrupt flag */ action->running=0x01; + action->memory->data[action->ram_base_address+ACTION_MM_CONTROL_OFFSET]|=ACTION_MM_RUNNING; } void action_stop_page(TActionMModule *action)