@@ -446,6 +446,10 @@ int Protocol2PacketHandler::txRxPacket(PortHandler *port, uint8_t *txpacket, uin
446446 {
447447 port->setPacketTimeout ((uint16_t )(DXL_MAKEWORD (txpacket[PKT_PARAMETER0+2 ], txpacket[PKT_PARAMETER0+3 ]) + 11 ));
448448 }
449+ else if (txpacket[PKT_INSTRUCTION] == INST_CLEAR)
450+ {
451+ port->setPacketTimeout ((double )10000 );
452+ }
449453 else
450454 {
451455 port->setPacketTimeout ((uint16_t )11 );
@@ -633,6 +637,24 @@ int Protocol2PacketHandler::clearMultiTurn(PortHandler *port, uint8_t id, uint8_
633637 return txRxPacket (port, txpacket, rxpacket, error);
634638}
635639
640+ int Protocol2PacketHandler::clearError (PortHandler *port, uint8_t id, uint8_t *error)
641+ {
642+ uint8_t txpacket[15 ] = {0 };
643+ uint8_t rxpacket[11 ] = {0 };
644+
645+ txpacket[PKT_ID] = id;
646+ txpacket[PKT_LENGTH_L] = 8 ;
647+ txpacket[PKT_LENGTH_H] = 0 ;
648+ txpacket[PKT_INSTRUCTION] = INST_CLEAR;
649+ txpacket[PKT_PARAMETER0] = 0x02 ;
650+ txpacket[PKT_PARAMETER0+1 ] = 0x45 ;
651+ txpacket[PKT_PARAMETER0+2 ] = 0x52 ;
652+ txpacket[PKT_PARAMETER0+3 ] = 0x43 ;
653+ txpacket[PKT_PARAMETER0+4 ] = 0x4C ;
654+
655+ return txRxPacket (port, txpacket, rxpacket, error);
656+ }
657+
636658int Protocol2PacketHandler::factoryReset (PortHandler *port, uint8_t id, uint8_t option, uint8_t *error)
637659{
638660 uint8_t txpacket[11 ] = {0 };
0 commit comments