resonance_tester: Use config.getlists() for probe_points config option

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

View File

@ -6,15 +6,6 @@
import logging, math, os, time import logging, math, os, time
from . import shaper_calibrate from . import shaper_calibrate
def _parse_probe_points(config):
points = config.get('probe_points').split('\n')
try:
points = [line.split(',', 2) for line in points if line.strip()]
return [[float(coord.strip()) for coord in p] for p in points]
except:
raise config.error("Unable to parse probe_points in %s" % (
config.get_name()))
class TestAxis: class TestAxis:
def __init__(self, axis=None, vib_dir=None): def __init__(self, axis=None, vib_dir=None):
if axis is None: if axis is None:
@ -66,7 +57,8 @@ class VibrationPulseTest:
self.hz_per_sec = config.getfloat('hz_per_sec', 1., self.hz_per_sec = config.getfloat('hz_per_sec', 1.,
minval=0.1, maxval=2.) minval=0.1, maxval=2.)
self.probe_points = _parse_probe_points(config) self.probe_points = config.getlists('probe_points', seps=(',', '\n'),
parser=float, count=3)
def get_start_test_points(self): def get_start_test_points(self):
return self.probe_points return self.probe_points
def prepare_test(self, gcmd): def prepare_test(self, gcmd):