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

    if condition RFF3 on GPIO Pin

    Scheduled Pinned Locked Moved
    Gcode meta commands
    7
    29
    1.4k
    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.
    • dc42undefined
      dc42 administrators
      last edited by

      When it fails to detect that the tool has been picked up, if you query the switch position using an echo command or M409, does it report the correct switch state?

      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

      duetloverundefined 2 Replies Last reply Reply Quote 0
      • duetloverundefined
        duetlover @dc42
        last edited by

        @dc42 I will echo just before and just after condition test

        How should I write it ?
        just:

        echo sensors.gpIn[0].value
        

        ?
        Thanks

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

          Yes, that should work.

          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
          • duetloverundefined
            duetlover @dc42
            last edited by

            @dc42 So when it fails the echo command says 0. No problem here

            I finally change NO switch to NC one and now it seems to be OK !

            Thanks for your help.

            1 Reply Last reply Reply Quote 0
            • jwalker55undefined
              jwalker55
              last edited by jwalker55

              @dc42 Is it possible to read a sensor value twice within a single macro? For example, check the state of a switch at the beginning of tpre, then again at the end after the move out? When I do this (just by echoing to console) it outputs the state the switch was in when the macro started (or whenever the sensor was first read in the macro) for both instances despite the switch being pressed at the beginning and unpressed at the end. Aside from that it seems to work as expected if i'm only reading the sensor once.

              A Former User? jwalker55undefined 2 Replies Last reply Reply Quote 0
              • A Former User?
                A Former User @jwalker55
                last edited by

                @jwalker55 maybe post your actual files in a new topic? sounds like it should work if the testing is done in the same file as the move is made.

                1 Reply Last reply Reply Quote 0
                • jwalker55undefined
                  jwalker55 @jwalker55
                  last edited by

                  Adding a short (10ms) pause using G4 prior to the second sensor reading seemed to fix it.

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

                    Alternatively you could have added M400 after the movement commands and before reading the switch again, so that the macro waited until the movement completed.

                    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

                    jwalker55undefined 1 Reply Last reply Reply Quote 1
                    • jwalker55undefined
                      jwalker55 @dc42
                      last edited by

                      @dc42 I'm an idiot. You literally said that above and I somehow read past it. My apologies.

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