aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/stepper.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2018-01-19 22:22:17 -0500
committerKevin O'Connor <kevin@koconnor.net>2018-01-28 12:19:26 -0500
commit81013ba5c8638dd42932bd893e1b3115b1b98041 (patch)
tree3e0d60c2d084f808f2788a4645579093abdc8739 /klippy/stepper.py
parentf0a754e496ca989bc355555e2c798c362299abc3 (diff)
downloadkutter-81013ba5c8638dd42932bd893e1b3115b1b98041.tar.gz
kutter-81013ba5c8638dd42932bd893e1b3115b1b98041.tar.xz
kutter-81013ba5c8638dd42932bd893e1b3115b1b98041.zip
klippy: Add access methods and avoid peeking into the printer classes
Add get_reactor(), lookup_object(), lookup_module_objects(), and set_rollover_info() to the main Printer class so that callers do not need to peek into the class' members. Similarly, add get_printer() and get_name() methods to the ConfigWrapper class. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/stepper.py')
-rw-r--r--klippy/stepper.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/klippy/stepper.py b/klippy/stepper.py
index 61d59568..682b306b 100644
--- a/klippy/stepper.py
+++ b/klippy/stepper.py
@@ -36,7 +36,7 @@ def lookup_enable_pin(printer, pin):
# Code storing the definitions for a stepper motor
class PrinterStepper:
def __init__(self, printer, config):
- self.name = config.section
+ self.name = config.get_name()
if self.name.startswith('stepper_'):
self.name = self.name[8:]
self.need_motor_enable = True
@@ -101,7 +101,7 @@ class PrinterHomingStepper(PrinterStepper):
else:
raise config.error(
"Unable to infer homing_positive_dir in section '%s'" % (
- config.section,))
+ config.get_name(),))
# Endstop stepper phase position tracking
self.homing_stepper_phases = config.getint(
'homing_stepper_phases', None, minval=0)
@@ -169,9 +169,9 @@ class PrinterMultiStepper(PrinterHomingStepper):
self.extras = []
self.all_step_const = [self.step_const]
for i in range(1, 99):
- if not config.has_section(config.section + str(i)):
+ if not config.has_section(config.get_name() + str(i)):
break
- extraconfig = config.getsection(config.section + str(i))
+ extraconfig = config.getsection(config.get_name() + str(i))
extra = PrinterStepper(printer, extraconfig)
self.extras.append(extra)
self.all_step_const.append(extra.step_const)
@@ -202,6 +202,6 @@ class PrinterMultiStepper(PrinterHomingStepper):
return self.endstops
def LookupMultiHomingStepper(printer, config):
- if not config.has_section(config.section + '1'):
+ if not config.has_section(config.get_name() + '1'):
return PrinterHomingStepper(printer, config)
return PrinterMultiStepper(printer, config)