Don´t get M581 to work proper



  • Hi There, i am here because i need some advise from professionals. 😉

    I want to connect two hardware-buttons to my printer to comfortable load and unload filament. I connected the two desired buttons to endstop E0 and E1 because they are not used in my setup.
    After that, i assigned them in config.g with M581 to different triggerX.g files. In my first attempt i oriented myself on a way with multiple triggerX.g for multiple button pushes. Each push on the same button started a different triggerX.g. The desired function on unload worked as intended but i couldn´t get load to run proper. It always shows the same behaviour even after changing E0 and E1.
    So thought my way has an error and changed the procedure to another, way simplier one. Now i need only one triggerX.g per button, but the error on load remains.

    I want the filament to be pushed fast for the most time and the last part should go slow and result in priming the nozzle. so i don´t have problems with leftover filament after switching from for example black to a much brighter color.
    The shown and persistant error is: filament starts feeding with the somewhat slow speed of the first step and doesn´t stop until i hit emergency stop. The GCode in trigger3.g works as long as i let it run directly out of a macro-folder on the board (i changed my load-macro to this commands and it works). But even using M98 in trigger3.g to use the working macro will show the above behaviour.

    Here is the content of my last revision, maybe one of you has an idea to push me in the right direction. 🤔

    added in config.g:
    ; Assigning Switches to E0=Load and E1=Unload
    M581 T2 E1 S1 C0 ; Runs trigger2.g file when pressed - Unload Filament
    M581 T3 E0 S1 C0 ; Runs trigger3.g file when pressed - Load and Purge Filament


    trigger2.g
    ;FullyUnloadFilament

    G1 E-900 F2000 ;Retract 900mm Filament


    trigger3
    ;LoadAndPurgeFilament

    G1 E10 F600 ;Feed 10mm of filament at 600mm/min - Init Load
    G4 P1000 ;Wait one second
    G1 E700 F3000 ;Feed 700mm of filament at 3000mm/min - Quick Load
    G4 P1000 ;Wait one second
    G1 E200 F200 ;Feed 200mm of filament at 200mm/min - Load and Purge
    G4 P1000 ;Wait one second
    G1 E-5 F1800 ;Retract 5mm of filament at 1800mm/min - Prevent Ooze



  • I'd try:

    • Ensure the extruder is in relative mode with M83 at the beginning of the macro.

    • You should not need the wait commands.

    • Maybe an M400 at the beginning of the macro (before the M83), this is a little bit of a shot in the dark, so try it both ways.



  • That´s it, it works. Thank you very much Danal. 🙂 I still don´t get why it worked as macro started out of the macro-folder but well, i don´t have to know anything as long as it works. 😊

    Changed GCode:

    trigger3
    ;LoadAndPurgeFilament

    M400 ;Wait for current moves to finish
    M83 ;Set extruder to relative mode
    G1 E10 F600 ;Feed 10mm of filament at 600mm/min - Init Load
    G1 E700 F3000 ;Feed 700mm of filament at 3000mm/min - Quick Load
    G1 E200 F200 ;Feed 200mm of filament at 200mm/min - Load and Purge
    G1 E-5 F1800 ;Retract 5mm of filament at 1800mm/min - Prevent Ooze


Log in to reply