homing_heaters: Use config.getlist() for heaters and steppers config options

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2021-08-19 15:08:56 -04:00
parent 65fb494e77
commit 8a556f2581
1 changed files with 9 additions and 15 deletions

View File

@ -15,38 +15,32 @@ class HomingHeaters:
self.handle_homing_move_begin)
self.printer.register_event_handler("homing:homing_move_end",
self.handle_homing_move_end)
self.heaters_to_disable = config.get("heaters", "")
self.disable_heaters = []
self.steppers_needing_quiet = config.get("steppers", "")
self.flaky_steppers = []
self.disable_heaters = config.getlist("heaters", None)
self.flaky_steppers = config.getlist("steppers", None)
self.pheaters = self.printer.load_object(config, 'heaters')
self.target_save = {}
def handle_connect(self):
# heaters to disable
all_heaters = self.pheaters.get_all_heaters()
self.disable_heaters = [n.strip()
for n in self.heaters_to_disable.split(',')]
if self.disable_heaters == [""]:
if self.disable_heaters is None:
self.disable_heaters = all_heaters
else:
if not all(x in all_heaters for x in self.disable_heaters):
raise self.printer.config_error(
"One or more of these heaters are unknown: %s" % (
self.disable_heaters))
"One or more of these heaters are unknown: %s"
% (self.disable_heaters,))
# steppers valid?
kin = self.printer.lookup_object('toolhead').get_kinematics()
all_steppers = [s.get_name() for s in kin.get_steppers()]
self.flaky_steppers = [n.strip()
for n in self.steppers_needing_quiet.split(',')]
if self.flaky_steppers == [""]:
if self.flaky_steppers is None:
return
if not all(x in all_steppers for x in self.flaky_steppers):
raise self.printer.config_error(
"One or more of these steppers are unknown: %s" % (
self.flaky_steppers))
"One or more of these steppers are unknown: %s"
% (self.flaky_steppers,))
def check_eligible(self, endstops):
if self.flaky_steppers == [""]:
if self.flaky_steppers is None:
return True
steppers_being_homed = [s.get_name()
for es in endstops