From c21843e101120c6cbd13c0cc6db72e0c0d71e168 Mon Sep 17 00:00:00 2001 From: "AKA \"Thom Wiley" Date: Sun, 12 Apr 2026 08:35:35 -0400 Subject: [PATCH 1/2] =?UTF-8?q?Add=20slew=20rate=20of=20400V/=CE=BCs=20to?= =?UTF-8?q?=20TMC2240=20for=20better=20cooling.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Recent addition to Klipper as a way of managing driver thermals (power dissipation) without adding resonance. Values are 0, 1, 2, 3 which correspond to: 0x0: 100V/μs 0x1: 200V/μs 0x2: 400V/μs 0x3: 800V/μs Value (2) offers the best benefit to resonance risk. --- klippy/extras/tmc2240.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/klippy/extras/tmc2240.py b/klippy/extras/tmc2240.py index 3c14956d1..87fe25eab 100644 --- a/klippy/extras/tmc2240.py +++ b/klippy/extras/tmc2240.py @@ -58,8 +58,9 @@ ReadRegisters = [ "GCONF", "GSTAT", "IOIN", "DRV_CONF", "GLOBALSCALER", "IHOLD_IRUN", "TPOWERDOWN", "TSTEP", "TPWMTHRS", "TCOOLTHRS", "THIGH", "ADC_VSUPPLY_AIN", - "ADC_TEMP", "MSCNT", "MSCURACT", "CHOPCONF", "COOLCONF", "DRV_STATUS", - "PWMCONF", "PWM_SCALE", "PWM_AUTO", "SG4_THRS", "SG4_RESULT", "SG4_IND" + "ADC_TEMP", "OTW_OV_VTH", "MSCNT", "MSCURACT", "CHOPCONF", "COOLCONF", + "DRV_STATUS", "PWMCONF", "PWM_SCALE", "PWM_AUTO", "SG4_THRS", "SG4_RESULT", + "SG4_IND" ] Fields = {} @@ -261,6 +262,9 @@ "adc_temp": (lambda v: "0x%04x(%.1fC)" % (v, ((v - 2038) / 7.7))), "adc_vsupply": (lambda v: "0x%04x(%.3fV)" % (v, v * 0.009732)), "adc_ain": (lambda v: "0x%04x(%.3fmV)" % (v, v * 0.3052)), + "overvoltage_vth": (lambda v: "0x%04x(%.3fV)" % (v, v * 0.009732)), + "overtempprewarning_vth": (lambda v: + "0x%04x(%.1fC)" % (v, ((v - 2038) / 7.7))), }) @@ -409,6 +413,8 @@ def __init__(self, config): set_config_field(config, "tpowerdown", 10) # SG4_THRS set_config_field(config, "sg4_angle_offset", 1) + # DRV_CONF + set_config_field(config, "slope_control", 2) def load_config_prefix(config): return TMC2240(config) From 3272181558392b36d21cdd0bf50504fd3d739b99 Mon Sep 17 00:00:00 2001 From: "AKA \"Thom Wiley" Date: Sun, 12 Apr 2026 09:26:44 -0400 Subject: [PATCH 2/2] Add slope_control setting for stepper_x and stepper_y MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is the printer.cfg update with the changes made to klippy\extras\tmc2240.py. These added to lines to [stepper_x] and [stepper_y] set the slew rate to 2. (400V/μs) --- lava/printer.cfg | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lava/printer.cfg b/lava/printer.cfg index 4ceee19d0..c810c1e91 100644 --- a/lava/printer.cfg +++ b/lava/printer.cfg @@ -152,6 +152,7 @@ homing_retract_dist: 10 second_homing_speed: 40 homing_tolerance_retries: 10 homing_backoff_dist: 5 +SET_TMC_FIELD STEPPER=stepper_x FIELD=slope_control VALUE=2 [stepper_y] step_pin: PD2 @@ -173,6 +174,7 @@ homing_retract_dist: 10 second_homing_speed: 40 homing_tolerance_retries: 10 homing_backoff_dist: 5 +SET_TMC_FIELD STEPPER=stepper_x FIELD=slope_control VALUE=2 [stepper_z] step_pin: PE7