optimierung

This commit is contained in:
2024-07-18 10:15:42 +02:00
parent 5531952667
commit eae3d4bae1

View File

@@ -450,12 +450,12 @@ class ArduinoGUI:
if self.ser: if self.ser:
if self.ser.in_waiting: if self.ser.in_waiting:
try: try:
command = self.ser.read(2).decode(errors='ignore').strip() command = self.ser.readline().decode(errors='ignore').strip()
print(command) print(command)
if command == 'a': if command == 'a':
message = f"{self.current_angle};{self.current_torque};{self.analogInput};{self.currentSetpoint};{self.currentOutput}\n" message = f"{self.current_angle};{self.current_torque};{self.analogInput};{self.currentSetpoint};{self.currentOutput}\n"
self.ser.write(message.encode()) self.ser.write(message.encode())
time.sleep(1) time.sleep(0.1)
while self.ser.out_waiting: while self.ser.out_waiting:
pass pass
except Exception as e: except Exception as e: