[FR] Fan instructions that override fan G-code for duration of print

Please see Below… MainSail crew also seem open to integrating the feature into their UI.

Fan slider currently overrides the value until a new G-code value is received, this can be on the next layer. It would be great to have a fan slider/toggle that overrides fan G-code for duration of print.

Solves the following problem:

If you are adjusting the fan to save a print, this would allow you to save the print and not worry that G-code will reset the fan to a problematic value.

I often use regular/maximum fan speed with threshold values in Cura. This can lead to fan values bouncing around a lot depending on the layer geometry. As such, currently the fan slider doesn’t accomplish much for a print in progress as it will be reset quickly by g-code.

Greetings,

I am trying my best to learn Jinja2 and Python. Old Java dog new tricks yadda yadda…
This is why I love Klipper because most things I need I can override the baseline with a superseded macro.

No changes to Klipper base code needed.

I actually don’t need this on my Klipper delta, but thought this should be do-able under macros and a good mini challenge. I did have a printer with a crazy fan that this would have been great on… I would have set it up to re-scale the S factor to a max percent on the fly.

New M106 that overrides default with the L parameter. Send a fan command with an L1 and it will lock the fan to that speed and all those M106 in you gcode will just spam you with a message saying. “FAN LOCK ON SEND M106 L0 TO REMOVE” Also M106 with no parameters defaults to fan off now.

[gcode_macro M106]
rename_existing: M106.1
variable_lock: 0
gcode:

{% set S = params.S|default(0)|int %}
{% set CURLOCK = printer["gcode_macro M106"].lock %}
{% if 'L' in params %}
    SET_GCODE_VARIABLE MACRO=M106 VARIABLE=lock VALUE={params.L|default(1)|int}
    M106.1 S{S}
{% else %}    
    {% if CURLOCK == 1%}
        RESPOND TYPE=error MSG="FAN LOCK ON SEND M106 L0 TO REMOVE"
    {% else %}
        M106.1 S{S}
    {% endif %}
{% endif %}

EDIT: Code was not showing proper spacing.

1 Like

Thank for your reply… Yes , this can be accomplished through a macro. However…

If it is integrated into klipper it can be integrated into the interface of mainsail, as they only give UI features to Klipper commands.

It would be great to have an override tick-box next to the fan slider. Others have requested similar and the MSOS team has expressed a willingness to integrate the feature into the UI.