Skip to main content

Optimizing M109 / M190 Temperature Wait

Feature Description

This configuration uses TEMPERATURE_WAIT to implement intelligent temperature waiting, avoiding long waits caused by temperature overshoot:

  • Nozzle (M109): Wait temperature range is Target Temperature ±5°C

    • Example: When set to 200°C, waiting begins when the temperature reaches 195-205°C
  • Heated Bed (M190): Wait temperature range is Target Temperature -2°C to +5°C

    • Example: When set to 60°C, waiting begins when the temperature reaches 58-65°C
    • The wider tolerance range for the bed is due to higher thermal inertia, resulting in slower heating/cooling

Working Principle

  1. Non-blocking Setting: The macro first sets the target temperature immediately via M104/M140, without waiting for the temperature to rise
  2. Intelligent Waiting: Uses TEMPERATURE_WAIT to begin waiting within a reasonable range close to the target temperature
  3. Avoiding Overshoot Waiting: Traditional M109/M190 wait until the temperature is fully stable; this configuration continues execution once the temperature enters the tolerance range, improving efficiency

Configuration Example

Add the following macros to printer.cfg or a separate macro file. These macros override Klipper's native M109 / M190 behavior.

printer.cfg
[gcode_macro M109]
rename_existing: M109.1
gcode:
{% set s = params.S|float %}
M104 {% for p in params %}{'%s%s' % (p, params[p])}{% endfor %} # Set nozzle temperature
{% if s != 0 %}
TEMPERATURE_WAIT SENSOR=extruder MINIMUM={s-5} MAXIMUM={s+5}
{% endif %}

[gcode_macro M190]
rename_existing: M190.1
gcode:
{% set s = params.S|float %}
M140 {% for p in params %}{'%s%s' % (p, params[p])}{% endfor %} # Set bed temperature
{% if s != 0 %}
TEMPERATURE_WAIT SENSOR=heater_bed MINIMUM={s-2} MAXIMUM={s+5}
{% endif %}

Notes

  • It is recommended to perform PID calibration first for more stable temperature control
  • This configuration overrides Klipper's native M109 / M190 commands
  • If temperature fluctuations are large, priority should be given to checking the thermistor, heater, and PID parameters
Loading...