From 1707ad2ba0dbdd47b35ac6b75b85cd221fdf5048 Mon Sep 17 00:00:00 2001 From: alchemyEngine Date: Sun, 6 Feb 2022 12:56:31 +0100 Subject: [PATCH] Fix error when [stepper_z] gear ratio undefined Using ['configfile']['settings'] returns all defaults, therefore there is always a ['gear_ratio'] key. Check for empty list instead of checking for the key. --- measure_thermal_behavior.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/measure_thermal_behavior.py b/measure_thermal_behavior.py index 4d16bc2..b7771fe 100644 --- a/measure_thermal_behavior.py +++ b/measure_thermal_behavior.py @@ -67,10 +67,8 @@ def gather_metadata(): rot_dist = config_z['rotation_distance'] steps_per = config_z['full_steps_per_rotation'] micro = config_z['microsteps'] - if 'gear_ratio' in config_z.keys(): - gear_ratio_conf = config_z['gear_ratio'] - if type(gear_ratio_conf) is str: - gear_ratio_conf = gear_ratio_conf.split(':') + if config_z['gear_ratio']: + gear_ratio_conf = config_z['gear_ratio'] gear_ratio = float(gear_ratio_conf[0][0]) for reduction in gear_ratio_conf[1:]: gear_ratio = gear_ratio/float(reduction)