• Tags
  • Documentation
  • Order
  • Register
  • Login
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.
  • undefined
    RS
    last edited by 8 Jun 2020, 16:48

    @dc42: That's certainly useful to look into. I really like the idea of verifying a successful tool lock before moving away and potentially dropping the tool on the bed.

    But as I understand it, @sylvain has more issues than an undefined state after the abort. The abort occurs because the microswitch is not recognized as pressed, even though it apparently is, and right now he has no idea why that happens.

    Do you think that could also have something to do with the tool change procedure?

    Of course, once that's resolved, there's still the specification issue you've mentioned.

    undefined 1 Reply Last reply 8 Jun 2020, 19:22 Reply Quote 0
    • undefined
      duetlover @RS
      last edited by duetlover 6 Aug 2020, 19:50 8 Jun 2020, 19:22

      @RS said in if condition RFF3 on GPIO Pin:

      @dc42: That's certainly useful to look into. I really like the idea of verifying a successful tool lock before moving away and potentially dropping the tool on the bed.

      But as I understand it, @sylvain has more issues than an undefined state after the abort. The abort occurs because the microswitch is not recognized as pressed, even though it apparently is, and right now he has no idea why that happens.

      Do you think that could also have something to do with the tool change procedure?

      Of course, once that's resolved, there's still the specification issue you've mentioned.

      In fact, at the moment the problem is the random answer of if condition. Sometimes it works, sometimes not...

      To be sure this is not a connector issue, I deleted the last connector possible, soldered the wires => same issue !

      So, yes, my real problem at the moment is this randoming process.

      @dc42 : I'm working on tpost, not tfree

      example with tpost :

      ; tpost0.g
      ; called after tool 0 has been selected
      
      ;heatup
      M116 P0
      
      ;prime nozzle
      ;M98 Pprime.g
      
      ;mesh levelling on
      G29 S1
      
      ;PCF fan on
      M106 P2 S255
      
      
      M400
      G4 P500
      
      if sensors.gpIn[0].value = 0  ;if the microswitch is not pressed...
      	abort "Failed to grab tool 0"
      ; end if
      
      1 Reply Last reply Reply Quote 0
      • undefined
        duetlover
        last edited by 9 Jun 2020, 18:21

        I also tried with if condition at the beginning without success :

        ; tpost0.g
        ; called after tool 0 has been selected
        
        M400
        G4 P500
        
        if sensors.gpIn[0].value = 0  ;if the microswitch is not pressed...
        	abort "Failed to grab tool 0"
        
        ;heatup
        M116 P0
        
        ;prime nozzle
        ;M98 Pprime.g
        
        ;mesh levelling on
        G29 S1
        
        ;PCF fan on
        M106 P2 S255
        

        Same random behaviour 😕

        1 Reply Last reply Reply Quote 0
        • undefined
          RS
          last edited by 9 Jun 2020, 18:34

          Could you also post your tpre0.g file?

          1 Reply Last reply Reply Quote 0
          • undefined
            duetlover
            last edited by 9 Jun 2020, 20:26

            Here it is :

            ; tpre0.g
            ; called before tool 0 is selected
            
            ;Ensure no tool is selected
            ;T-1
            
            if sensors.gpIn[0].value = 1  ;if the microswitch is pressed...
                abort "Tool 0 still mounted"
            
            
            ;Unlock Coupler
            M98 P/macros/Coupler - Unlock
            
            ;Move to location
            G1 X-10.5 Y200 F50000
            
            ;Move in
            G1 X-10.5 Y230 F50000
            
            ;Collect
            G1 X-10.5 Y242.5 F2500
            
            ;Close Coupler
            M98 P/macros/Coupler - Lock
            
            ;WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING!
            ;if you are using non-standard length hotends ensure the bed is lowered enough BEFORE undocking the tool!
            G91
            G1 Z10 F1000
            G90
            
            ;Move Out
            G1 X-10.5 Y150 F4000
            
            
            
            1 Reply Last reply Reply Quote 0
            • undefined
              RS
              last edited by 9 Jun 2020, 20:42

              Hm. The whole sequence of movements, plus M400 and G4, looks good to me.

              Maybe double and triple check that the microswitch is really pressed correctly every single time? Or check if the cable from the switch to the boards runs close to other cables, where it could pick up noise. No idea how sensitive it would be to noise, but checking it and trying to move it away from other cables can't hurt.

              Besides that, I have no more ideas than what I've suggested earlier: try writing a gcode file that simulates the tool change without actually invoking the T command. Just grab the tool, then release it again, in a while loop, and see what happens. In my experience, having a minimal example that reproduces the issue often helps.

              1 Reply Last reply Reply Quote 0
              • undefined
                dc42 administrators
                last edited by 10 Jun 2020, 08:39

                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

                undefined 2 Replies Last reply 10 Jun 2020, 13:36 Reply Quote 0
                • undefined
                  duetlover @dc42
                  last edited by 10 Jun 2020, 13:36

                  @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
                  • undefined
                    dc42 administrators
                    last edited by 10 Jun 2020, 13:41

                    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
                    • undefined
                      duetlover @dc42
                      last edited by 13 Jun 2020, 17:52

                      @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
                      • undefined
                        jwalker55
                        last edited by jwalker55 7 Jan 2020, 18:09 1 Jul 2020, 18:08

                        @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.

                        ? undefined 2 Replies Last reply 1 Jul 2020, 18:13 Reply Quote 0
                        • ?
                          A Former User @jwalker55
                          last edited by 1 Jul 2020, 18:13

                          @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
                          • undefined
                            jwalker55 @jwalker55
                            last edited by 2 Jul 2020, 17:39

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

                            undefined 1 Reply Last reply 2 Jul 2020, 18:59 Reply Quote 0
                            • undefined
                              dc42 administrators @jwalker55
                              last edited by 2 Jul 2020, 18:59

                              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

                              undefined 1 Reply Last reply 2 Jul 2020, 19:29 Reply Quote 1
                              • undefined
                                jwalker55 @dc42
                                last edited by 2 Jul 2020, 19:29

                                @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