quad_gantry_level: Use config.getlists() for gantry_corners config option

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

View File

@ -35,15 +35,8 @@ class QuadGantryLevel:
"Need exactly 4 probe points for quad_gantry_level") "Need exactly 4 probe points for quad_gantry_level")
self.z_status = z_tilt.ZAdjustStatus(self.printer) self.z_status = z_tilt.ZAdjustStatus(self.printer)
self.z_helper = z_tilt.ZAdjustHelper(config, 4) self.z_helper = z_tilt.ZAdjustHelper(config, 4)
gantry_corners = config.get('gantry_corners').split('\n') self.gantry_corners = config.getlists('gantry_corners', parser=float,
try: seps=(',', '\n'), count=2)
gantry_corners = [line.split(',', 1)
for line in gantry_corners if line.strip()]
self.gantry_corners = [(float(zp[0].strip()), float(zp[1].strip()))
for zp in gantry_corners]
except:
raise config.error("Unable to parse gantry_corners in %s" % (
config.get_name()))
if len(self.gantry_corners) < 2: if len(self.gantry_corners) < 2:
raise config.error( raise config.error(
"quad_gantry_level requires at least two gantry_corners") "quad_gantry_level requires at least two gantry_corners")