z_tilt: Use config.getlists() for z_positions config option

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

View File

@ -127,15 +127,8 @@ class RetryHelper:
class ZTilt:
def __init__(self, config):
self.printer = config.get_printer()
z_positions = config.get('z_positions').split('\n')
try:
z_positions = [line.split(',', 1)
for line in z_positions if line.strip()]
self.z_positions = [(float(zp[0].strip()), float(zp[1].strip()))
for zp in z_positions]
except:
raise config.error("Unable to parse z_positions in %s" % (
config.get_name()))
self.z_positions = config.getlists('z_positions', seps=(',', '\n'),
parser=float, count=2)
self.retry_helper = RetryHelper(config)
self.probe_helper = probe.ProbePointsHelper(config, self.probe_finalize)
self.probe_helper.minimum_points(2)