aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/extras/heaters.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2020-05-05 14:10:30 -0400
committerKevin O'Connor <kevin@koconnor.net>2020-05-08 11:05:14 -0400
commit787ed452c2abe3bad81ffaf732b0b2609e3534bb (patch)
treeefe45de24864649b4219e6a45c1ebfb82574fe28 /klippy/extras/heaters.py
parent8472c57b594e6f8ff26d7be32b4bdd5072ed439a (diff)
downloadkutter-787ed452c2abe3bad81ffaf732b0b2609e3534bb.tar.gz
kutter-787ed452c2abe3bad81ffaf732b0b2609e3534bb.tar.xz
kutter-787ed452c2abe3bad81ffaf732b0b2609e3534bb.zip
klippy: Rename try_load_module() to load_object()
Rename try_load_module() so that it uses consistent naming for "printer objects". Change the function to raise an error by default if the specified module does not exist. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/extras/heaters.py')
-rw-r--r--klippy/extras/heaters.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/klippy/extras/heaters.py b/klippy/extras/heaters.py
index 42dd33cc..e5cb4dbd 100644
--- a/klippy/extras/heaters.py
+++ b/klippy/extras/heaters.py
@@ -58,8 +58,8 @@ class Heater:
self.mcu_pwm.setup_cycle_time(pwm_cycle_time)
self.mcu_pwm.setup_max_duration(MAX_HEAT_TIME)
# Load additional modules
- self.printer.try_load_module(config, "verify_heater %s" % (self.name,))
- self.printer.try_load_module(config, "pid_calibrate")
+ self.printer.load_object(config, "verify_heater %s" % (self.name,))
+ self.printer.load_object(config, "pid_calibrate")
gcode = self.printer.lookup_object("gcode")
gcode.register_mux_command("SET_HEATER_TEMPERATURE", "HEATER",
self.name, self.cmd_SET_HEATER_TEMPERATURE,
@@ -260,11 +260,10 @@ class PrinterHeaters:
"Unknown heater '%s'" % (heater_name,))
return self.heaters[heater_name]
def setup_sensor(self, config):
- self.printer.try_load_module(config, "thermistor")
- self.printer.try_load_module(config, "adc_temperature")
- self.printer.try_load_module(config, "spi_temperature")
- self.printer.try_load_module(config, "bme280")
- self.printer.try_load_module(config, "htu21d")
+ modules = ["thermistor", "adc_temperature", "spi_temperature",
+ "bme280", "htu21d"]
+ for module_name in modules:
+ self.printer.load_object(config, module_name)
sensor_type = config.get('sensor_type')
if sensor_type not in self.sensor_factories:
raise self.printer.config_error(