USB Kommunikation zur LSP1 eingeführt.

This commit is contained in:
2024-07-17 16:38:07 +02:00
parent bcb45f3174
commit 678357b838

19
main.py
View File

@@ -19,6 +19,15 @@ class ArduinoGUI:
self.root.title("PRG 342 GUI")
self.root.attributes('-fullscreen', True) # Setzt das Fenster in den Vollbildmodus
self.ser = serial.Serial(
port='/dev/serial0',
baudrate=192000,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS,
timeout=1
)
self.arduino = None
self.ports = list(serial.tools.list_ports.comports())
self.running = True
@@ -41,6 +50,8 @@ class ArduinoGUI:
self.load_configurations()
# Start the communication thread
self.lsp_communication_tread = threading.Thread(target=self.lsp_communication_loop)
self.lsp_communication_tread.start()
self.communication_thread = threading.Thread(target=self.communication_loop)
self.communication_thread.start()
@@ -406,6 +417,14 @@ class ArduinoGUI:
time.sleep(0.1)
def lsp_communication_loop(self):
while self.running:
if self.ser:
if self.ser.in_waiting:
command = self.ser.readline
self.ser.write(command)
def send_pid_parameters(self):
if self.selected_pid in self.pid_params:
pid_values = self.pid_params[self.selected_pid]