diff options
author | Alex Voinea <voinea.dragos.alexandru@gmail.com> | 2023-03-04 10:32:48 +0100 |
---|---|---|
committer | KevinOConnor <kevin@koconnor.net> | 2023-03-07 10:57:01 -0500 |
commit | 4b1536d62f2b5c5e0beb4692dbe4d0d1fa2bcb1b (patch) | |
tree | 0ce0b83c17ddabd7e18bc4de9b87e3a5bd32799b /klippy/extras/tmc2208.py | |
parent | bee1c67416c0f05eda06078bf160edb8b6ce092e (diff) | |
download | kutter-4b1536d62f2b5c5e0beb4692dbe4d0d1fa2bcb1b.tar.gz kutter-4b1536d62f2b5c5e0beb4692dbe4d0d1fa2bcb1b.tar.xz kutter-4b1536d62f2b5c5e0beb4692dbe4d0d1fa2bcb1b.zip |
tmc: Beautify initialization code
Purely esthetic. Make all tmc driver init code similar to one another. The various fields were grouped based on the register which they affect or the function they perform.
Signed-off-by: Alex Voinea <voinea.dragos.alexandru@gmail.com>
Diffstat (limited to 'klippy/extras/tmc2208.py')
-rw-r--r-- | klippy/extras/tmc2208.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/klippy/extras/tmc2208.py b/klippy/extras/tmc2208.py index 1378c626..7cea109e 100644 --- a/klippy/extras/tmc2208.py +++ b/klippy/extras/tmc2208.py @@ -200,12 +200,14 @@ class TMC2208: tmc.TMCStealthchopHelper(config, self.mcu_tmc, TMC_FREQUENCY) # Allow other registers to be set from the config set_config_field = self.fields.set_config_field + # CHOPCONF set_config_field(config, "toff", 3) set_config_field(config, "hstrt", 5) set_config_field(config, "hend", 0) set_config_field(config, "tbl", 2) + # IHOLDIRUN set_config_field(config, "iholddelay", 8) - set_config_field(config, "tpowerdown", 20) + # PWMCONF set_config_field(config, "pwm_ofs", 36) set_config_field(config, "pwm_grad", 14) set_config_field(config, "pwm_freq", 1) @@ -213,6 +215,8 @@ class TMC2208: set_config_field(config, "pwm_autograd", True) set_config_field(config, "pwm_reg", 8) set_config_field(config, "pwm_lim", 12) + # TPOWERDOWN + set_config_field(config, "tpowerdown", 20) def read_translate(self, reg_name, val): if reg_name == "IOIN": drv_type = self.fields.get_field("sel_a", val) |