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

    Trouble assigning filament sensor after using pin for GPIO

    Scheduled Pinned Locked Moved
    Filament Monitor
    2
    6
    332
    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.
    • Pietundefined
      Piet
      last edited by

      Hi all,

      I have a question about assigning a filament sensor to an input after using it for a GPIO pin.
      I'm using a rotary magnetic encoder as filament sensor, this is placed inside my extruder and is declared as a pulse generating filament sensor.

      Now i'm trying to write a macro for loading the filament into the extruder and priming the nozzle. To do this i remove the filament sensor in the macro, read the output of the sensor (0 or 1), and keep extruding until that changes. After that i extrude an extra amount to prime the nozzle and remove the GPIO and try to redefine the filament sensor.

      However if i do this it throws this, Error: M591: Pin 20.io1.in is not free, even tho i
      removed it using: M950 J9 C"nil" and echo exists(sensors.gpIn[9]) returns false.

      Does anyone know of a way to fix this or should i abandon this macro?

      G91 															; relative posisitioning
      
      M591 D0 P0														; remove existing filament sensor
      M950 J9 C"20.io1.in"											; add GPIO at filament sensor pin
      
      var sensorInput = sensors.gpIn[9].value							; read current filamentsensor output
      
      M291 P"Load filament into the drive gears." S3					
      
      while (sensors.gpIn[9].value == var.sensorInput)				; while filamentsensor value does not change keep extruding
      	G1 E1 F1800
      	if iterations > 50
      		M291 P"Loading filament has timed out" S2
      		M591 D0 P7 C"20.io1.in" L0.061 R80:120 E1 S1
      		G90
      		M99
      
      echo "Filament sensor has been triggered. Priming nozzle."		
      M400
      G1 E110 F300													; prime nozzle
      
      M400
      
      G90
      
      M950 J9 C"nil"													; remove GPIO
      echo exists(sensors.gpIn[9])
      M591 D0 P7 C"20.io1.in" L0.061 R80:120 E1 S1					; add filament sensor again
      
      M291 P"Filament has been loaded." S2
      

      Thanks in advance,

      Piet.

      dc42undefined 1 Reply Last reply Reply Quote 0
      • dc42undefined
        dc42 administrators @Piet
        last edited by

        @piet which firmware version are you using? A bug in this area was fixed in firmware 3.3.

        Duet WiFi hardware designer and firmware engineer
        Please do not ask me for Duet support via PM or email, use the forum
        http://www.escher3d.com, https://miscsolutions.wordpress.com

        Pietundefined 1 Reply Last reply Reply Quote 0
        • Pietundefined
          Piet @dc42
          last edited by

          @dc42 Im using version 3.4.0beta3 in SBC mode

          dc42undefined 2 Replies Last reply Reply Quote 1
          • dc42undefined
            dc42 administrators @Piet
            last edited by

            @piet thanks, I'll test that.

            Duet WiFi hardware designer and firmware engineer
            Please do not ask me for Duet support via PM or email, use the forum
            http://www.escher3d.com, https://miscsolutions.wordpress.com

            1 Reply Last reply Reply Quote 0
            • dc42undefined
              dc42 administrators @Piet
              last edited by dc42

              @piet I confirm there is a bug. M950 J# C"nil" does not release the port if it is on an expansion board. This will be fixed in the next beta release of the expansion board firmware.

              As a workaround, if you have a spare IOx.IN port on the same expansion board, then instead of deleting the GpIn port using C"nil" you could reassign it to that pin.

              Duet WiFi hardware designer and firmware engineer
              Please do not ask me for Duet support via PM or email, use the forum
              http://www.escher3d.com, https://miscsolutions.wordpress.com

              Pietundefined 1 Reply Last reply Reply Quote 1
              • Pietundefined
                Piet @dc42
                last edited by

                @dc42 Alright, thanks for the help!

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