mirror of
https://github.com/Klipper3d/klipper.git
synced 2026-02-08 01:01:06 -07:00
PR: Enable multiple z_thermal_adjust sections
Multiple `z_thermal_adjust` sections may now be defined in config to compensate for different sources of z thermal expansion that happen at different rates. Signed-off-by: Gareth Farrington <gareth@waves.ky>
This commit is contained in:
parent
a3b4b39ff1
commit
ade7a4df3c
3 changed files with 31 additions and 10 deletions
|
|
@ -1240,7 +1240,9 @@ the nature of skew correction these lengths are set via gcode. See
|
|||
Temperature-dependant toolhead Z position adjustment. Compensate for vertical
|
||||
toolhead movement caused by thermal expansion of the printer's frame in
|
||||
real-time using a temperature sensor (typically coupled to a vertical section
|
||||
of frame).
|
||||
of frame). Multiple sections may be defined as [z_thermal_adjust component] to
|
||||
compensate for thermal expansion in different printer components, such as the
|
||||
hotend, heatbreak and frame.
|
||||
|
||||
See also: [extended g-code commands](G-Codes.md#z_thermal_adjust).
|
||||
|
||||
|
|
|
|||
|
|
@ -1486,15 +1486,19 @@ The following commands are available when the
|
|||
is enabled.
|
||||
|
||||
#### SET_Z_THERMAL_ADJUST
|
||||
`SET_Z_THERMAL_ADJUST [ENABLE=<0:1>] [TEMP_COEFF=<value>] [REF_TEMP=<value>]`:
|
||||
Enable or disable the Z thermal adjustment with `ENABLE`. Disabling does not
|
||||
`SET_Z_THERMAL_ADJUST [COMPONENT=name] [ENABLE=<0:1>] [TEMP_COEFF=<value>]
|
||||
[REF_TEMP=<value>]`:
|
||||
- `COMPONENT`: if multiple thermal adjustments are defined use `COMPONENT` to
|
||||
specify which one to adjust.
|
||||
- `ENABLE`: Enable or disable the Z thermal adjustment. Disabling does not
|
||||
remove any adjustment already applied, but will freeze the current adjustment
|
||||
value - this prevents potentially unsafe downward Z movement. Re-enabling can
|
||||
potentially cause upward tool movement as the adjustment is updated and applied.
|
||||
`TEMP_COEFF` allows run-time tuning of the adjustment temperature coefficient
|
||||
- `TEMP_COEFF`: allows run-time tuning of the adjustment temperature coefficient
|
||||
(i.e. the `TEMP_COEFF` config parameter). `TEMP_COEFF` values are not saved to
|
||||
the config. `REF_TEMP` manually overrides the reference temperature typically
|
||||
set during homing (for use in e.g. non-standard homing routines) - will be reset
|
||||
the config.
|
||||
- `REF_TEMP` manually overrides the reference temperature typically set during
|
||||
homing (for use in e.g. non-standard homing routines) - will be reset
|
||||
automatically upon homing.
|
||||
|
||||
### [z_tilt]
|
||||
|
|
|
|||
|
|
@ -56,8 +56,15 @@ class ZThermalAdjuster:
|
|||
self.next_transform = None
|
||||
|
||||
# Register gcode commands
|
||||
self.gcode.register_command('SET_Z_THERMAL_ADJUST',
|
||||
self.cmd_SET_Z_THERMAL_ADJUST,
|
||||
full_name = config.get_name()
|
||||
self.component = None
|
||||
if not full_name == "z_thermal_adjust":
|
||||
self.component = full_name.split(maxsplit=1)[-1]
|
||||
self.register_commands(self.component)
|
||||
|
||||
def register_commands(self, component):
|
||||
self.gcode.register_mux_command("SET_Z_THERMAL_ADJUST", "COMPONENT",
|
||||
component, self.cmd_SET_Z_THERMAL_ADJUST,
|
||||
desc=self.cmd_SET_Z_THERMAL_ADJUST_help)
|
||||
|
||||
def handle_connect(self):
|
||||
|
|
@ -169,13 +176,18 @@ class ZThermalAdjuster:
|
|||
|
||||
state = '1 (enabled)' if self.adjust_enable else '0 (disabled)'
|
||||
override = ' (manual)' if self.ref_temp_override else ''
|
||||
msg = ("enable: %s\n"
|
||||
component = ''
|
||||
if not self.component is None:
|
||||
component = "component: %s\n" % (self.component,)
|
||||
msg = ("%s"
|
||||
"enable: %s\n"
|
||||
"temp_coeff: %f mm/degC\n"
|
||||
"ref_temp: %.2f degC%s\n"
|
||||
"-------------------\n"
|
||||
"Current Z temp: %.2f degC\n"
|
||||
"Applied Z adjustment: %.4f mm"
|
||||
% (state,
|
||||
% (component,
|
||||
state,
|
||||
self.temp_coeff,
|
||||
self.ref_temperature, override,
|
||||
self.smoothed_temp,
|
||||
|
|
@ -185,5 +197,8 @@ class ZThermalAdjuster:
|
|||
|
||||
cmd_SET_Z_THERMAL_ADJUST_help = 'Set/query Z Thermal Adjust parameters.'
|
||||
|
||||
def load_config_prefix(config):
|
||||
return ZThermalAdjuster(config)
|
||||
|
||||
def load_config(config):
|
||||
return ZThermalAdjuster(config)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue