Commit 9c55957e authored by D1plo1d's avatar D1plo1d

Patching disconnect to stop the print_thread

By setting printing to false and not restarting the sender thread when the print_thread exits in the disconnect method this should allow printcore to disconnect even if the print thread is running.

In particular this makes it possible to ctrl+c out of prontserve durring an m109 where it previously errored out and hung with the following error:

Can't read from printer (disconnected?) (SerialException): device reports readiness to read but returned no data (device disconnected?)
parent 2e10c296
......@@ -103,6 +103,9 @@ class printcore():
self.read_thread.join()
self.read_thread = None
self._stop_sender()
if self.print_thread:
self.printing = False
self.print_thread.join()
try:
self.printer.close()
except socket.error:
......@@ -426,7 +429,7 @@ class printcore():
traceback.print_exc()
finally:
self.print_thread = None
self._start_sender()
if self.stop_send_thread == False: self._start_sender()
#now only "pause" is implemented as host command
def processHostCommand(self, command):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment