@@ -306,28 +306,33 @@ def _mesg(self, genre, *args, **kwargs):
306306 """
307307 command_data = self ._process_data_command (genre , self .__class__ .__name__ , args )
308308 if genre == 178 :
309+ # 修改wifi端口
309310 command_data = self ._encode_int16 (command_data )
311+
310312 elif genre in [76 , 77 ]:
311- command_data = [command_data [0 ]] + self ._encode_int16 (command_data [1 ] * 10 )
312- elif genre == 115 and self .__class__ .__name__ != " MyArmM" :
313- command_data = [command_data [1 ], command_data [3 ]]
313+ command_data = [command_data [0 ]] + self ._encode_int16 (command_data [1 ]* 10 )
314+ elif genre == 115 and self .__class__ .__name__ not in [ "MyArmC" , " MyArmM"] :
315+ command_data = [command_data [1 ],command_data [3 ]]
314316 LEN = len (command_data ) + 2
317+
315318 command = [
316- ProtocolCode .HEADER ,
317- ProtocolCode .HEADER ,
318- LEN ,
319- genre ,
320- ]
319+ ProtocolCode .HEADER ,
320+ ProtocolCode .HEADER ,
321+ LEN ,
322+ genre ,
323+ ]
321324 if command_data :
322325 command .extend (command_data )
323326 if self .__class__ .__name__ in ["Mercury" , "MercurySocket" ]:
324327 command [2 ] += 1
325328 command .extend (self .crc_check (command ))
326329 else :
327330 command .append (ProtocolCode .FOOTER )
331+
328332 real_command = self ._flatten (command )
329333 has_reply = kwargs .get ("has_reply" , False )
330334 return real_command , has_reply
335+
331336 # Functional approach
332337 def _encode_int8 (self , data ):
333338 return struct .pack ("b" , data )
@@ -653,9 +658,7 @@ def read(self, genre, method=None, command=None, _class=None, timeout=None):
653658 t = time .time ()
654659 wait_time = 0.1
655660 if method is not None :
656- wait_time = 0.3
657- if genre == ProtocolCode .GO_ZERO :
658- wait_time = 120
661+ wait_time = 0.3
659662 if timeout is not None :
660663 wait_time = timeout
661664 if _class in ["Mercury" , "MercurySocket" ]:
@@ -753,4 +756,4 @@ def read(self, genre, method=None, command=None, _class=None, timeout=None):
753756 command_log += hex (d )[2 :] + " "
754757 self .log .debug ("_read : {}" .format (command_log ))
755758
756- return datas
759+ return datas
0 commit comments