From 5711f591a355106f533a752f1e43fa0df9cb732e Mon Sep 17 00:00:00 2001 From: = <=> Date: Wed, 21 Aug 2024 15:21:24 -0500 Subject: [PATCH] Fixed issue recovering from disconnect or sleep --- drawing.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drawing.py b/drawing.py index c79b861..f116202 100644 --- a/drawing.py +++ b/drawing.py @@ -195,10 +195,11 @@ def init_device(location = "1-4.2"): class DrawingThread(threading.Thread): - def __init__(self, serial_port, input_queue): + def __init__(self, port_location, input_queue): super().__init__() self.daemon = True - self.serial_port = init_device(serial_port) + self.port_location = port_location + self.serial_port = init_device(self.port_location) self.input_queue = input_queue def run(self): @@ -210,5 +211,5 @@ class DrawingThread(threading.Thread): print(f"Error in DrawingThread: {e}") del self.serial_port time.sleep(1.0) - self.serial_port = init_device(self.serial_port) + self.serial_port = init_device(self.port_location)