diff --git a/klippy/stepper.py b/klippy/stepper.py index f386f5b8..0e415bad 100644 --- a/klippy/stepper.py +++ b/klippy/stepper.py @@ -215,17 +215,11 @@ def PrinterStepper(config, units_in_radians=False): # Parse stepper gear_ratio config parameter def parse_gear_ratio(config, note_valid): - gear_ratio = config.get('gear_ratio', None, note_valid=note_valid) - if gear_ratio is None: - return 1. + gear_ratio = config.getlists('gear_ratio', (), seps=(':', ','), count=2, + parser=float, note_valid=note_valid) result = 1. - try: - gears = gear_ratio.split(',') - for gear in gears: - g1, g2 = [float(v.strip()) for v in gear.split(':')] - result *= g1 / g2 - except: - raise config.error("Unable to parse gear_ratio: %s" % (gear_ratio,)) + for g1, g2 in gear_ratio: + result *= g1 / g2 return result # Obtain "step distance" information from a config section