Skip to content

Commit d6d245c

Browse files
committed
ad mercury socket
1 parent aead163 commit d6d245c

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

pymycobot/common.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ def _process_data_command(self, genre, _class, args):
316316
processed_args = []
317317
for index in range(len(args)):
318318
if isinstance(args[index], list):
319-
if genre == ProtocolCode.SET_ENCODERS_DRAG and index == 0 and _class == "Mercury":
319+
if genre == ProtocolCode.SET_ENCODERS_DRAG and index == 0 and _class in ["Mercury", "MercurySocket"]:
320320
for data in args[index]:
321321
byte_value = data.to_bytes(4, byteorder='big', signed=True)
322322
res = []
@@ -329,7 +329,7 @@ def _process_data_command(self, genre, _class, args):
329329
if isinstance(args[index], str):
330330
processed_args.append(args[index])
331331
else:
332-
if genre == ProtocolCode.SET_SERVO_DATA and _class == "Mercury" and index == 2:
332+
if genre == ProtocolCode.SET_SERVO_DATA and _class in ["Mercury", "MercurySocket"] and index == 2:
333333
byte_value = args[index].to_bytes(2, byteorder='big', signed=True)
334334
res = []
335335
for i in range(len(byte_value)):
@@ -540,7 +540,7 @@ def read(self, genre, method=None, command=None, _class=None):
540540
while True and time.time() - t < wait_time:
541541
data = self._serial_port.read()
542542
k += 1
543-
if _class == "Mercury":
543+
if _class in ["Mercury", "MercurySocket"]:
544544
if data_len == 3:
545545
datas += data
546546
crc = self._serial_port.read(2)

pymycobot/error.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ def calibration_parameters(**kwargs):
200200
robot_limit = json.load(f)
201201
parameter_list = list(kwargs.keys())
202202
class_name = kwargs.get("class_name", None)
203-
if class_name == "Mercury":
203+
if class_name in ["Mercury", "MercurySocket"]:
204204
for parameter in parameter_list[1:]:
205205
value = kwargs.get(parameter, None)
206206
if parameter == 'id' and value not in robot_limit[class_name][parameter]:

pymycobot/generate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def _mesg(self, genre, *args, **kwargs):
125125
]
126126
if command_data:
127127
command.extend(command_data)
128-
if self.__class__.__name__ == "Mercury":
128+
if self.__class__.__name__ in ["Mercury", "MercurySocket"]:
129129
command[2] += 1
130130
command.extend(self.crc_check(command))
131131
else:

0 commit comments

Comments
 (0)