stepper: Improve error messages on missing rotation_distance
If neither rotation_distance nor step_distance is present, then generate an error saying rotation_distance is needed (instead of an error about step_distance). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
6b6ab45bac
commit
4d2adddb20
|
@ -225,11 +225,14 @@ def parse_step_distance(config, units_in_radians=None, note_valid=False):
|
||||||
rotation_dist = 2. * math.pi
|
rotation_dist = 2. * math.pi
|
||||||
config.get('gear_ratio', note_valid=note_valid)
|
config.get('gear_ratio', note_valid=note_valid)
|
||||||
else:
|
else:
|
||||||
rotation_dist = config.getfloat('rotation_distance', None,
|
rd = config.get('rotation_distance', None, note_valid=False)
|
||||||
above=0., note_valid=note_valid)
|
sd = config.get('step_distance', None, note_valid=False)
|
||||||
if rotation_dist is None:
|
if rd is None and sd is not None:
|
||||||
# Older config format with step_distance
|
# Older config format with step_distance
|
||||||
return config.getfloat('step_distance', above=0., note_valid=note_valid)
|
return config.getfloat('step_distance', above=0.,
|
||||||
|
note_valid=note_valid)
|
||||||
|
rotation_dist = config.getfloat('rotation_distance', above=0.,
|
||||||
|
note_valid=note_valid)
|
||||||
# Newer config format with rotation_distance
|
# Newer config format with rotation_distance
|
||||||
microsteps = config.getint('microsteps', minval=1, note_valid=note_valid)
|
microsteps = config.getint('microsteps', minval=1, note_valid=note_valid)
|
||||||
full_steps = config.getint('full_steps_per_rotation', 200, minval=1,
|
full_steps = config.getint('full_steps_per_rotation', 200, minval=1,
|
||||||
|
|
Loading…
Reference in New Issue