aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/klippy.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2016-11-29 22:46:05 -0500
committerKevin O'Connor <kevin@koconnor.net>2016-11-30 21:19:43 -0500
commit4eb21a71ae0da16d001b549216793ac84dc691fd (patch)
tree2fe3268d0f43abe249151f341dd6218dc6dd6e00 /klippy/klippy.py
parent4f07ee4d92732d0b619553d366b50b4b758c3d87 (diff)
downloadkutter-4eb21a71ae0da16d001b549216793ac84dc691fd.tar.gz
kutter-4eb21a71ae0da16d001b549216793ac84dc691fd.tar.xz
kutter-4eb21a71ae0da16d001b549216793ac84dc691fd.zip
klippy: Defer calling mcu.connect_file() to connect() method
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/klippy.py')
-rw-r--r--klippy/klippy.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/klippy/klippy.py b/klippy/klippy.py
index 2f82cfe5..e772b3ce 100644
--- a/klippy/klippy.py
+++ b/klippy/klippy.py
@@ -50,6 +50,7 @@ class Printer:
self.stats, self.reactor.NOW)
self.connect_timer = self.reactor.register_timer(
self.connect, self.reactor.NOW)
+ self.debugoutput = self.dictionary = None
self.objects = {}
if self.fileconfig.has_section('fan'):
@@ -63,7 +64,9 @@ class Printer:
self, ConfigWrapper(self, 'heater_bed'))
self.objects['toolhead'] = toolhead.ToolHead(
self, self._pconfig)
-
+ def set_fileoutput(self, debugoutput, dictionary):
+ self.debugoutput = debugoutput
+ self.dictionary = dictionary
def stats(self, eventtime):
out = []
out.append(self.gcode.stats(eventtime))
@@ -77,14 +80,14 @@ class Printer:
self.gcode.build_config()
self.mcu.build_config()
def connect(self, eventtime):
+ if self.debugoutput is not None:
+ self.reactor.update_timer(self.stats_timer, self.reactor.NEVER)
+ self.mcu.connect_file(self.debugoutput, self.dictionary)
self.mcu.connect()
self.build_config()
self.gcode.run()
self.reactor.unregister_timer(self.connect_timer)
return self.reactor.NEVER
- def connect_file(self, output, dictionary):
- self.reactor.update_timer(self.stats_timer, self.reactor.NEVER)
- self.mcu.connect_file(output, dictionary)
def run(self):
self.reactor.run()
# If gcode exits, then exit the MCU
@@ -142,7 +145,7 @@ def main():
printer = Printer(conffile, debuginput=debuginput)
if debugoutput:
proto_dict = read_dictionary(options.read_dictionary)
- printer.connect_file(debugoutput, proto_dict)
+ printer.set_fileoutput(debugoutput, proto_dict)
printer.run()
if bglogger is not None: