Refactor feetech _broadcast_ping

This commit is contained in:
Simon Alibert
2025-06-04 16:41:33 +02:00
parent 9571a713df
commit a32d988536

View File

@@ -358,13 +358,10 @@ class FeetechMotorsBus(MotorsBus):
self.port_handler.setPacketTimeoutMillis((wait_length * tx_time_per_byte) + (3.0 * scs.MAX_ID) + 16.0)
rxpacket = []
while True:
while not self.port_handler.isPacketTimeout() and rx_length < wait_length:
rxpacket += self.port_handler.readPort(wait_length - rx_length)
rx_length = len(rxpacket)
if self.port_handler.isPacketTimeout(): # or rx_length >= wait_length
break
self.port_handler.is_using = False
if rx_length == 0: