Optimierung der LSP Schnittstelle

This commit is contained in:
2024-07-22 11:55:41 +02:00
parent f8d788d92e
commit 451cd9bc68

View File

@@ -445,11 +445,11 @@ class ArduinoGUI:
if self.ser.in_waiting: if self.ser.in_waiting:
try: try:
command = "" command = ""
command = self.ser.read_all().decode(errors='ignore').strip() command = self.ser.read().decode(errors='ignore').strip()
while self.ser.in_waiting: while self.ser.in_waiting:
pass pass
print(command) print(command)
if command[1] == 'a': if command[0] == '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())
if command[0] == 'w': if command[0] == 'w':