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:
Kevin O'Connor 2017-10-29 10:58:04 -04:00
parent fda988889b
commit aaeda540b6
5 changed files with 10 additions and 8 deletions

View file

@ -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'))