aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/gcode.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/gcode.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/gcode.py')
-rw-r--r--klippy/gcode.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/klippy/gcode.py b/klippy/gcode.py
index ff7e2443..d607a0cc 100644
--- a/klippy/gcode.py
+++ b/klippy/gcode.py
@@ -72,12 +72,11 @@ class GCodeParser:
self.build_handlers()
if is_ready and self.is_fileinput and self.fd_handle is None:
self.fd_handle = self.reactor.register_fd(self.fd, self.process_data)
- if not is_ready:
- logging.info("Dumping gcode input %d blocks" % (
- len(self.input_log),))
- # XXX - read from self.input_log is not thread safe
- for eventtime, data in self.input_log:
- logging.info("Read %f: %s" % (eventtime, repr(data)))
+ def dump_debug(self):
+ logging.info("Dumping gcode input %d blocks" % (
+ len(self.input_log),))
+ for eventtime, data in self.input_log:
+ logging.info("Read %f: %s" % (eventtime, repr(data)))
# Parse input into commands
args_r = re.compile('([a-zA-Z*])')
def process_commands(self, eventtime):