Skip to main content

Optimizing M109 / M190 Temperature Wait

Function Description​

This configuration implements intelligent temperature waiting through TEMPERATURE_WAIT, avoiding prolonged waiting caused by temperature overshoot:

  • Hotend (M109): The waiting temperature range is target temperature ±5°C

    • For example: when set to 200°C, waiting ends once the temperature reaches the 195-205°C range
  • Heated Bed (M190): The waiting temperature range is target temperature -2°C to +5°C

    • For example: when set to 60°C, waiting ends once the temperature reaches the 58-65°C range
    • The heated bed tolerance range is larger because thermal inertia is stronger, and the heating/cooling process is slower

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...