Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    Filament runout and autoload sensor questions (Prusa MK3S logic)

    Scheduled Pinned Locked Moved Solved
    Gcode meta commands
    2
    3
    500
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Schild0rundefined
      Schild0r
      last edited by

      Hey there,

      I am using an Orbiter 2.0 at the moment with the filament sensor addon.

      I want to use the runout sensor (just a steel ball pressing down a button when filament is present) for both filament runout detection and filament insertion detection but I have run into a few problems:

      1. When I configure a runout sensor using M591 D0 P2 C"^21.io1.in" S1 it should only trigger during prints (S1), however it appears to me that it always triggers, even when no print is running.

      2. If I configure the sensor as a filament runout sensor using M591 D0 P2 C"^21.io1.in" S1 I cannot assign another trigger to it using e.g. M581 P2 T2 S0 so instead I assign two triggers to the same input on different edges:

      M950 J2 C"^21.io1.in"  ; create input 2 on TB1LC io1, pullup enabled
      M581 P2 T2 S0          ; trigger trigger2.g (filament autoload script) when input 2 is falling
      M581 P2 T4 S1 R1       ; trigger trigger4.g (filament runout script) when input 2 is rising during a print
      

      I guess this makes sense but now I am wondering if my trigger4.g file should simply contain a macro call M98 P"filament-error.g" or invoke the actual event with M957 E"filament-error" D0. I think M957 was only designed for debugging purposes but I don't see why I could not use it this way(?)

      1. A filament error does not clear the filament designation from an extruder automatically, which also makes sense and is usefull for autoloading. Lets say I want to use autoloading after a filament runout during a print: I just insert the filament and since there is still the filament assigned to the extruder, the printer would already know which load.g file to use. Unfortunately since there is already filament loaded, one cannot run another load.g even if it is for the same filament. This is my autoloading script, maybe someone can help me what to put in line 8:
      G4 P500                 ; wait 500ms to fully insert filament past the sensor
      M302 S1                 ; temporarily allow cold extrusion
      G1 E5 F600              ; Feed 5mm of filament at 10mm/s into extruder gears
      G1 E45 F3000            ; Feed 45mm of filament at 50mm/s
      M302 P0                 ; Forbid cold extrusion after grabbing filament
      if move.extruders[0].filament != ""
        echo "autoloading", move.extruders[0].filament
        -----> M701 S{move.extruders[0].filament} ;THIS DOES NOT WORK
      else
        echo "grabbing new filament"
        M291 R"Filament autoload" P"No filament assigned to this extruder, run loading sequence for newly inserted filament" S2
      

      Maybe something along the lines of M98 P"0:/filaments/{move.extruders[0].filament}/load.g" would work, but I have not figured out yet, how to properly include a variable into a path called by a Gcode (would be usefull for many applications).
      Another way would be to store the filament name in a variable, then somehow clear the filament designation from the extruder and then run M701. But I also don't know how one would clear the filament designation with code...

      Thanks very much in advance for any hints.

      Schild0rundefined 1 Reply Last reply Reply Quote 0
      • Schild0rundefined Schild0r marked this topic as a question
      • Phaedruxundefined Phaedrux moved this topic from Filament Monitor
      • Schild0rundefined
        Schild0r @Schild0r
        last edited by Schild0r

        Well at least I found an answer to my last question:
        Says right in the documentation

        ^ : (string,string)->string : String concatenation

        In my defense I am not an english native and had never heard the word concatenation before so I just read over it (multiple times).

        So line 8 is now M98 P{"0:/filaments/"^move.extruders[0].filament^"/unload.g"}

        However maybe someone could still tell me if raising the event in the trigger file to act as filament runout is bad or completely fine.

        OwenDundefined 1 Reply Last reply Reply Quote 0
        • OwenDundefined
          OwenD @Schild0r
          last edited by

          @schild0r
          I wouldn't use M957 as it's for debugging as you say.
          I see no problem with calling the macros for filament-error or load.g from your trigger.
          I seem to remember DWC 3.4 allows a filament change to the same filament now, but you can always identify the load.g you want to run with
          move.extruders[state.currentTool].filament

          1 Reply Last reply Reply Quote 0
          • Schild0rundefined Schild0r has marked this topic as solved
          • First post
            Last post
          Unless otherwise noted, all forum content is licensed under CC-BY-SA