You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[gcode_macro M106]
rename_existing: M106.1
gcode:
{% set S = params.S|default(0)|int %}
{% set P = params.P|default(0)|int %}
{% set FACTOR = printer['output_pin fan_factor'].value %}
{% set ADJUSTED_S = (S * FACTOR)|round(0)|int %}
M106.1 P{P} S{ADJUSTED_S}
Configure SET_VELOCITY_LIMIT to use accel_factor
[gcode_macro SET_VELOCITY_LIMIT]
rename_existing: SET_VELOCITY_LIMIT_ORIG
gcode:
{% set accel = params.ACCEL|default(None) %}
{% set accel_to_decel = params.ACCEL_TO_DECEL|default(None) %}
{% set velocity = params.VELOCITY|default(None) %}
{% set factor = printer['output_pin accel_factor'].value %}
{% if accel is not none %}
{% set adjusted_accel = accel|float * factor %}
{% else %}
{% set adjusted_accel = None %}
{% endif %}
{% if accel_to_decel is not none %}
{% set adjusted_accel_to_decel = accel_to_decel|float * factor %}
{% else %}
{% set adjusted_accel_to_decel = None %}
{% endif %}
SET_VELOCITY_LIMIT_ORIG {% if velocity is not none %}VELOCITY={velocity|float}{% endif %} {% if adjusted_accel is not none %}ACCEL={adjusted_accel|float}{% endif %} {% if adjusted_accel_to_decel is not none %}ACCEL_TO_DECEL={adjusted_accel_to_decel|float}{% endif %}
If you want to get fancy you could add a moonraker hook to listen to changes to the factor pins and immediately recalculate fan speed and accel but I only use these when my sliced file is changing them rapidly so they get recalculated when those change pretty quickly anyway.
This was tested on an FLSun T1 Pro running klipper 10. You may need slight changes on different versions of klipper or other printers but hopefully the idea is still helpful.
If you want to get fancy you could add a moonraker hook to listen to changes to the factor pins and immediately recalculate fan speed and accel but I only use these when my sliced file is changing them rapidly so they get recalculated when those change pretty quickly anyway.