diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2017-09-06 14:51:47 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2017-09-07 11:19:27 -0400 |
commit | 7d17002b33f9f5da78bfde049331e125b426a4f9 (patch) | |
tree | d3fab2dd65f4e0b94914424269141b44f6968cc4 /klippy/klippy.py | |
parent | 477b3941a6e0ea83d73fbb1ad9e2ac17696bd0a3 (diff) | |
download | kutter-7d17002b33f9f5da78bfde049331e125b426a4f9.tar.gz kutter-7d17002b33f9f5da78bfde049331e125b426a4f9.tar.xz kutter-7d17002b33f9f5da78bfde049331e125b426a4f9.zip |
fan: Allow heater_fan to work with heater_bed
Fix order of init error preventing heater_fan from being used with
heater_bed.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/klippy.py')
-rw-r--r-- | klippy/klippy.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/klippy/klippy.py b/klippy/klippy.py index 60bb9359..286e56f4 100644 --- a/klippy/klippy.py +++ b/klippy/klippy.py @@ -6,7 +6,7 @@ # This file may be distributed under the terms of the GNU GPLv3 license. import sys, optparse, ConfigParser, logging, time, threading import util, reactor, queuelogger, msgproto, gcode -import pins, mcu, chipmisc, toolhead, extruder, fan, heater +import pins, mcu, chipmisc, toolhead, extruder, heater, fan message_ready = "Printer is ready" @@ -123,6 +123,7 @@ class ConfigLogger(): self.lines.append(data.strip()) class Printer: + config_error = ConfigParser.Error def __init__(self, input_fd, bglogger, start_args): self.bglogger = bglogger self.start_args = start_args @@ -166,13 +167,13 @@ class Printer: config_file = self.start_args['config_file'] res = self.fileconfig.read(config_file) if not res: - raise ConfigParser.Error("Unable to open config file %s" % ( + raise self.config_error("Unable to open config file %s" % ( config_file,)) if self.bglogger is not None: ConfigLogger(self.fileconfig, self.bglogger) # Create printer components config = ConfigWrapper(self, 'printer') - for m in [pins, mcu, chipmisc, toolhead, extruder, fan, heater]: + for m in [pins, mcu, chipmisc, toolhead, extruder, heater, fan]: m.add_printer_objects(self, config) self.mcu = self.objects['mcu'] # Validate that there are no undefined parameters in the config file @@ -180,12 +181,12 @@ class Printer: for section in self.fileconfig.sections(): section = section.lower() if section not in valid_sections: - raise ConfigParser.Error("Unknown config file section '%s'" % ( + raise self.config_error("Unknown config file section '%s'" % ( section,)) for option in self.fileconfig.options(section): option = option.lower() if (section, option) not in self.all_config_options: - raise ConfigParser.Error( + raise self.config_error( "Unknown option '%s' in section '%s'" % ( option, section)) def _connect(self, eventtime): @@ -196,7 +197,7 @@ class Printer: self.mcu.connect() self.gcode.set_printer_ready(True) self.state_message = message_ready - except (ConfigParser.Error, pins.error) as e: + except (self.config_error, pins.error) as e: logging.exception("Config error") self.state_message = "%s%s" % (str(e), message_restart) self.reactor.update_timer(self.stats_timer, self.reactor.NEVER) |