From 955fdcaa0c4ea1995e7bf9cc9503cc2a596e3958 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Sat, 2 Feb 2019 20:18:59 -0500 Subject: tmc2130: Convert field helper into a class Signed-off-by: Kevin O'Connor --- klippy/extras/tmc2208.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'klippy/extras/tmc2208.py') diff --git a/klippy/extras/tmc2208.py b/klippy/extras/tmc2208.py index 207864c6..ec462855 100644 --- a/klippy/extras/tmc2208.py +++ b/klippy/extras/tmc2208.py @@ -267,6 +267,7 @@ class TMC2208: "DUMP_TMC", "STEPPER", self.name, self.cmd_DUMP_TMC, desc=self.cmd_DUMP_TMC_help) # Get config for initial driver settings + self.field_helper = tmc2130.FieldHelper(Fields) run_current = config.getfloat('run_current', above=0., maxval=2.) hold_current = config.getfloat('hold_current', run_current, above=0., maxval=2.) @@ -386,10 +387,11 @@ class TMC2208: raise gcode.error(str(e)) # IOIN has different mappings depending on the driver type # (SEL_A field of IOIN reg) - if reg_name is "IOIN": - drv_type = tmc2130.get_field(Fields, "IOIN@TMC222x", "SEL_A", val) + if reg_name == "IOIN": + drv_type = self.field_helper.get_field("IOIN@TMC222x", "SEL_A", + val) reg_name = "IOIN@TMC220x" if drv_type else "IOIN@TMC222x" - msg = tmc2130.pretty_format(Fields, reg_name, val) + msg = self.field_helper.pretty_format(reg_name, val) logging.info(msg) gcode.respond_info(msg) -- cgit v1.2.3-70-g09d2