diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2017-03-12 22:43:05 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2017-03-13 00:38:17 -0400 |
commit | d21b9280f029f1c65d3dac9310eb00090dd8c531 (patch) | |
tree | cc3b34c2ecc0b277470dfe567a40b144cb7c3174 /klippy/klippy.py | |
parent | 92649332ce1f4ad7445f5e97ee6d24c79eccece9 (diff) | |
download | kutter-d21b9280f029f1c65d3dac9310eb00090dd8c531.tar.gz kutter-d21b9280f029f1c65d3dac9310eb00090dd8c531.tar.xz kutter-d21b9280f029f1c65d3dac9310eb00090dd8c531.zip |
klippy: Eliminate high-level build_config phase
Now that the mcu objects can be created prior to connecting to the
mcu, it is no longer necessary to separate the init and build_config
phases in the high-level code. Move the mcu objection creation from
the build_config phase to the init phase and eliminate the
build_config phase.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/klippy.py')
-rw-r--r-- | klippy/klippy.py | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/klippy/klippy.py b/klippy/klippy.py index 9b366a3b..47e0d000 100644 --- a/klippy/klippy.py +++ b/klippy/klippy.py @@ -138,22 +138,20 @@ class Printer: if self.debugoutput is None: ConfigLogger(self.fileconfig) self.mcu = mcu.MCU(self, ConfigWrapper(self, 'mcu')) - if self.fileconfig.has_section('fan'): - self.objects['fan'] = fan.PrinterFan( - self, ConfigWrapper(self, 'fan')) + if self.debugoutput is not None: + self.mcu.connect_file(self.debugoutput, self.dictionary) if self.fileconfig.has_section('extruder'): self.objects['extruder'] = extruder.PrinterExtruder( self, ConfigWrapper(self, 'extruder')) + if self.fileconfig.has_section('fan'): + self.objects['fan'] = fan.PrinterFan( + self, ConfigWrapper(self, 'fan')) if self.fileconfig.has_section('heater_bed'): self.objects['heater_bed'] = heater.PrinterHeater( self, ConfigWrapper(self, 'heater_bed')) self.objects['toolhead'] = toolhead.ToolHead( self, ConfigWrapper(self, 'printer')) - def build_config(self): - for oname in sorted(self.objects.keys()): - self.objects[oname].build_config() - self.mcu.build_config() - def validate_config(self): + # Validate that there are no undefined parameters in the config file valid_sections = dict([(s, 1) for s, o in self.all_config_options]) for section in self.fileconfig.sections(): section = section.lower() @@ -171,11 +169,7 @@ class Printer: self.load_config() if self.debugoutput is None: self.reactor.update_timer(self.stats_timer, self.reactor.NOW) - else: - self.mcu.connect_file(self.debugoutput, self.dictionary) self.mcu.connect() - self.build_config() - self.validate_config() self.gcode.set_printer_ready(True) self.state_message = message_ready except ConfigParser.Error, e: |