if condition RFF3 on GPIO Pin
-
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.
-
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?
-
@dc42 I will echo just before and just after condition test
How should I write it ?
just:echo sensors.gpIn[0].value
?
Thanks -
Yes, that should work.
-
@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.
-
@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.
-
@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.
-
Adding a short (10ms) pause using G4 prior to the second sensor reading seemed to fix it.
-
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.
-
@dc42 I'm an idiot. You literally said that above and I somehow read past it. My apologies.