Skip to content

Commit 91cd91f

Browse files
committed
[fix] fix get_servo_version
1 parent 54d6c7d commit 91cd91f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

xarm/x3/servo.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -363,16 +363,16 @@ def _get_servo_version(id_num):
363363
ret3 = self.get_servo_addr_16(id_num, 0x0803)
364364

365365
code = 0
366-
if ret1[0] in [0, 1, 2] and len(ret1) > 1 and ret1[1] < 1000:
367-
versions[0] = ret1[1]
366+
if ret1[0] in [0, 1, 2] and len(ret1) > 1:
367+
versions[0] = ret1[1] if abs(ret1[1]) < 1000 else 0
368368
else:
369369
code = ret1[0]
370-
if ret2[0] in [0, 1, 2] and len(ret2) > 1 and ret2[1] < 1000:
371-
versions[1] = ret2[1]
370+
if ret2[0] in [0, 1, 2] and len(ret2) > 1:
371+
versions[1] = ret2[1] if abs(ret2[1]) < 1000 else 0
372372
else:
373373
code = ret2[0]
374-
if ret3[0] in [0, 1, 2] and len(ret3) > 1 and ret3[1] < 1000:
375-
versions[2] = ret3[1]
374+
if ret3[0] in [0, 1, 2] and len(ret3) > 1:
375+
versions[2] = ret3[1] if abs(ret3[1]) < 1000 else 0
376376
else:
377377
code = ret3[0]
378378
# if code != 0:

0 commit comments

Comments
 (0)