• Tags
  • Documentation
  • Order
  • Register
  • Login
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.
  • undefined
    Piet
    last edited by 6 Sept 2021, 06:25

    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.

    undefined 1 Reply Last reply 6 Sept 2021, 10:01 Reply Quote 0
    • undefined
      dc42 administrators @Piet
      last edited by 6 Sept 2021, 10:01

      @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

      undefined 1 Reply Last reply 6 Sept 2021, 10:35 Reply Quote 0
      • undefined
        Piet @dc42
        last edited by 6 Sept 2021, 10:35

        @dc42 Im using version 3.4.0beta3 in SBC mode

        undefined 2 Replies Last reply 6 Sept 2021, 10:38 Reply Quote 1
        • undefined
          dc42 administrators @Piet
          last edited by 6 Sept 2021, 10:38

          @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
          • undefined
            dc42 administrators @Piet
            last edited by dc42 9 Jul 2021, 09:52 6 Sept 2021, 12:32

            @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

            undefined 1 Reply Last reply 7 Sept 2021, 07:33 Reply Quote 1
            • undefined
              Piet @dc42
              last edited by 7 Sept 2021, 07:33

              @dc42 Alright, thanks for the help!

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