From 4b1536d62f2b5c5e0beb4692dbe4d0d1fa2bcb1b Mon Sep 17 00:00:00 2001 From: Alex Voinea Date: Sat, 4 Mar 2023 10:32:48 +0100 Subject: 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 --- klippy/extras/tmc2130.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'klippy/extras/tmc2130.py') diff --git a/klippy/extras/tmc2130.py b/klippy/extras/tmc2130.py index 128c1d93..c78b0431 100644 --- a/klippy/extras/tmc2130.py +++ b/klippy/extras/tmc2130.py @@ -295,17 +295,22 @@ class TMC2130: 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", 4) set_config_field(config, "hstrt", 0) set_config_field(config, "hend", 7) set_config_field(config, "tbl", 1) + # COOLCONF + set_config_field(config, "sgt", 0) + # IHOLDIRUN set_config_field(config, "iholddelay", 8) - set_config_field(config, "tpowerdown", 0) + # PWMCONF set_config_field(config, "pwm_ampl", 128) set_config_field(config, "pwm_grad", 4) set_config_field(config, "pwm_freq", 1) set_config_field(config, "pwm_autoscale", True) - set_config_field(config, "sgt", 0) + # TPOWERDOWN + set_config_field(config, "tpowerdown", 0) def load_config_prefix(config): return TMC2130(config) -- cgit v1.2.3-70-g09d2