Issues with filament-change.g



  • I am relatively new with Duet, and forums in general, so please bear with me.

    I am having issues with the filament-change.g file. I have placed it in the /sys/ folder using DWC, but when the filament sensor (simple switch) detects no filament, the printer is simply paused. I would like a specific macro to be run when the printer detects no filament. Im sure I must be missing something. Attached are the config, pause, and filament change files.

    ; Configuration file for Duet WiFi (firmware version 1.21)
    ; executed by the firmware on start-up

    ; General preferences
    G90 ; Set all to absolute positioning
    M83 ; Set extruder to relative positioning

    ; Network
    M550 P"3D Printer" ; Set machine name
    M551 P"Foxtrot1234" ; Set password
    M552 S1 ; Enable wifi network
    M586 P0 S1 ; Enable HTTP
    M586 P1 S0 ; Disable FTP
    M586 P2 S0 ; Disable Telnet

    ; Drives
    M569 P0 S1 ; Physical drive 0 goes forwards
    M569 P1 S1 ; Physical drive 1 goes forwards
    M569 P2 S1 ; Physical drive 2 goes forwards
    M569 P3 S1 ; Physical drive 3 goes forwards
    M350 X16 Y16 Z16 E16 I1 ; Configure microstepping, interpolation
    M92 X80.00 Y80.00 Z400.00 E823.00 ; Set steps per mm
    M566 X300.00 Y300.00 Z18.00 E600.00 ; Set maximum instantaneous speed changes (mm/min)
    M203 X18000.00 Y18000.00 Z600.00 E1500.00 ; Set maximum speeds (mm/min)
    M201 X500.00 Y500.00 Z100.00 E1000.00 ; Set accelerations (mm/s^2)
    M906 X1275.00 Y1275.00 Z900.00 E1428.00 I30 ; Set motor currents (mA) and motor idle factor percent, 85 percent max stepper current on X, Y, and E. 60 on Z to decrease noise.
    M84 S30 ; Set idle timeout

    ; Axis Limits
    M208 X0 Y0 Z0 S1 ; Set axis minima
    M208 X470 Y500 Z500 S0 ; Set axis maxima

    ; Endstops
    M574 X1 Y1 S1 ; Set active high endstops

    ; Z-Probe
    M574 Z1 S2 ; Set endstops controlled by probe
    M558 P8 F120 H2 I1 R0 T6000 A1 B1 ; Set Z probe type, feed rate, dive height, reading inversion, recovery, travel speed, probe times per point, bed heater while probing.
    G31 P5 X56 Y5 Z1.400 ; Set Z probe trigger value, x and y offsets, and trigger height.
    M557 X56:470 Y25:475 P4 ; Define mesh grid minimum and maximum x and y probe coordinates, and number of probe points for each axis direction.

    ; Heaters
    M305 P0 T100000 B3950 R4700 ; Set thermistor and ADC parameters for heater 0 (bed), resistance at 25 C, beta value, series resistance of controller electronics.
    M143 H0 S120 ; Set temperature limit for heater 0 (bed) (deg C)
    M305 P1 T100000 B4267 R4700 ; Set thermistor and ADC parameters for heater 1 (extruder)
    M143 H1 S285 ; Set temperature limit for heater 1 (extruder) (deg C).
    M307 H1 A1318.4 C689.5 D5.2 I0 V24.1 B0 S1 ; Tune heater 1 (extruder), gain, dominant time (s), dead time (s), PWM signal inversion, calibration voltage, bang bang, max PWM.

    ; Fans
    M106 P0 S0 I0 F500 H-1 ; Set fan 0 value, PWM signal inversion and frequency. Thermostatic control is turned off
    M106 P1 S1 I0 F500 H1 T50 ; Set fan 1 value, PWM signal inversion and frequency. Thermostatic control is turned on

    ; Tools
    M563 P0 D0 H1 ; Define tool 0, extruder drive 0, heater 1.
    G10 P0 X0 Y0 Z0 ; Set tool 0 axis offsets
    G10 P0 R0 S0 ; Set initial tool 0 active and standby temperatures to 0C
    M591 D0 P2 C3 S1 ; Enable filament sensing, extruder drive 0, simple sensor low with filament, connected to E0, enable filament monitoring.

    ; Automatic power saving
    M911 S23.5 R24.0 P"M913 X0 Y0 G91 M83 G1 Z3 E-5 F2400" ; Set auto save on power loss, auto save voltage threshold, resume threshold, and actions to run on power loss.

    ; Temperature Compensation
    M912 P0 S-4.7 ; Set cpu temp sensor correction. Lower number decreases displayed cpu temp.

    ; Pressure Advance
    M572 D0 S0.03 ; Enable pressure advance and set it. Marlin setup used a K factor of 0.03-0.05.

    ; Custom settings are not configured

    ; Miscellaneous
    M501 ; Load saved parameters from non-volatile memory

    T0 ; Select first tool head

    ; pause.g
    ; Called when a print from SD card is paused.

    M83 ; Relative extruder movement.
    G1 E-2 F2400 ; Retract 2mm filament at 40mm/s.
    G91 ; Relative axis movement.
    G1 Z5 F360 ; Lift Z 5mm at 6mm/s.
    G90 ; Absolute axis movement.
    G1 X0 Y0 F6000 ; Go to X=0, Y=0 at 100mm/s.
    T-1 ; Deselect all tools. Sets extruder to standby mode temperature.

    ; filament-change.g
    ; called when filament sensor detects no filament

    M83 ; Relative extruder mode.
    G1 E-100 F2400 ; Retract filament out of extruder.
    G91 ; Relative positioning mode.
    G1 Z5 F360 ; Lift Z axis.
    G90 ; Absolute positioning mode.
    G1 X0 Y0 F6000 ; Go to X=0, Y=0.
    T-1 ; Deselect all tools, sets extruder to standby mode temperature

    Thank you so much for your time.


  • administrators

    @charlie said in Issues with filament-change.g:

    I have placed it in the /sys/ folder using DWC, but when the filament sensor (simple switch) detects no filament, the printer is simply paused.

    That's how filament monitoring works at present. It's on firmware the wish list to run a specific macro when a filament error is detected.



  • Thank you for your quick reply!

    Okay, so I was hoping to have the printer automatically retract the filament out of the direct drive extruder once it detected no filament presence. My current workaround will be to have two macros. One to retract the filament completely out of the extruder, and one to load the new filament.

    ; 0:/macros/1_Remove Filament
    ; Used to remove filament.

    M117 Heating Extruder ; Display message.
    T R1 ; Select last active tool (tool 0, extruder) to set it to active temperature
    M116 ; Wait for all temperatures (hopefully only the extruder heater in this case since "pause.g" should keep bed heater on) to arrive at set value.
    M83 ; Relative extruder movement.
    M117 Feeding Filament ; Display message.
    G1 E-100 F2400 ; Feed 100mm filament at 40mm/s.

    ; 0:/macros/2_Load_Filament
    ; Used to load new filament.

    M117 Heating Extruder ; Display message.
    T R1 ; Select last active tool (tool 0, extruder) to set it to active temperature
    M116 ; Wait for all temperatures (hopefully only the extruder heater in this case since "filament-change.g" should keep bed heater on) to arrive at set value.
    M83 ; Relative extruder movement.
    M117 Feeding Filament ; Display message.
    G1 E100 F2400 ; Feed 100mm filament at 40mm/s.

    Does this appear appropriate?



  • Im also a little confused as to the purpose of the filament-change.g file if it does not run when the printer detects no filament.



  • @charlie said in Issues with filament-change.g:

    Im also a little confused as to the purpose of the filament-change.g file if it does not run when the printer detects no filament.

    The macro (which is what filament-change.g is) pre-dates the advent of filament detection sensors. So it's original purpose was to unload/load filament as and when a user decides it is time to do so.



  • filament-change.g is used for doing a M600 filament change, like for a color swap at a certain layer.



  • Okay, understood. Thank you all for your help!


Log in to reply