Optimierung LSP Schnittstelle
This commit is contained in:
14
main.py
14
main.py
@@ -445,23 +445,19 @@ class ArduinoGUI:
|
||||
if self.ser.in_waiting:
|
||||
try:
|
||||
command = ""
|
||||
command = self.ser.read().decode(errors='ignore').strip()
|
||||
while self.ser.in_waiting:
|
||||
pass
|
||||
print(command)
|
||||
command += self.ser.read(1).decode(errors='ignore').strip()
|
||||
if command[0] == 'a':
|
||||
message = f"{self.current_angle};{self.current_torque};{self.analogInput};{self.currentSetpoint};{self.currentOutput}\n"
|
||||
self.ser.write(message.encode())
|
||||
if command[0] == 'w':
|
||||
self.tare_angle()
|
||||
if command[0] == 'u':
|
||||
outCommand = F"{command}\n"
|
||||
self.arduino.write(outCommand.encode())
|
||||
outCommand = F"command: {command}\n"
|
||||
selr.arduino.write(outCommand.encode())
|
||||
time.sleep(0.1)
|
||||
|
||||
while self.ser.out_waiting:
|
||||
pass
|
||||
self.ser.read_all()
|
||||
|
||||
self.ser.read()
|
||||
except Exception as e:
|
||||
print(e)
|
||||
#self.ser.write(b'Hallo\n')
|
||||
|
||||
Reference in New Issue
Block a user