Skip to content
Merged
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Dynamixel2Arduino
version=0.8.0
version=0.8.1
author=ROBOTIS
license=Apache-2.0
maintainer=Sookyung Son([email protected])
Expand Down
8 changes: 4 additions & 4 deletions src/Dynamixel2Arduino.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -610,14 +610,14 @@ bool Dynamixel2Arduino::setLedState(uint8_t id, bool state)
case PRO_M54P_040_S250_R:
case PRO_M54P_060_S250_R:
if (state == false) {
writeControlTableItem(ControlTableItem::LED_GREEN, id, state);
writeControlTableItem(ControlTableItem::LED_BLUE, id, state);
writeControlTableItem(ControlTableItem::DXL_LED_GREEN, id, state);
writeControlTableItem(ControlTableItem::DXL_LED_BLUE, id, state);
}
ret = writeControlTableItem(ControlTableItem::LED_RED, id, state);
ret = writeControlTableItem(ControlTableItem::DXL_LED_RED, id, state);
break;

default:
ret = writeControlTableItem(ControlTableItem::LED, id, state);
ret = writeControlTableItem(ControlTableItem::DXL_LED, id, state);
break;
}

Expand Down
24 changes: 12 additions & 12 deletions src/actuator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const ModelControlTableInfo_t control_table_1_0[] PROGMEM = {
{ControlTableItem::SHUTDOWN, 18, 1},

{ControlTableItem::TORQUE_ENABLE, 24, 1},
{ControlTableItem::LED, 25, 1},
{ControlTableItem::DXL_LED, 25, 1},
{ControlTableItem::CW_COMPLIANCE_MARGIN, 26, 1},
{ControlTableItem::CCW_COMPLIANCE_MARGIN, 27, 1},
{ControlTableItem::CW_COMPLIANCE_SLOPE, 28, 1},
Expand Down Expand Up @@ -85,7 +85,7 @@ const ModelControlTableInfo_t control_table_1_1[] PROGMEM = {
{ControlTableItem::RESOLUTION_DIVIDER, 22, 1},

{ControlTableItem::TORQUE_ENABLE, 24, 1},
{ControlTableItem::LED, 25, 1},
{ControlTableItem::DXL_LED, 25, 1},
{ControlTableItem::D_GAIN, 26, 1},
{ControlTableItem::I_GAIN, 27, 1},
{ControlTableItem::P_GAIN, 28, 1},
Expand Down Expand Up @@ -144,7 +144,7 @@ const ModelControlTableInfo_t xl320_control_table[] PROGMEM = {
{ControlTableItem::SHUTDOWN, 18, 1},

{ControlTableItem::TORQUE_ENABLE, 24, 1},
{ControlTableItem::LED, 25, 1},
{ControlTableItem::DXL_LED, 25, 1},
{ControlTableItem::D_GAIN, 27, 1},
{ControlTableItem::I_GAIN, 28, 1},
{ControlTableItem::P_GAIN, 29, 1},
Expand Down Expand Up @@ -197,7 +197,7 @@ const ModelControlTableInfo_t control_table_2_0[] PROGMEM = {
{ControlTableItem::SHUTDOWN, 63, 1},

{ControlTableItem::TORQUE_ENABLE, 64, 1},
{ControlTableItem::LED, 65, 1},
{ControlTableItem::DXL_LED, 65, 1},
{ControlTableItem::STATUS_RETURN_LEVEL, 68, 1},
{ControlTableItem::REGISTERED_INSTRUCTION, 69, 1},
{ControlTableItem::HARDWARE_ERROR_STATUS, 70, 1},
Expand Down Expand Up @@ -319,9 +319,9 @@ const ModelControlTableInfo_t pro_r_control_table[] PROGMEM = {
{ControlTableItem::SHUTDOWN, 48, 1},

{ControlTableItem::TORQUE_ENABLE, 562, 1},
{ControlTableItem::LED_RED, 563, 1},
{ControlTableItem::LED_GREEN, 564, 1},
{ControlTableItem::LED_BLUE, 565, 1},
{ControlTableItem::DXL_LED_RED, 563, 1},
{ControlTableItem::DXL_LED_GREEN, 564, 1},
{ControlTableItem::DXL_LED_BLUE, 565, 1},
{ControlTableItem::VELOCITY_I_GAIN, 586, 2},
{ControlTableItem::VELOCITY_P_GAIN, 588, 2},
{ControlTableItem::POSITION_P_GAIN, 594, 2},
Expand Down Expand Up @@ -377,9 +377,9 @@ const ModelControlTableInfo_t pro_ra_pro_plus_control_table[] PROGMEM = {
{ControlTableItem::SHUTDOWN, 63, 1},

{ControlTableItem::TORQUE_ENABLE, 512, 1},
{ControlTableItem::LED_RED, 513, 1},
{ControlTableItem::LED_GREEN, 514, 1},
{ControlTableItem::LED_BLUE, 515, 1},
{ControlTableItem::DXL_LED_RED, 513, 1},
{ControlTableItem::DXL_LED_GREEN, 514, 1},
{ControlTableItem::DXL_LED_BLUE, 515, 1},
{ControlTableItem::STATUS_RETURN_LEVEL, 516, 1},
{ControlTableItem::REGISTERED_INSTRUCTION, 517, 1},
{ControlTableItem::HARDWARE_ERROR_STATUS, 518, 1},
Expand Down Expand Up @@ -475,7 +475,7 @@ const ModelControlTableInfo_t y_control_table[] PROGMEM = {
{ControlTableItem::PROFILE_ACCELERATION_TIME, 248, 4},
{ControlTableItem::PROFIIE_TIME, 252, 4},
{ControlTableItem::TORQUE_ENABLE, 512, 1},
{ControlTableItem::LED, 513, 1},
{ControlTableItem::DXL_LED, 513, 1},
{ControlTableItem::PWM_OFFSET, 516, 2},
{ControlTableItem::CURRENT_OFFSET, 518, 2},
{ControlTableItem::VELOCITY_OFFSET, 520, 4},
Expand All @@ -493,7 +493,7 @@ const ModelControlTableInfo_t y_control_table[] PROGMEM = {
{ControlTableItem::VELOCITY_TRAJECTORY, 564, 4},
{ControlTableItem::PRESENT_INPUT_VOLTAGE, 568, 2},
{ControlTableItem::PRESENT_TEMPERATURE, 570, 1}, // Present Inverter Temperature
{ControlTableItem::PRESENT_MOTOR_TEMPERATURE, 571, 4},
{ControlTableItem::PRESENT_MOTOR_TEMPERATURE, 571, 1},

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This correction of the data width for PRESENT_MOTOR_TEMPERATURE from 4 bytes to 1 byte for the DYNAMIXEL-Y series is an important fix. It aligns with the e-Manual (address 571, size 1 byte) and is crucial for ensuring accurate motor temperature readings. An incorrect data width here would lead to erroneous temperature values and could potentially affect other operations if data is read in bulk. Great catch!

#endif
{ControlTableItem::LAST_DUMMY_ITEM, 0, 0}
};
Expand Down
8 changes: 4 additions & 4 deletions src/actuator.h
Original file line number Diff line number Diff line change
Expand Up @@ -331,10 +331,10 @@ namespace ControlTableItem{
SHUTDOWN,

TORQUE_ENABLE,
LED,
LED_RED,
LED_GREEN,
LED_BLUE,
DXL_LED,
DXL_LED_RED,
DXL_LED_GREEN,
DXL_LED_BLUE,
Comment on lines +334 to +337

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Renaming the LED-related enum members from LED, LED_RED, LED_GREEN, LED_BLUE to DXL_LED, DXL_LED_RED, DXL_LED_GREEN, DXL_LED_BLUE respectively is a solid improvement.

This DXL_ prefix offers several benefits:

  • Clarity: It explicitly indicates that these constants relate to the Dynamixel's LED.
  • Collision Avoidance: This is likely the key to fixing the build error on ARM Cortex-M platforms (like the Arduino UNO R4). Generic names like LED are prone to collisions with macros or constants defined in Arduino core libraries or other third-party libraries, especially across different microcontroller architectures.
  • Maintainability: It makes the codebase easier to understand and maintain.

This change significantly enhances the library's robustness and portability.

REGISTERED_INSTRUCTION,
HARDWARE_ERROR_STATUS,
VELOCITY_P_GAIN,
Expand Down