stepper_enable: Remove ability to use a list of pins in enable_pin

Now that the tmc drivers perform automatic soft stepper enabling,
there is no need to be able to list multiple pins in the enable_pin
config setting.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2019-11-12 18:34:32 -05:00
parent 77dff35fae
commit 6116a5d48f
3 changed files with 23 additions and 38 deletions

View File

@ -30,8 +30,7 @@ dir_pin: ar55
# parameter must be provided. # parameter must be provided.
enable_pin: !ar38 enable_pin: !ar38
# Enable pin (default is enable high; use ! to indicate enable # Enable pin (default is enable high; use ! to indicate enable
# low). Alternatively, this may be a comma separated list of pins to # low). If this parameter is not provided then the stepper motor
# enable. If this parameter is not provided then the stepper motor
# driver must always be enabled. # driver must always be enabled.
step_distance: .0225 step_distance: .0225
# Distance in mm that each step causes the axis to travel. This # Distance in mm that each step causes the axis to travel. This

View File

@ -9,7 +9,9 @@ All dates in this document are approximate.
20191112: The tmc stepper driver virtual enable capability is now 20191112: The tmc stepper driver virtual enable capability is now
automatically enabled if the stepper does not have a dedicated stepper automatically enabled if the stepper does not have a dedicated stepper
enable pin. Remove references to tmcXXXX:virtual_enable from the 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 20191107: The primary extruder config section must be specified as
"extruder" and may no longer be specified as "extruder0". Gcode "extruder" and may no longer be specified as "extruder0". Gcode

View File

@ -9,10 +9,10 @@ DISABLE_STALL_TIME = 0.100
# Tracking of shared stepper enable pins # Tracking of shared stepper enable pins
class StepperEnablePin: class StepperEnablePin:
def __init__(self, mcu_enable, enable_count=0): def __init__(self, mcu_enable, enable_count):
self.mcu_enable = mcu_enable self.mcu_enable = mcu_enable
self.enable_count = enable_count self.enable_count = enable_count
self.is_dedicated = enable_count == 0 self.is_dedicated = True
def set_enable(self, print_time): def set_enable(self, print_time):
if not self.enable_count: if not self.enable_count:
self.mcu_enable.set_digital(print_time, 1) self.mcu_enable.set_digital(print_time, 1)
@ -22,38 +22,6 @@ class StepperEnablePin:
if not self.enable_count: if not self.enable_count:
self.mcu_enable.set_digital(print_time, 0) 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 # Enable line tracking for each stepper motor
class EnableTracking: class EnableTracking:
def __init__(self, printer, stepper, pin): def __init__(self, printer, stepper, pin):
@ -61,7 +29,22 @@ class EnableTracking:
self.callbacks = [] self.callbacks = []
self.is_enabled = False self.is_enabled = False
self.stepper.add_active_callback(self.motor_enable) 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): def register_state_callback(self, callback):
self.callbacks.append(callback) self.callbacks.append(callback)
def motor_enable(self, print_time): def motor_enable(self, print_time):
@ -83,6 +66,7 @@ class EnableTracking:
def has_dedicated_enable(self): def has_dedicated_enable(self):
return self.enable.is_dedicated return self.enable.is_dedicated
# Global stepper enable line tracking
class PrinterStepperEnable: class PrinterStepperEnable:
def __init__(self, config): def __init__(self, config):
self.printer = config.get_printer() self.printer = config.get_printer()