diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2019-02-02 20:18:59 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2019-02-03 11:11:15 -0500 |
commit | 955fdcaa0c4ea1995e7bf9cc9503cc2a596e3958 (patch) | |
tree | 3e823664be059ae62af9ddfd70cb00187fa1832f /klippy/extras/tmc2208.py | |
parent | cdcc320710290673ed37c4106be8b910026f8dac (diff) | |
download | kutter-955fdcaa0c4ea1995e7bf9cc9503cc2a596e3958.tar.gz kutter-955fdcaa0c4ea1995e7bf9cc9503cc2a596e3958.tar.xz kutter-955fdcaa0c4ea1995e7bf9cc9503cc2a596e3958.zip |
tmc2130: Convert field helper into a class
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/extras/tmc2208.py')
-rw-r--r-- | klippy/extras/tmc2208.py | 8 |
1 files changed, 5 insertions, 3 deletions
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) |