Skip to content

Commit 2c28dbe

Browse files
committed
[Fix] Fixed library error code for not supported models for getHardwareError()
Signed-off-by: Jonghee Son <zzongaone@gmail.com>
1 parent 7d72cc6 commit 2c28dbe

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

src/Dynamixel2Arduino.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -918,15 +918,18 @@ bool Dynamixel2Arduino::getTorqueEnableStat(uint8_t id)
918918
uint8_t Dynamixel2Arduino::getHardwareError(uint8_t id)
919919
{
920920
uint16_t model_num = getModelNumberFromTable(id);
921+
uint8_t ret = 0;
921922

922923
if(model_num == AX12A || model_num == AX12W || model_num == AX18A || model_num == DX113 || model_num == DX116 || model_num == DX117 || model_num == RX10 || model_num == RX24F || model_num == RX28 || model_num == RX64 || model_num == EX106 || model_num == MX12W || model_num == MX28 || model_num == MX64 || model_num == MX106 || model_num == XL320)
923924
{
924-
setLastLibErrCode(DXL_LIB_ERROR_INVAILD_PROTOCOL_VERSION);
925-
926-
return 0;
925+
setLastLibErrCode(DXL_LIB_ERROR_NOT_SUPPORTED);
926+
}
927+
else
928+
{
929+
ret = (uint8_t)readControlTableItem(ControlTableItem::HARDWARE_ERROR_STATUS, id);
927930
}
928931

929-
return readControlTableItem(ControlTableItem::HARDWARE_ERROR_STATUS, id);
932+
return ret;
930933
}
931934

932935
int32_t Dynamixel2Arduino::readControlTableItem(uint8_t item_idx, uint8_t id, uint32_t timeout)

0 commit comments

Comments
 (0)