Simplify split_int_bytes
This commit is contained in:
parent
1f1e1bcfe8
commit
a2f5c34625
|
@ -100,14 +100,9 @@ class DynamixelMotorsBus(MotorsBus):
|
||||||
# Note: No need to convert back into unsigned int, since this byte preprocessing
|
# Note: No need to convert back into unsigned int, since this byte preprocessing
|
||||||
# already handles it for us.
|
# already handles it for us.
|
||||||
if n_bytes == 1:
|
if n_bytes == 1:
|
||||||
data = [
|
data = [value]
|
||||||
dxl.DXL_LOBYTE(dxl.DXL_LOWORD(value)),
|
|
||||||
]
|
|
||||||
elif n_bytes == 2:
|
elif n_bytes == 2:
|
||||||
data = [
|
data = [dxl.DXL_LOBYTE(value), dxl.DXL_HIBYTE(value)]
|
||||||
dxl.DXL_LOBYTE(dxl.DXL_LOWORD(value)),
|
|
||||||
dxl.DXL_HIBYTE(dxl.DXL_LOWORD(value)),
|
|
||||||
]
|
|
||||||
elif n_bytes == 4:
|
elif n_bytes == 4:
|
||||||
data = [
|
data = [
|
||||||
dxl.DXL_LOBYTE(dxl.DXL_LOWORD(value)),
|
dxl.DXL_LOBYTE(dxl.DXL_LOWORD(value)),
|
||||||
|
|
|
@ -88,14 +88,9 @@ class FeetechMotorsBus(MotorsBus):
|
||||||
# Note: No need to convert back into unsigned int, since this byte preprocessing
|
# Note: No need to convert back into unsigned int, since this byte preprocessing
|
||||||
# already handles it for us.
|
# already handles it for us.
|
||||||
if n_bytes == 1:
|
if n_bytes == 1:
|
||||||
data = [
|
data = [value]
|
||||||
scs.SCS_LOBYTE(scs.SCS_LOWORD(value)),
|
|
||||||
]
|
|
||||||
elif n_bytes == 2:
|
elif n_bytes == 2:
|
||||||
data = [
|
data = [scs.SCS_LOBYTE(value), scs.SCS_HIBYTE(value)]
|
||||||
scs.SCS_LOBYTE(scs.SCS_LOWORD(value)),
|
|
||||||
scs.SCS_HIBYTE(scs.SCS_LOWORD(value)),
|
|
||||||
]
|
|
||||||
elif n_bytes == 4:
|
elif n_bytes == 4:
|
||||||
data = [
|
data = [
|
||||||
scs.SCS_LOBYTE(scs.SCS_LOWORD(value)),
|
scs.SCS_LOBYTE(scs.SCS_LOWORD(value)),
|
||||||
|
|
Loading…
Reference in New Issue