diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2017-10-29 10:58:04 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2017-11-18 17:29:22 -0500 |
commit | aaeda540b6cc321e04f4466f0fb518eeb93fcaa1 (patch) | |
tree | e01e294a83e3a1bf03e9feb0d33f74fdea6b181f /klippy/stepper.py | |
parent | fda988889b7cee2b95b35d06e15b5ecb3ad92bbb (diff) | |
download | kutter-aaeda540b6cc321e04f4466f0fb518eeb93fcaa1.tar.gz kutter-aaeda540b6cc321e04f4466f0fb518eeb93fcaa1.tar.xz kutter-aaeda540b6cc321e04f4466f0fb518eeb93fcaa1.zip |
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>
Diffstat (limited to 'klippy/stepper.py')
-rw-r--r-- | klippy/stepper.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/klippy/stepper.py b/klippy/stepper.py index 9bcf1e72..7c0e6935 100644 --- a/klippy/stepper.py +++ b/klippy/stepper.py @@ -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')) |