klippy: Defer calling mcu.connect_file() to connect() method
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
4f07ee4d92
commit
4eb21a71ae
|
@ -50,6 +50,7 @@ class Printer:
|
||||||
self.stats, self.reactor.NOW)
|
self.stats, self.reactor.NOW)
|
||||||
self.connect_timer = self.reactor.register_timer(
|
self.connect_timer = self.reactor.register_timer(
|
||||||
self.connect, self.reactor.NOW)
|
self.connect, self.reactor.NOW)
|
||||||
|
self.debugoutput = self.dictionary = None
|
||||||
|
|
||||||
self.objects = {}
|
self.objects = {}
|
||||||
if self.fileconfig.has_section('fan'):
|
if self.fileconfig.has_section('fan'):
|
||||||
|
@ -63,7 +64,9 @@ class Printer:
|
||||||
self, ConfigWrapper(self, 'heater_bed'))
|
self, ConfigWrapper(self, 'heater_bed'))
|
||||||
self.objects['toolhead'] = toolhead.ToolHead(
|
self.objects['toolhead'] = toolhead.ToolHead(
|
||||||
self, self._pconfig)
|
self, self._pconfig)
|
||||||
|
def set_fileoutput(self, debugoutput, dictionary):
|
||||||
|
self.debugoutput = debugoutput
|
||||||
|
self.dictionary = dictionary
|
||||||
def stats(self, eventtime):
|
def stats(self, eventtime):
|
||||||
out = []
|
out = []
|
||||||
out.append(self.gcode.stats(eventtime))
|
out.append(self.gcode.stats(eventtime))
|
||||||
|
@ -77,14 +80,14 @@ class Printer:
|
||||||
self.gcode.build_config()
|
self.gcode.build_config()
|
||||||
self.mcu.build_config()
|
self.mcu.build_config()
|
||||||
def connect(self, eventtime):
|
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.mcu.connect()
|
||||||
self.build_config()
|
self.build_config()
|
||||||
self.gcode.run()
|
self.gcode.run()
|
||||||
self.reactor.unregister_timer(self.connect_timer)
|
self.reactor.unregister_timer(self.connect_timer)
|
||||||
return self.reactor.NEVER
|
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):
|
def run(self):
|
||||||
self.reactor.run()
|
self.reactor.run()
|
||||||
# If gcode exits, then exit the MCU
|
# If gcode exits, then exit the MCU
|
||||||
|
@ -142,7 +145,7 @@ def main():
|
||||||
printer = Printer(conffile, debuginput=debuginput)
|
printer = Printer(conffile, debuginput=debuginput)
|
||||||
if debugoutput:
|
if debugoutput:
|
||||||
proto_dict = read_dictionary(options.read_dictionary)
|
proto_dict = read_dictionary(options.read_dictionary)
|
||||||
printer.connect_file(debugoutput, proto_dict)
|
printer.set_fileoutput(debugoutput, proto_dict)
|
||||||
printer.run()
|
printer.run()
|
||||||
|
|
||||||
if bglogger is not None:
|
if bglogger is not None:
|
||||||
|
|
Loading…
Reference in New Issue