Default fan setup per tool in config.g

Discussion in 'Motion System' started by orcinus, Aug 25, 2019.

  1. orcinus

    orcinus Well-Known Member

    Joined:
    Oct 20, 2015
    Messages:
    336
    Likes Received:
    113
    @Greg Holloway the config file from the github repo doesn't seem to set up the default PCF (fan 0 in RRF parlance) per each tool. That means that M106 sent by your slicer won't do anything.

    Here's a fix:

    Code:
    ; Fans
    M106 P0 S0                        ; UNUSED
    M106 P1 S255 H1 T70                    ; T0 HE
    M106 P2 S0                        ; T0 PCF
    M106 P3 S255 H2 T70                     ; T1 HE
    M106 P4 S0                        ; T1 PCF
    M106 P5 S255 H3 T70                     ; T2 HE
    M106 P6 S0                         ; T2 PCF
    M106 P7 S255 H4 T70                    ; T3 HE
    M106 P8 S0                        ; T3 PCF
    
    ; Tools
    M563 P0 S"T0" D0 H1 F2                    ; Define tool 0
    G10 P0 X0 Y0 Z0                     ; Reset tool 0 axis offsets
    G10 P0 R0 S0                         ; Reset initial tool 0 active and standby temperatures to 0C
    
    M563 P1 S"T1" D1 H2 F4                     ; Define tool 1
    G10 P1 X0 Y0 Z0                     ; Reset tool 1 axis offsets
    G10 P1 R0 S0                         ; Reset initial tool 1 active and standby temperatures to 0C
    
    M563 P2 S"T2" D2 H3 F6                    ; Define tool 2
    G10 P2 X0 Y0 Z0                     ; Reset tool 2 axis offsets
    G10 P2 R0 S0                         ; Reset initial tool 2 active and standby temperatures to 0C
    
    M563 P3 S"T3" D3 H4 F8                    ; Define tool 3
    G10 P3 X0 Y0 Z0                     ; Reset tool 3 axis offsets
    G10 P3 R0 S0                         ; Reset initial tool 3 active and standby temperatures to 0C
    
    Now whichever tool is active will have its PCF turn on when you issue a M106 without the fan number specified (e.g. T1, then M106 S255 will fire up PCF on the second tool, and if you do a swap with T0, the next M106 S255 will turn on the PCF on the first tool).

    This should also probably be commented out in tpostN.g:

    Code:
    ;PCF fan on
    M106 P2 S127
    Also, this as well in tfreeN.g:

    Code:
    ;fan off
    M106 P8 S0
    The reason why is that if there's a tool change within the same layer, and your slicer only sets the fan speed on layer change, you'll end up with the fan (unintentionally off) when you swap a tool.
     
  2. mhe

    mhe Well-Known Member

    Joined:
    Sep 5, 2015
    Messages:
    279
    Likes Received:
    77
    That might solve the overheat issues I've seen on some of my test prints, thanks for the heads-up!
     
  3. Greg Holloway

    Greg Holloway Administrator
    Staff Member

    Joined:
    Sep 4, 2015
    Messages:
    1,028
    Likes Received:
    632
     
    Michael Pearson likes this.
  4. mhe

    mhe Well-Known Member

    Joined:
    Sep 5, 2015
    Messages:
    279
    Likes Received:
    77
    Can confirm, fix works, also Tool fan slider in the Job Status tab now works. It doesn't stay in place when moved, but it issues a working M106 Sx and it applies to whatever tool is selected. Thanks once again!
     
    orcinus likes this.
  5. Amr

    Amr Well-Known Member

    Joined:
    Jun 2, 2019
    Messages:
    130
    Likes Received:
    31
    I was trying to fix this from the slicer side by modifying the tool change script, but this seems a more elegant solution. Now I have a question, I am assuming the order if defining the fans then the tools is important and the addition here is the F"n" at the end of the M563 command did I get that correct.
     
    orcinus likes this.
  6. orcinus

    orcinus Well-Known Member

    Joined:
    Oct 20, 2015
    Messages:
    336
    Likes Received:
    113
    Correct.
    I'm not sure about the order, but i've put fans before tools just in case.
     
  7. Spoon Unit

    Spoon Unit Well-Known Member

    Joined:
    Sep 6, 2015
    Messages:
    1,560
    Likes Received:
    483
    Boom. This was on my to-do list. Thanks for reducing the list.
     
    orcinus likes this.
  8. dc42

    dc42 Well-Known Member

    Joined:
    Aug 16, 2016
    Messages:
    485
    Likes Received:
    216
    The order doesn't matter when using RepRapFirmware 2, but may matter when using RepRapFirmware 3 because RRF3 generally requires objects (sensors, heater, fans etc.) to be created before they are used in other commands.
     
  9. Paul Arden

    Paul Arden Well-Known Member

    Joined:
    Aug 28, 2019
    Messages:
    167
    Likes Received:
    59
    I guess the problem with making this the default right now in the Github repo is that the guide for setup makes use of the fans coming on when you select a tool for testing purposes. It feels like an additional guide (since commissioning is already a decent length) on Tuning would be useful that runs through suggested touch points in the firmware config and things like PID tuning etc.

    While most people building the Toolchanger are probably familiar with a lot of this from other printers, since most will take the E3D RepRapFirmware-SD repo as a starting point rather than build a config from scratch it could still be useful.
     
  10. orcinus

    orcinus Well-Known Member

    Joined:
    Oct 20, 2015
    Messages:
    336
    Likes Received:
    113
    The test script could be rewritten to reassign the fans again, though.
     
  11. orcinus

    orcinus Well-Known Member

    Joined:
    Oct 20, 2015
    Messages:
    336
    Likes Received:
    113
    Sidenote: i've since changed the config to assign all 4 fans to all 4 tools, so M106 controls all of them in unison.

    Had to do that because KISSlicer has a "bug" - it won't set the fan speed after a tool change, and on top of that, if the fan speed was already set to the same speed already when it hits a layer change or an infill <-> perimeter <-> support change, it skips M106 (and just leaves a comment there) in some bizarre attempt at optimization.

    This then leads to second (or third, or fourth) tool's fan never turning on during the print, unless you're very "lucky".

    So the only recourse for me, until i switch to a different slicer, is to simply control all the PCF's as if they were one fan.
     
    Spoon Unit likes this.
  12. Spoon Unit

    Spoon Unit Well-Known Member

    Joined:
    Sep 6, 2015
    Messages:
    1,560
    Likes Received:
    483
    I think that's a decent idea. I think S3D suffers from the same thing. So the fan setting happens on the layer boundary for one tool, but doesn't impact the next tool, and because when that tool comes back on line, it's not on a layer boundary for a fan speed change it doesn't change the fan speed for this tool. I'm not sure that this is a bug so much as a complete lack of design for the concept of changing tools.
     
  13. Amr

    Amr Well-Known Member

    Joined:
    Jun 2, 2019
    Messages:
    130
    Likes Received:
    31
    You can add this to the tool change gcode and your problem should be solved. That is if you are using S3D never used kiss before so have no clue how to help there.
    .
    Code:
    M106 S[fan_speed_pwm]
    
     
  14. Spoon Unit

    Spoon Unit Well-Known Member

    Joined:
    Sep 6, 2015
    Messages:
    1,560
    Likes Received:
    483
    But wouldn't that set it to a specific speed every tool change? What if the fan speed should vary every layer, not every tool change?
     
  15. Amr

    Amr Well-Known Member

    Joined:
    Jun 2, 2019
    Messages:
    130
    Likes Received:
    31
    S3D willl set the speed as per the setting for the slice, so if you have different speeds for different heights it will be considered
     
    Spoon Unit likes this.
  16. Spoon Unit

    Spoon Unit Well-Known Member

    Joined:
    Sep 6, 2015
    Messages:
    1,560
    Likes Received:
    483
    I see. So 'fan_speed_pwm' is a variable that S3D populates.
     
  17. Amr

    Amr Well-Known Member

    Joined:
    Jun 2, 2019
    Messages:
    130
    Likes Received:
    31
    Yup its a place holder as they call it, there is really no official list published by S3D but this is what I found and most work.

    [toolchange_retract_distance]
    [toolchange_prime_distance]
    [retract_speed]
    [travel_speed]
    [current_position_x]
    [current_position_y]
    [next_position_x]
    [next_position_y]
    [next_position_z]
    [previous_direction_x]
    [previous_direction_y]
    [previous_direction_z]
    [next_direction_x]
    [next_direction_y]
    [next_direction_z]
    [average_direction_x]
    [old_tool]
    [new_tool]
    [toolchange_retract_speed]
    [extruder0_temperature]
    [extruder1_temperature]
    [extruder2_temperature]
    [extruder3_temperature]
    [extruder4_temperature]
    [extruder5_temperature]
    [bed0_temperature]
    [bed1_temperature]
    [bed2_temperature]
    [bed3_temperature]
    [bed4_temperature]
    [bed5_temperature]
    [total_filament_used]
    [extruder0_filament_used]
    [extruder1_filament_used]
    [extruder2_filament_used]
    [extruder3_filament_used]
    [extruder4_filament_used]
    [extruder5_filament_used]
    [total_filament_weight]
    [extruder0_filament_weight]
    [extruder3_filament_weight]
    [extruder4_filament_weight]
    [extruder5_filament_weight]
    [total_filament_cost]
    [extruder0_filament_cost]
    [extruder1_filament_cost]
    [extruder2_filament_cost]
    [extruder3_filament_cost]
    [extruder4_filament_cost]
    [extruder5_filament_cost]
    [total_print_time_sec]
    [build_size_x]
    [build_size_y]
    [build_size_z]
    [total_layer_count]
    [fan_speed_percentage]
    [progress]
    [current_Z_position]
    [current_layer]

    https://community.ultimaker.com/top...ted-placeholders-for-post-processing-scripts/
     
    mhe and Greg Holloway like this.
  18. dc42

    dc42 Well-Known Member

    Joined:
    Aug 16, 2016
    Messages:
    485
    Likes Received:
    216
    You can set the speed of the print cooling fan of the new tool to be as set in the last M106 command by including M106 R2 in the tpost file for the tool.
     
  19. Yakeru

    Yakeru Member

    Joined:
    Sep 20, 2019
    Messages:
    17
    Likes Received:
    5
    Thanks ! I was wondering why my cooling settings were not taken into account in S3D, will try that now !

    EDIT :

    ho I see !

    So fan settings in S3D's profiles have no impact then, cooling is managed by the post tool change scipts. Interesting !
     
    #19 Yakeru, Sep 21, 2019
    Last edited: Sep 21, 2019
  20. Paul Arden

    Paul Arden Well-Known Member

    Joined:
    Aug 28, 2019
    Messages:
    167
    Likes Received:
    59
    This would seem to be the ideal solution. However I'm having trouble testing it out. Right now I'm just trying to verify it would work manually in the gcode console.

    The default tfreeX.g macro provided calls M106 Px S0, will that get ignored in terms of using M106 to restore? From what I understand, if I have M106 R2 in my tpostX.g, I should be able to set the fan speed with M106 Sxxx before the toolchange, then perform multiple toolchanges and the fan speed should follow the tool around. Since PrusaSlicer outputs the fan speed (without a fan number) this would seem to be exactly what I want, however when I test it in the gcode console I don't seem to get the fan spinning up after the toolchange.
     

Share This Page