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

    Filament Runout Event

    Scheduled Pinned Locked Moved
    General Discussion
    2
    9
    345
    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.
    • Lexanundefined
      Lexan
      last edited by

      I have a very unusual FIlamentline.
      An extruder helps for loading next to the Spool with an Filament Runout Sensor.
      After this follows a 3.6m long bowden.
      then a small 5cm gap and the 2nd extruder on the printhead.

      now my question, how can i tell the printer when the event is used to use the 3.6m filament and pause right after this, i would like to reduce the amount of wasted filament as much as possible.

      M950 to define the pin and M581 for the event is clear, but how i define the left distance to print ?

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

        @Lexan

        I use this method
        I create a global variable in config.g

        if !exists(global.filamentDistance)
        	global filamentDistance = 0 ; global for use to allow filament to feed for set distance after sensor trips 
        else
        	set global.filamentDistance = 0
        

        In my filament error file

        ;0:/sys/filament-error.g
        ;run when a filament sensor error is detected.  Print will be paused bt Daemon.g after runout distance.
        var runoutDistance = 350 ; this is just so you can change easily 
        ; first check that we are not currently in an error state and the switch has been toggled again.
        if (global.filamentDistance !=0) || (state.status != "processing")
        	echo "Filament sensor triggered, but no print in progress.  No action taken"
        	M99 ; exit macro
        ;echo "filament-error.g run"
        
        G4 P10 ; delay 10ms to debounce
        if sensors.filamentMonitors[0].status="ok"
        	echo "switch bounce detected - error cancelled"
        	M99 ; break out if sensor value is zero again (bouncing)
        echo {"Filament error type " ^ param.P ^ " detected on extruder " ^ param.D}
        ;M291 R"Filament Error" P{"Filament error type " ^ param.P ^ " detected on extruder " ^ param.D} S1 T3
        
        var thisExtruderValue = move.extruders[tools[state.currentTool].filamentExtruder].position
        set global.filamentDistance = var.thisExtruderValue + var.runoutDistance
        echo "filament error detected - print will be paused after " ^ var.runoutDistance ^ "mm"
        

        In daemon.g I have something like this extract

        while true
           if (state.currentTool != -1) && (state.currentTool < #tools)
              if (move.extruders[tools[state.currentTool].filamentExtruder].position > global.filamentDistance)  &&  (global.filamentDistance !=0) && (state.status = "processing")
                 echo "paused called from daemon - filament runout"	
                 M25 ; pause print if filament has run out
           G4 S1
        

        You will also need to reset the global to zero at the start and finish of prints, when a job is cancelled etc.

        Lexanundefined 1 Reply Last reply Reply Quote 1
        • Lexanundefined
          Lexan @OwenD
          last edited by Lexan

          @OwenD said in Filament Runout Event:

          You will also need to reset the global to zero at the start and finish of prints, when a job is cancelled etc.

          so you mean set global.filamentDistance = 0 in the start gcode ?
          it works also without a pi, correct ?
          cuz first time i see the deamon.g

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

            @Lexan
            I run in standalone, so no pi needed

            You have to create daemon.g

            Lexanundefined 1 Reply Last reply Reply Quote 0
            • Lexanundefined
              Lexan @OwenD
              last edited by

              @OwenD did you ever had this kind of error ?
              Error: in file macro line 3 column 11: meta command: array index out of bounds

              i put the runoutDistance = 3500 in the filament-error.g

              Lexanundefined OwenDundefined 2 Replies Last reply Reply Quote 0
              • Lexanundefined
                Lexan @Lexan
                last edited by

                if !exists(global.filamentDistance)
                global filamentDistance = <- is here missing a point after global ?

                OwenDundefined 2 Replies Last reply Reply Quote 0
                • OwenDundefined
                  OwenD @Lexan
                  last edited by OwenD

                  @Lexan

                  @OwenD did you ever had this kind of error ?
                  Error: in file macro line 3 column 11: meta command: array index out of bounds

                  That error is likely line 3 of the daemon.g file.
                  I tried to set that up so it would cover almost any configuration but it's somehow pointing to a tool or sensor that doesn't exist.
                  If you only have one sensor and tool you can address them directly
                  Otherwise post your config.g so we can see how your printer is set up

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

                    @Lexan said in Filament Runout Event:

                    if !exists(global.filamentDistance)
                    global filamentDistance = <- is here missing a point after global ?

                    No
                    That line is saying if the global does NOT exist then create it
                    The next ELSE line will say
                    set global.filamentDistance =

                    So if it DOES exist we reset it. If it DOESN'T. exist we create it.
                    This avoids error messages if you run M98 P"config.g" and ensures the global is created at startup

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

                      @Lexan said in Filament Runout Event:

                      if !exists(global.filamentDistance)
                      global filamentDistance = <- is here missing a point after global ?

                      Another possibility is that daemon.g is starting before the tools & monitors are defined

                      In your config.g put in a global to stop the daemon code executing
                      This will also help when you need to edit daemon.g
                      So at the start of config.g

                      if !exists(global.runDaemon)
                         global runDaemon = false
                      else
                         set global.runDaemon = false
                      

                      Then at the start of daemon.g put

                      while true
                         if global.runDaemon = false
                            M99
                          ;rest of code
                      

                      Edit
                      Forgot to say, at the end of config.g put

                      set global.runDaemon=true
                      

                      You will have to rename daemon.g before you can edit and save it, then rename it back again

                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post
                      Unless otherwise noted, all forum content is licensed under CC-BY-SA