diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2021-08-05 14:25:53 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2021-08-06 13:12:49 -0400 |
commit | 33dcb3829717102f5243ad805f3ee09d52c0c9cf (patch) | |
tree | 9cbbb18a4ce6bfebc54a60a395630c17e94849e9 /klippy/extras/tmc2209.py | |
parent | a52a627893071c0e68cd033ff4e745f017532ca2 (diff) | |
download | kutter-33dcb3829717102f5243ad805f3ee09d52c0c9cf.tar.gz kutter-33dcb3829717102f5243ad805f3ee09d52c0c9cf.tar.xz kutter-33dcb3829717102f5243ad805f3ee09d52c0c9cf.zip |
tmc: Consistently use lower case for all TMC field names
The Trinamic specs aren't consistent with upper vs lower case, which
can be confusing. Improve clarity by using lower case names
consistently in the code. Register names will continue to use all
upper case naming in the code.
Update the SET_TMC_FIELD command to automatically convert field names
to lower case.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/extras/tmc2209.py')
-rw-r--r-- | klippy/extras/tmc2209.py | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/klippy/extras/tmc2209.py b/klippy/extras/tmc2209.py index c95ade34..7856334b 100644 --- a/klippy/extras/tmc2209.py +++ b/klippy/extras/tmc2209.py @@ -26,24 +26,24 @@ Fields["COOLCONF"] = { "seimin": 0x01 << 15 } Fields["IOIN"] = { - "ENN": 0x01 << 0, - "MS1": 0x01 << 2, - "MS2": 0x01 << 3, - "DIAG": 0x01 << 4, - "PDN_UART": 0x01 << 6, - "STEP": 0x01 << 7, - "SPREAD_EN": 0x01 << 8, - "DIR": 0x01 << 9, - "VERSION": 0xff << 24 + "enn": 0x01 << 0, + "ms1": 0x01 << 2, + "ms2": 0x01 << 3, + "diag": 0x01 << 4, + "pdn_uart": 0x01 << 6, + "step": 0x01 << 7, + "spread_en": 0x01 << 8, + "dir": 0x01 << 9, + "version": 0xff << 24 } Fields["SGTHRS"] = { - "SGTHRS": 0xFF << 0 + "sgthrs": 0xFF << 0 } Fields["SG_RESULT"] = { - "SG_RESULT": 0x3FF << 0 + "sg_result": 0x3FF << 0 } Fields["TCOOLTHRS"] = { - "TCOOLTHRS": 0xfffff + "tcoolthrs": 0xfffff } FieldFormatters = dict(tmc2208.FieldFormatters) @@ -61,7 +61,7 @@ class TMC2209: self.mcu_tmc = tmc_uart.MCU_TMC_uart(config, Registers, self.fields, 3) # Setup fields for UART self.fields.set_field("pdn_disable", True) - self.fields.set_field("SENDDELAY", 2) # Avoid tx errors on shared uart + self.fields.set_field("senddelay", 2) # Avoid tx errors on shared uart # Allow virtual pins to be created tmc.TMCVirtualPinHelper(config, self.mcu_tmc) # Register commands @@ -81,17 +81,17 @@ class TMC2209: set_config_field(config, "toff", 3) set_config_field(config, "hstrt", 5) set_config_field(config, "hend", 0) - set_config_field(config, "TBL", 2) - set_config_field(config, "IHOLDDELAY", 8) - set_config_field(config, "TPOWERDOWN", 20) - set_config_field(config, "PWM_OFS", 36) - set_config_field(config, "PWM_GRAD", 14) + set_config_field(config, "tbl", 2) + set_config_field(config, "iholddelay", 8) + set_config_field(config, "tpowerdown", 20) + set_config_field(config, "pwm_ofs", 36) + set_config_field(config, "pwm_grad", 14) set_config_field(config, "pwm_freq", 1) set_config_field(config, "pwm_autoscale", True) set_config_field(config, "pwm_autograd", True) - set_config_field(config, "PWM_REG", 8) - set_config_field(config, "PWM_LIM", 12) - set_config_field(config, "SGTHRS", 0) + set_config_field(config, "pwm_reg", 8) + set_config_field(config, "pwm_lim", 12) + set_config_field(config, "sgthrs", 0) def load_config_prefix(config): return TMC2209(config) |