Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/Dynamixel2Arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ class Dynamixel2Arduino : public DYNAMIXEL::Master
* If the read fails, 0 is returned. Whether or not this is an actual value can be confirmed with @getLastLibErrCode().
*/
int32_t readControlTableItem(uint8_t item_idx,
uint8_t id, uint32_t timeout = 100);
uint8_t id, uint32_t timeout = 10);

/**
* @brief It is API for controlling data of a DYNAMIXEL control table item.
Expand All @@ -423,7 +423,7 @@ class Dynamixel2Arduino : public DYNAMIXEL::Master
* @return It returns true(1) on success, false(0) on failure.
*/
bool writeControlTableItem(uint8_t item_idx,
uint8_t id, int32_t data, uint32_t timeout = 100);
uint8_t id, int32_t data, uint32_t timeout = 10);


#if 0 //TODO
Expand Down Expand Up @@ -464,10 +464,10 @@ class Dynamixel2Arduino : public DYNAMIXEL::Master
bool writeForRangeDependencyFunc(uint8_t func_idx, uint8_t id, float value, uint8_t unit);

int32_t readControlTableItem(uint16_t model_num,
uint8_t item_idx, uint8_t id, uint32_t timeout = 100);
uint8_t item_idx, uint8_t id, uint32_t timeout = 10);

bool writeControlTableItem(uint16_t model_num,
uint8_t item_idx, uint8_t id, int32_t data, uint32_t timeout = 100);
uint8_t item_idx, uint8_t id, int32_t data, uint32_t timeout = 10);
};


Expand Down
11 changes: 9 additions & 2 deletions src/dxl_c/protocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,10 @@ static DXLLibErrorCode_t end_make_dxl2_0_packet(InfoToMakeDXLPacket_t* p_make_pa
DXLLibErrorCode_t begin_parse_dxl_packet(InfoToParseDXLPacket_t* p_parse_packet,
uint8_t protocol_ver, uint8_t* p_param_buf, uint16_t param_buf_capacity)
{
if(p_parse_packet == NULL){
return DXL_LIB_ERROR_NULLPTR;
}

if(param_buf_capacity > 0 && p_param_buf == NULL){
return DXL_LIB_ERROR_NULLPTR;
}
Expand All @@ -340,21 +344,24 @@ DXLLibErrorCode_t begin_parse_dxl_packet(InfoToParseDXLPacket_t* p_parse_packet,
return DXL_LIB_ERROR_INVAILD_PROTOCOL_VERSION;
}

memset(p_parse_packet, 0, sizeof(InfoToParseDXLPacket_t));
p_parse_packet->protocol_ver = protocol_ver;
p_parse_packet->p_param_buf = p_param_buf;
p_parse_packet->param_buf_capacity = param_buf_capacity;
// p_parse_packet->recv_param_len = 0;
// p_parse_packet->parse_state = 0;
p_parse_packet->is_init = true;

return DXL_LIB_OK;
}

DXLLibErrorCode_t fast_begin_parse_dxl_packet(InfoToParseDXLPacket_t* p_parse_packet, uint8_t protocol_ver)
{
if (p_parse_packet == NULL)
return DXL_LIB_ERROR_NULLPTR;

if (protocol_ver != 2)
return DXL_LIB_ERROR_INVAILD_PROTOCOL_VERSION;

memset(p_parse_packet, 0, sizeof(InfoToParseDXLPacket_t));
p_parse_packet->protocol_ver = protocol_ver;
p_parse_packet->p_param_buf = nullptr;
p_parse_packet->param_buf_capacity = 0;
Expand Down
1 change: 1 addition & 0 deletions src/dxl_c/protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#include <cstring>

const int DXL_BROADCAST_ID = 0xFE;

Expand Down