#I am trying to run through the setup and I keep getting object' has no attribute 'fan'.

1 messages ยท Page 1 of 1 (latest)

radiant hollow
#

Error evaluating 'gcode_macro AFC_POOP:gcode': jinja2.exceptions.UndefinedError: 'extras.gcode_macro.GetStatusWrapper object' has no attribute 'fan'

QIDI X-Max3 running FreeDi printer.cfg

####
Fans
####
Part cooling fan
[output_pin fan]
pin: MKS_THR:gpio2
pwm: True
cycle_time: 0.0100
hardware_pwm: false
value: 0
scale: 255
shutdown_value: 0.0
Fan Macros
########
Set Fan Speed macro
Mainly name castings for nicer web interface names and display functionality
[gcode_macro M106]
gcode:
    {% if params.P is defined %}
      {% if params.S is defined %}
        {% if (params.P|int) == 0 %}
          SET_PIN PIN=partfan VALUE={params.S|int}
        {% elif (params.P|int) == 2 %}
          SET_PIN PIN=sidefan VALUE={params.S|int}
        {% elif (params.P|int) == 3 %}
          SET_PIN PIN=filterfan VALUE={params.S|int}
        {% else %}
          SET_PIN PIN=fan{params.P|int} VALUE={params.S|int}
        {% endif %}
      {% else %}
        {% if (params.P|int) == 0 %}
          SET_PIN PIN=partfan VALUE=255
        {% elif (params.P|int) == 2 %}
          SET_PIN PIN=sidefan VALUE=255
        {% elif (params.P|int) == 3 %}
          SET_PIN PIN=filterfan VALUE=255
        {% else %}
          SET_PIN PIN=fan{params.P|int} VALUE=255
        {% endif %}
      {% endif %}
    {% endif %} 

    {% if params.T is defined %}
      {% if (params.T|int) == -2 %}
        {% if params.S is defined %}
          SET_PIN PIN=filterfan VALUE={params.S|int}
        {% else %}
          SET_PIN PIN=filterfan VALUE=255
        {% endif %}
      {% endif %}
    {% endif %}

    {% if params.P is undefined %}
      {% if params.T is undefined %}
        {% if params.S is defined %}
          SET_PIN PIN=partfan VALUE={params.S|int}
        {% else %}
          SET_PIN PIN=partfan VALUE=255
        {% endif %}
      {% endif %}
    {% endif %}
tiny flareBOT
#

When posting configs, logs, or any other sort of code, please surround the text with code fences (```) to make it easier to read. Example:

```
[AFC_BoxTurtle Turtle_1]
type: 'Box Turtle'
```

type: 'Box Turtle'```
naive oyster
#

Oh you are trying to poop and don't have a proper fan defined in your config ๐Ÿ˜‘

thorny lance
#

can you post klippy.log file

radiant hollow
thorny lance
#

ok, so this is Qidi being weird in their config, they have the fan defined as a pin instead of a fan.

#

how much are you willing and able to troubleshoot config changes

radiant hollow
#

I am willing try most things to figure it out but I am new to configs

thorny lance
#

this issue is that they are using M106 to define a bunch of fans instead of being specifically the part cooling fan like is normal in klipper

radiant hollow
#

Thanks, I will try to work on understanding the setup and separating them. If that doesn't work I might need to reach out to the FreeDi dev.

thorny lance
#

This normally just says fan instead of output_pin fan

naive oyster
thorny lance
#

you might be able to change your M106 using SET_FAN_SPEED FAN=fan SPEED={params.S|int} instead of SET_PIN PIN=fan{params.P|int} VALUE={params.S|int}

#

once you remove the output_pin name

radiant hollow
#

Thanks, I am not sure if I fixed but I at least got past that error. I will need to check tomorrow. Thanks for the help. I will share my changes if I get it to work.

naive oyster
#

So updating line 39 in AFC/macros/Poop.cfg file:
{% set backup_fan_speed = printer.fan.speed %}
To be this should work
{% set backup_fan_speed = printer["output_pin fan"].value %}

#

maybe this is what you did already

thorny lance
naive oyster
#

oh yes correct, updated to include file

radiant hollow
#

I might have over complicated things. I will try this out tomorrow.

naive oyster
#

I was about to over complicate it as well until I found this printer["output_pin fan"].value in my printer.cfg file ๐Ÿ™‚

radiant hollow
#

I think that worked! At least to get me to the next part of setting up. Not that they will do any good but are the changes I made but reverted. Thank you for your help!

#

Only note I will make is in FreeDi the part fan is names partfan not fan. I had changed it in an early attempt to get it working.

naive oyster