USB Kommunikation zur LSP1 eingeführt.
This commit is contained in:
19
main.py
19
main.py
@@ -19,6 +19,15 @@ class ArduinoGUI:
|
|||||||
self.root.title("PRG 342 GUI")
|
self.root.title("PRG 342 GUI")
|
||||||
self.root.attributes('-fullscreen', True) # Setzt das Fenster in den Vollbildmodus
|
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.arduino = None
|
||||||
self.ports = list(serial.tools.list_ports.comports())
|
self.ports = list(serial.tools.list_ports.comports())
|
||||||
self.running = True
|
self.running = True
|
||||||
@@ -41,6 +50,8 @@ class ArduinoGUI:
|
|||||||
self.load_configurations()
|
self.load_configurations()
|
||||||
|
|
||||||
# Start the communication thread
|
# 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 = threading.Thread(target=self.communication_loop)
|
||||||
self.communication_thread.start()
|
self.communication_thread.start()
|
||||||
|
|
||||||
@@ -406,6 +417,14 @@ class ArduinoGUI:
|
|||||||
|
|
||||||
time.sleep(0.1)
|
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):
|
def send_pid_parameters(self):
|
||||||
if self.selected_pid in self.pid_params:
|
if self.selected_pid in self.pid_params:
|
||||||
pid_values = self.pid_params[self.selected_pid]
|
pid_values = self.pid_params[self.selected_pid]
|
||||||
|
|||||||
Reference in New Issue
Block a user