stepper: Calculate the stepper name directly from the config section
There is no need to pass the name to the PrinterStepper class as it can determine the name itself. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
fda988889b
commit
aaeda540b6
|
@ -11,7 +11,7 @@ StepList = (0, 1, 2)
|
|||
class CartKinematics:
|
||||
def __init__(self, toolhead, printer, config):
|
||||
self.steppers = [stepper.PrinterHomingStepper(
|
||||
printer, config.getsection('stepper_' + n), n)
|
||||
printer, config.getsection('stepper_' + n))
|
||||
for n in ['x', 'y', 'z']]
|
||||
max_velocity, max_accel = toolhead.get_max_velocity()
|
||||
self.max_z_velocity = config.getfloat(
|
||||
|
|
|
@ -11,7 +11,7 @@ StepList = (0, 1, 2)
|
|||
class CoreXYKinematics:
|
||||
def __init__(self, toolhead, printer, config):
|
||||
self.steppers = [stepper.PrinterHomingStepper(
|
||||
printer, config.getsection('stepper_' + n), n)
|
||||
printer, config.getsection('stepper_' + n))
|
||||
for n in ['x', 'y', 'z']]
|
||||
self.steppers[0].mcu_endstop.add_stepper(self.steppers[1].mcu_stepper)
|
||||
self.steppers[1].mcu_endstop.add_stepper(self.steppers[0].mcu_stepper)
|
||||
|
|
|
@ -14,7 +14,7 @@ SLOW_RATIO = 3.
|
|||
class DeltaKinematics:
|
||||
def __init__(self, toolhead, printer, config):
|
||||
self.steppers = [stepper.PrinterHomingStepper(
|
||||
printer, config.getsection('stepper_' + n), n)
|
||||
printer, config.getsection('stepper_' + n))
|
||||
for n in ['a', 'b', 'c']]
|
||||
self.need_motor_enable = self.need_home = True
|
||||
radius = config.getfloat('delta_radius', above=0.)
|
||||
|
|
|
@ -12,7 +12,7 @@ class PrinterExtruder:
|
|||
def __init__(self, printer, config):
|
||||
self.config = config
|
||||
self.heater = heater.PrinterHeater(printer, config)
|
||||
self.stepper = stepper.PrinterStepper(printer, config, 'extruder')
|
||||
self.stepper = stepper.PrinterStepper(printer, config)
|
||||
self.nozzle_diameter = config.getfloat('nozzle_diameter', above=0.)
|
||||
filament_diameter = config.getfloat(
|
||||
'filament_diameter', minval=self.nozzle_diameter)
|
||||
|
|
|
@ -7,8 +7,10 @@ import math, logging
|
|||
import homing, pins
|
||||
|
||||
class PrinterStepper:
|
||||
def __init__(self, printer, config, name):
|
||||
self.name = name
|
||||
def __init__(self, printer, config):
|
||||
self.name = config.section
|
||||
if self.name.startswith('stepper_'):
|
||||
self.name = self.name[8:]
|
||||
|
||||
self.step_dist = config.getfloat('step_distance', above=0.)
|
||||
self.inv_step_dist = 1. / self.step_dist
|
||||
|
@ -47,8 +49,8 @@ class PrinterStepper:
|
|||
self.need_motor_enable = not enable
|
||||
|
||||
class PrinterHomingStepper(PrinterStepper):
|
||||
def __init__(self, printer, config, name):
|
||||
PrinterStepper.__init__(self, printer, config, name)
|
||||
def __init__(self, printer, config):
|
||||
PrinterStepper.__init__(self, printer, config)
|
||||
|
||||
self.mcu_endstop = pins.setup_pin(
|
||||
printer, 'endstop', config.get('endstop_pin'))
|
||||
|
|
Loading…
Reference in New Issue