diff --git a/config/example.cfg b/config/example.cfg index b44bae52..25280a9b 100644 --- a/config/example.cfg +++ b/config/example.cfg @@ -30,8 +30,7 @@ dir_pin: ar55 # parameter must be provided. enable_pin: !ar38 # Enable pin (default is enable high; use ! to indicate enable -# low). Alternatively, this may be a comma separated list of pins to -# enable. If this parameter is not provided then the stepper motor +# low). If this parameter is not provided then the stepper motor # driver must always be enabled. step_distance: .0225 # Distance in mm that each step causes the axis to travel. This diff --git a/docs/Config_Changes.md b/docs/Config_Changes.md index 059641e3..fc59b66c 100644 --- a/docs/Config_Changes.md +++ b/docs/Config_Changes.md @@ -9,7 +9,9 @@ All dates in this document are approximate. 20191112: The tmc stepper driver virtual enable capability is now automatically enabled if the stepper does not have a dedicated stepper enable pin. Remove references to tmcXXXX:virtual_enable from the -config. +config. The ability to control multiple pins in the stepper +enable_pin config has been removed. If multiple pins are needed then +use a multi_pin config section. 20191107: The primary extruder config section must be specified as "extruder" and may no longer be specified as "extruder0". Gcode diff --git a/klippy/extras/stepper_enable.py b/klippy/extras/stepper_enable.py index 99f075ff..e02563fb 100644 --- a/klippy/extras/stepper_enable.py +++ b/klippy/extras/stepper_enable.py @@ -9,10 +9,10 @@ DISABLE_STALL_TIME = 0.100 # Tracking of shared stepper enable pins class StepperEnablePin: - def __init__(self, mcu_enable, enable_count=0): + def __init__(self, mcu_enable, enable_count): self.mcu_enable = mcu_enable self.enable_count = enable_count - self.is_dedicated = enable_count == 0 + self.is_dedicated = True def set_enable(self, print_time): if not self.enable_count: self.mcu_enable.set_digital(print_time, 1) @@ -22,38 +22,6 @@ class StepperEnablePin: if not self.enable_count: self.mcu_enable.set_digital(print_time, 0) -# Automatic multiple pin enable lines -class StepperMultiEnablePin: - def __init__(self, enable_list): - self.enable_list = enable_list - self.is_dedicated = False - def set_enable(self, print_time): - for en in self.enable_list: - en.set_enable(print_time) - def set_disable(self, print_time): - for en in self.enable_list: - en.set_disable(print_time) - -# Resolve the 'enable_pin' stepper config setting -def lookup_enable_pin(ppins, pin_list): - if pin_list is None: - return StepperEnablePin(None, 9999) - enable_list = [] - for pin in pin_list.split(','): - pin_params = ppins.lookup_pin(pin, can_invert=True, - share_type='stepper_enable') - enable = pin_params.get('class') - if enable is None: - mcu_enable = pin_params['chip'].setup_pin('digital_out', pin_params) - mcu_enable.setup_max_duration(0.) - pin_params['class'] = enable = StepperEnablePin(mcu_enable) - else: - enable.is_dedicated = False - enable_list.append(enable) - if len(enable_list) == 1: - return enable_list[0] - return StepperMultiEnablePin(enable_list) - # Enable line tracking for each stepper motor class EnableTracking: def __init__(self, printer, stepper, pin): @@ -61,7 +29,22 @@ class EnableTracking: self.callbacks = [] self.is_enabled = False self.stepper.add_active_callback(self.motor_enable) - self.enable = lookup_enable_pin(printer.lookup_object('pins'), pin) + if pin is None: + # No enable line (stepper always enabled) + self.enable = StepperEnablePin(None, 9999) + self.enable.is_dedicated = False + return + ppins = printer.lookup_object('pins') + pin_params = ppins.lookup_pin(pin, can_invert=True, + share_type='stepper_enable') + self.enable = pin_params.get('class') + if self.enable is not None: + # Shared enable line + self.enable.is_dedicated = False + return + mcu_enable = pin_params['chip'].setup_pin('digital_out', pin_params) + mcu_enable.setup_max_duration(0.) + self.enable = pin_params['class'] = StepperEnablePin(mcu_enable, 0) def register_state_callback(self, callback): self.callbacks.append(callback) def motor_enable(self, print_time): @@ -83,6 +66,7 @@ class EnableTracking: def has_dedicated_enable(self): return self.enable.is_dedicated +# Global stepper enable line tracking class PrinterStepperEnable: def __init__(self, config): self.printer = config.get_printer()