Please let me know what's wrong with my Load filament macro



  • The issue is:
    After filament is loaded, it starts retracting whole filament back.

    M291 P"Please wait while the nozzle is being heated up" R"Loading Filament" T5 	; Display message
    G10 S235 																		; Set current tool temperature to 235C
    M116 																			; Wait for the temperatures to be reached
    
    M291 P"Feeding 10mm at 10mm/s" R"Loading filament..." T5 						; Display new message
    G1 E10 F600 																	; Feed 10mm of filament at 600mm/min
    M400 																			; Wait for moves to complete
    
    
    M291 P"Feeding 1800mm at 50mm/s" R"Loading filament..." T5 						; Display new message
    G1 E1800 F3000 																	; Feed 1800mm of filament at 3000mm/min
    M400 																			; Wait for moves to complete
    
    
    M291 P"Feeding 20mm at 5mm/s" R"Loading filament..." T5 						; Display new message
    G1 E20 F300 																	; Feed 20mm of filament at 300mm/min
    M400 																			; Wait for moves to complete
    
    
    M291 P"Retracting 1mm at 15mm/s" R"Loading filament..." T5 						; Display new message
    G4 P1000 																		; Wait one second
    G1 E-1 F900 																	; Retract 2mm of filament at 900mm/min
    M400 																			; Wait for moves to complete
    
    M292 																			; Hide the message
    G10 S0 																			; Turn off the heater
    M84 E0:1 																		; Turn off extruder drives 1 and 2
    


  • You've probably put it back in absolute and the G1 E-1 is unloading everything



  • @jay_s_uk said in Please let me know what's wrong with my Load filament macro:

    You've probably put it back in absolute and the G1 E-1 is unloading everything

    Nope, removed retraction, still doing it.
    I'm just executing load filament macro manually. No idea what's going on...


  • Moderator

    Have you tried adding an M83 to start of the macro?



  • Interesting macro.

    Why are you feeding different filament amounts at different speeds?

    Thanks.

    Frederick



  • @Phaedrux said in Please let me know what's wrong with my Load filament macro:

    Have you tried adding an M83 to start of the macro?

    I will try that



  • @fcwilt said in Please let me know what's wrong with my Load filament macro:

    Interesting macro.
    Why are you feeding different filament amounts at different speeds?

    I guess I can simplify it a bit. But I still need 2 speeds. First fast to feed filament until i'ts reached the hotend and then slow to push old filament out of the nozzle.



  • @evomotors My best guess is that sometime before the macro runs, the firmware is "seeing" an M82 which tells it to expect absolute extruder moves. If so, as @Phaedrux suggested adding M83 at the start should fix it.

    Assuming there is an M82 somewhere (most likely coming from a sliced gcode) and assuming that the extruder position has been set to zero, then G1 E0 will move the filament to 10mm from the zero position (rather than by 10mm in relative mode), then the G1 E1800 will move it to 1800 mm from the zero position (which is a relative move of 1790mm from the last move), then the next G1 E20 will move it back to 10mm from the zero position.

    On the basis that it's always best not to assume anything, it would be best practice to have M83 at the start of the macro in any case. I would also add a "Tn" command because one day, you will run the macro with no tool selected and the G10 S235 will throw an error to that effect.



  • @deckingman said in Please let me know what's wrong with my Load filament macro:

    @evomotors My best guess is that sometime before the macro runs, the firmware is "seeing" an M82 which tells it to expect absolute extruder moves. If so, as @Phaedrux suggested adding M83 at the start should fix it.
    Assuming there is an M82 somewhere (most likely coming from a sliced gcode) and assuming that the extruder position has been set to zero, then G1 E0 will move the filament to 10mm from the zero position (rather than by 10mm in relative mode), then the G1 E1800 will move it to 1800 mm from the zero position (which is a relative move of 1790mm from the last move), then the next G1 E20 will move it back to 10mm from the zero position.
    On the basis that it's always best not to assume anything, it would be best practice to have M83 at the start of the macro in any case. I would also add a "Tn" command because one day, you will run the macro with no tool selected and the G10 S235 will throw an error to that effect.

    I'm not using it from slicer. I'm executing it manually from macros on DWC. Add Tn to what command?



  • @evomotors What I meant is that the firmware is getting an M82 command from somewhere. When you first apply power, the contents of config.g are read in and the the contents of config_override.g if you use it. Those values will persist until they are overridden by another command and that other command will persist until it too is overwritten or until power is cycled. Some people set there slicers to use absolute extruder values and so use M82 in their config.g. Others use relative extruder moves in the slicer and so use M83. And sometimes the slicer start gcode will add M82 or M83 values but not necessarily.

    You are using relative moves in your macro, therefore you need to "tell" the firmware to expect relative moves by using M83 (just in case something has previously "told" the firmware to expect absolute value).

    Add Tn to the start of the macro - but not literally. If you only have a single tool, use T0 (that's zero). If you have multiple tools with different heaters, use the tool number for which you want to load filament (and you'll need different macros for each tool).


Log in to reply