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:
|
if self.ser.in_waiting:
|
||||||
try:
|
try:
|
||||||
command = ""
|
command = ""
|
||||||
command = self.ser.read().decode(errors='ignore').strip()
|
|
||||||
while self.ser.in_waiting:
|
while self.ser.in_waiting:
|
||||||
pass
|
command += self.ser.read(1).decode(errors='ignore').strip()
|
||||||
print(command)
|
|
||||||
if command[0] == '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':
|
||||||
self.tare_angle()
|
self.tare_angle()
|
||||||
if command[0] == 'u':
|
if command[0] == 'u':
|
||||||
outCommand = F"{command}\n"
|
outCommand = F"command: {command}\n"
|
||||||
self.arduino.write(outCommand.encode())
|
selr.arduino.write(outCommand.encode())
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
|
|
||||||
while self.ser.out_waiting:
|
self.ser.read()
|
||||||
pass
|
|
||||||
self.ser.read_all()
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
#self.ser.write(b'Hallo\n')
|
#self.ser.write(b'Hallo\n')
|
||||||
|
|||||||
Reference in New Issue
Block a user