Correct runze pump multiple receive method.

This commit is contained in:
Xuwznln
2025-09-14 03:07:48 +08:00
parent 9e214c56c1
commit b600fc666d

View File

@@ -145,6 +145,16 @@ class RunzeMultiplePump:
total_steps_vel = 48000 if mode == RunzeSyringePumpMode.AccuratePosVel else 6000 total_steps_vel = 48000 if mode == RunzeSyringePumpMode.AccuratePosVel else 6000
return total_steps, total_steps_vel return total_steps, total_steps_vel
def _receive(self, data: bytes) -> str:
"""
Keep this method as original. Always use chr to decode, avoid "/0"
"""
if not data:
return ""
# **Do not use decode method
ascii_string = "".join(chr(byte) for byte in data)
return ascii_string
def send_command(self, full_command: str) -> str: def send_command(self, full_command: str) -> str:
"""Send command to hardware and get response""" """Send command to hardware and get response"""
full_command_data = bytearray(full_command, "ascii") full_command_data = bytearray(full_command, "ascii")
@@ -175,11 +185,6 @@ class RunzeMultiplePump:
output = self.send_command(full_command)[3:-3] output = self.send_command(full_command)[3:-3]
return output return output
def _receive(self, data: bytes) -> str:
if not data:
return ""
ascii_string = "".join(chr(byte) for byte in data) # *Do not use decode('ascii', errors='ignore')
return ascii_string
def _run(self, address: str, command: str) -> str: def _run(self, address: str, command: str) -> str:
""" """