From 1613dd633fd56907c49a67a49c76b62e914dd82a Mon Sep 17 00:00:00 2001 From: "hancheol.cho" Date: Thu, 26 Jan 2023 12:54:02 +0900 Subject: [PATCH 1/2] fixed packet buffer position for byte stuff problem. --- src/utility/config.h | 6 ++++-- src/utility/slave.cpp | 8 ++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/utility/config.h b/src/utility/config.h index f0a7299..a12d246 100644 --- a/src/utility/config.h +++ b/src/utility/config.h @@ -33,13 +33,15 @@ #define ENABLE_ACTUATOR_PRO_RA 1 #define ENABLE_ACTUATOR_PRO_PLUS 1 +#define DXL_BYTE_STUFF_SAFE_CNT 8 + #if defined (ARDUINO_AVR_UNO) || defined (ARDUINO_AVR_YUN) \ || defined (ARDUINO_AVR_INDUSTRIAL101) #define DEFAULT_DXL_BUF_LENGTH 192 #elif defined (ARDUINO_AVR_LEONARDO) #define DEFAULT_DXL_BUF_LENGTH 256 -#elif defined (OpenCR) +#elif defined (__OPENCR__) #define DEFAULT_DXL_BUF_LENGTH 2048 #else #define DEFAULT_DXL_BUF_LENGTH 1024 @@ -60,7 +62,7 @@ #elif defined (ARDUINO_AVR_LEONARDO) #define DXL_MAX_NODE 16 #define DXL_MAX_NODE_BUFFER_SIZE 12 -#elif defined (OpenCR) +#elif defined (__OPENCR__) #define DXL_MAX_NODE 253 // Max number of XEL on DYNAMIXEL protocol #define DXL_MAX_NODE_BUFFER_SIZE 32 #else diff --git a/src/utility/slave.cpp b/src/utility/slave.cpp index 58596be..19c5fde 100644 --- a/src/utility/slave.cpp +++ b/src/utility/slave.cpp @@ -24,7 +24,7 @@ Slave::Slave(DXLPortHandler &port, const uint16_t model_num, float protocol_ver) setPortProtocolVersion(protocol_ver); addDefaultControlItem(); - p_packet_buf_ = new uint8_t[DEFAULT_DXL_BUF_LENGTH]; + p_packet_buf_ = new uint8_t[DEFAULT_DXL_BUF_LENGTH + DXL_BYTE_STUFF_SAFE_CNT]; if(p_packet_buf_ != nullptr){ packet_buf_capacity_ = DEFAULT_DXL_BUF_LENGTH; is_buf_malloced_ = true; @@ -42,7 +42,7 @@ Slave::Slave(const uint16_t model_num, float protocol_ver) setPortProtocolVersion(protocol_ver); addDefaultControlItem(); - p_packet_buf_ = new uint8_t[DEFAULT_DXL_BUF_LENGTH]; + p_packet_buf_ = new uint8_t[DEFAULT_DXL_BUF_LENGTH + DXL_BYTE_STUFF_SAFE_CNT]; if(p_packet_buf_ != nullptr){ packet_buf_capacity_ = DEFAULT_DXL_BUF_LENGTH; is_buf_malloced_ = true; @@ -432,7 +432,7 @@ Slave::processInstRead() if(addr_length+11 > packet_buf_capacity_){ err = DXL_LIB_ERROR_NOT_ENOUGH_BUFFER_SIZE; } - p_tx_param = &p_packet_buf_[9]; + p_tx_param = &p_packet_buf_[9 + DXL_BYTE_STUFF_SAFE_CNT]; }else{ err = DXL_LIB_ERROR_WRONG_PACKET; } @@ -443,7 +443,7 @@ Slave::processInstRead() if(addr_length+6 > packet_buf_capacity_){ err = DXL_LIB_ERROR_NOT_ENOUGH_BUFFER_SIZE; } - p_tx_param = &p_packet_buf_[5]; + p_tx_param = &p_packet_buf_[5 + DXL_BYTE_STUFF_SAFE_CNT]; }else{ err = DXL_LIB_ERROR_WRONG_PACKET; } From 3b2c44f019db921c47cf61fe8aab01bcc870e8f5 Mon Sep 17 00:00:00 2001 From: Will Son Date: Fri, 27 Jan 2023 16:47:50 +0900 Subject: [PATCH 2/2] prepare release 0.6.2 Signed-off-by: Will Son --- CONTRIBUTING.md | 18 ++++++++++++++++++ CONTRIBUTIONS.txt | 0 library.properties | 2 +- 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 CONTRIBUTING.md delete mode 100644 CONTRIBUTIONS.txt diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..09362a2 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,18 @@ +Any contribution that you make to this repository will +be under the Apache 2 License, as dictated by that +[license](http://www.apache.org/licenses/LICENSE-2.0.html): + +~~~ +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. +~~~ + +Contributors must sign-off each commit by adding a `Signed-off-by: ...` +line to commit messages to certify that they have the right to submit +the code they are contributing to the project according to the +[Developer Certificate of Origin (DCO)](https://developercertificate.org/). \ No newline at end of file diff --git a/CONTRIBUTIONS.txt b/CONTRIBUTIONS.txt deleted file mode 100644 index e69de29..0000000 diff --git a/library.properties b/library.properties index 89d1c71..17ab006 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Dynamixel2Arduino -version=0.6.1 +version=0.6.2 author=ROBOTIS license=Apache-2.0 maintainer=Will Son(willson@robotis.com)