Fixed issue recovering from disconnect or sleep
This commit is contained in:
parent
72063ba9c6
commit
5711f591a3
@ -195,10 +195,11 @@ def init_device(location = "1-4.2"):
|
|||||||
|
|
||||||
|
|
||||||
class DrawingThread(threading.Thread):
|
class DrawingThread(threading.Thread):
|
||||||
def __init__(self, serial_port, input_queue):
|
def __init__(self, port_location, input_queue):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.daemon = True
|
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
|
self.input_queue = input_queue
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
@ -210,5 +211,5 @@ class DrawingThread(threading.Thread):
|
|||||||
print(f"Error in DrawingThread: {e}")
|
print(f"Error in DrawingThread: {e}")
|
||||||
del self.serial_port
|
del self.serial_port
|
||||||
time.sleep(1.0)
|
time.sleep(1.0)
|
||||||
self.serial_port = init_device(self.serial_port)
|
self.serial_port = init_device(self.port_location)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user