aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/klippy.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2016-11-30 19:05:25 -0500
committerKevin O'Connor <kevin@koconnor.net>2016-11-30 21:20:09 -0500
commit5ebe8ce0259443b4f5924ed019b305627f73bc7c (patch)
tree6dfcd1a466f3e3fd3b4247a6323e41966199a479 /klippy/klippy.py
parent17dcb4275246a3826766d2b102b26ad6b3e931a6 (diff)
downloadkutter-5ebe8ce0259443b4f5924ed019b305627f73bc7c.tar.gz
kutter-5ebe8ce0259443b4f5924ed019b305627f73bc7c.tar.xz
kutter-5ebe8ce0259443b4f5924ed019b305627f73bc7c.zip
gcode: Don't dump the message log directly from set_printer_ready()
The set_printer_ready() method can be called from a background thread. Have the main Printer class call a new dump_debug() method in the main thread on a shutdown event. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/klippy.py')
-rw-r--r--klippy/klippy.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/klippy/klippy.py b/klippy/klippy.py
index 9b7a68ab..0dbc8f60 100644
--- a/klippy/klippy.py
+++ b/klippy/klippy.py
@@ -82,6 +82,7 @@ class Printer:
self.connect_timer = self.reactor.register_timer(
self.connect, self.reactor.NOW)
self.all_config_options = {}
+ self.need_dump_debug = False
self.state_message = message_startup
self.debugoutput = self.dictionary = None
self.fileconfig = None
@@ -91,6 +92,10 @@ class Printer:
self.debugoutput = debugoutput
self.dictionary = dictionary
def stats(self, eventtime):
+ if self.need_dump_debug:
+ # Call dump_debug here so it is executed in the main thread
+ self.gcode.dump_debug()
+ self.need_dump_debug = False
out = []
out.append(self.gcode.stats(eventtime))
toolhead = self.objects.get('toolhead')
@@ -174,6 +179,8 @@ class Printer:
def get_state_message(self):
return self.state_message
def note_shutdown(self, msg):
+ if self.state_message == 'Running':
+ self.need_dump_debug = True
self.state_message = "Firmware shutdown: %s%s" % (
msg, message_shutdown)
self.gcode.set_printer_ready(False)