klippy: Allow external callers of try_load_module()
It can be useful to automatically pull in a module in the extras/ directory. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
e53a589ac3
commit
b549c3927e
|
@ -178,7 +178,7 @@ class Printer:
|
||||||
logging.info("Stats %.1f: %s", eventtime,
|
logging.info("Stats %.1f: %s", eventtime,
|
||||||
' '.join([s[1] for s in stats]))
|
' '.join([s[1] for s in stats]))
|
||||||
return eventtime + 1.
|
return eventtime + 1.
|
||||||
def _try_load_module(self, config, section):
|
def try_load_module(self, config, section):
|
||||||
if section in self.objects:
|
if section in self.objects:
|
||||||
return
|
return
|
||||||
module_parts = section.split()
|
module_parts = section.split()
|
||||||
|
@ -208,7 +208,7 @@ class Printer:
|
||||||
for m in [pins, mcu]:
|
for m in [pins, mcu]:
|
||||||
m.add_printer_objects(self, config)
|
m.add_printer_objects(self, config)
|
||||||
for section in fileconfig.sections():
|
for section in fileconfig.sections():
|
||||||
self._try_load_module(config, section)
|
self.try_load_module(config, section)
|
||||||
for m in [chipmisc, toolhead, extruder, heater]:
|
for m in [chipmisc, toolhead, extruder, heater]:
|
||||||
m.add_printer_objects(self, config)
|
m.add_printer_objects(self, config)
|
||||||
# Validate that there are no undefined parameters in the config file
|
# Validate that there are no undefined parameters in the config file
|
||||||
|
|
Loading…
Reference in New Issue