ROBOTIS-GIT / Dynamixel2Arduino

DYNAMIXEL protocol library for Arduino
Apache License 2.0
88 stars 55 forks source link

Something confused about `byte_stuffing_cnt` #117

Open Bozenton opened 1 year ago

Bozenton commented 1 year ago

Hi there,

Thanks for your code. When I was reading your code, I noticed that you declared byte_stuffing_cnt as a private variable of the function:

https://github.com/ROBOTIS-GIT/Dynamixel2Arduino/blob/06c06f94edfc749749ee33396e4166873df9833e/src/dxl_c/protocol.c#L506-L509

as far as I know from your repo, this function parse_dxl2_0_packet is called when a byte is received. So each time it is called, the variable byte_stuffing_cnt would reset to 0, which, I think, may cause bad influence on this line if there are many 'byte stuffing' in the packet:

https://github.com/ROBOTIS-GIT/Dynamixel2Arduino/blob/06c06f94edfc749749ee33396e4166873df9833e/src/dxl_c/protocol.c#L669

Is it a bug or is there something wrong with my understanding? Hope for your reply sincerely.