How can I stop Z moving if Z probe fails



  • I have a mechanical end stop switch connected to E2.
    I have had the following in my config file for sometime:-
    M581 E2 S1 T0 C0 ; Set Z stop as fail safe for Z zeroing and run /sys/trigger2.g

    in the trigger2.g file I have
    G91
    G1 Z5 F200

    If I activate the micro switch, nothing happens but on the machine properties page, Drive 2, endstop hit - Yes

    so it appears that the trigger2 file is not actioned.

    any thoughts?


  • administrators

    Do you really mean E2 (first endstop input on a DueX board), or do you mean Z (Z endstop input)?



  • I have exactly the same line in my config.g with a microswitch connected to E2 so it should work the same as yours. However, when triggered it does an emergency stop because that is what T0 does. If you want run trigger2 file, then you need to change the "T" parameter.

    So with your M581 line as it is, if you trigger the switch at any time, even when idle (because you've used C0) it should initiate an emergency stop (mine does). If it doesn't do that, then I'd say you might have a wiring issue. AFAIK, if you remap the drives, it doesn't re-map the end stops so you might be looking at the wrong end stop on the machine properties page? Dunno about that - David will no doubt confirm or otherwise.

    HTH



  • dc42, I mean the Z endstop input.
    I'm sure that is where I have it connected but I will need to check in the morning.
    I use your mini Z probe to home Z and check the bed levelling.
    So should the M581 line be E0 S1 T0 C0

    deckingman, we had a discussion last year and the original line worked for me before I converted to a coreXYUV and used all 10 controllers.
    I just wanted to have a fail safe so the bed didn't crash into the hotend, if for any reason the Z probe failed. I don't really want to initiate an emergency stop, just a stop and reversal of Z.
    Are we saying that the only way to protect against a crash is to have an emergency stop actioned?
    The problem with that is the hotend remains in contact with the bed and not reversed to relieve the pressure, reversal has to wait for the firmware to start again and then a reversal can be actioned manually.



  • Hi Paul. No I'm not saying that the only thing you can do is initiate an emergency stop. What I am saying is that using T0 will initiate an emergency stop. If you want to use your trigger macro instead, you need to change T0 to point to that macro.


  • administrators

    @appjaws:

    dc42, I mean the Z endstop input.
    I'm sure that is where I have it connected but I will need to check in the morning.
    I use your mini Z probe to home Z and check the bed levelling.
    So should the M581 line be E0 S1 T0 C0

    It should be: M581 Z S1 T0 C0



  • I think I know what's happening here.

    Paul,

    Did the M581 E2 S1 T0 C0 line come from the config.g that I sent you when you were trying to get XYUV working? I ask because it's identical to what I use. If so, then it'll only work if you have the switch wired the same as me and it will take the same action that I have my machine set up to do. If you have the switch wired to a different end stop, then you need to change the E0 to Z as David has said. You can't use E0 and E1 because these are now U and V endstops.

    Also, the action that I take is to do an emergency stop when the switch triggers so if you want to run your trigger macro, then you have to change T0 to point to that macro. The Wiki explains is quite well https://duet3d.com/wiki/G-code#M581:_Configure_external_trigger

    HTH



  • Thank you both.
    I did have the end stop connected to Z and using T2 does reverse the Z by 5mm as indicated in the trigger macro, however, It does not stop the initial movement, the reversal only happens after the move has taken place. So in the case of a probe failure, Z just keeps moving until the hotend or bed has broken.
    I have looked at all G and M codes and can not find any that will stop the current move, other than emergency stop, Is there a way to interrupt the current move and action the trigger macro?



  • @appjaws:

    Thank you both.
    ā€¦.....................
    I have looked at all G and M codes and can not find any that will stop the current move, other than emergency stop, Is there a way to interrupt the current move and action the trigger macro?

    Ahh, now that you mention it, that rings a bell somewhere at the back of my mind. I can't remember exactly but there was a reason why I abandoned using a macro and resorted to just doing an emergency stop. Maybe that was it. No doubt David will come along and put us both right shortly.



  • According to the wiki page, wouldn't using T1 cause the printer to pause? That's what you want to happen if the switch gets tripped. Have you tried that?



  • As I understand it, activating pause will run the pause macro but will not run the trigger macro, also, how would I recover from the pause, without the head moving to the original paused position?

    Maybe I will just have to use the emergency stop T0 and wait for the firmware to reboot.



  • Yes, pause.g is just another macro so I'd have thought that if the machine waits for the move to complete before running a trigger macro, then you'd get the same behaviour running the pause.g macro. No doubt David will put us all right.



  • @appjaws:

    Maybe I will just have to use the emergency stop T0 and wait for the firmware to reboot.

    It's not a big deal to use that. Let's face it, with this "fall back switch" you'll only see this emergency stop if the Z probe fails so it won't be often - hopefully never.


  • administrators

    @appjaws:

    Thank you both.
    I did have the end stop connected to Z and using T2 does reverse the Z by 5mm as indicated in the trigger macro, however, It does not stop the initial movement, the reversal only happens after the move has taken place. So in the case of a probe failure, Z just keeps moving until the hotend or bed has broken.
    I have looked at all G and M codes and can not find any that will stop the current move, other than emergency stop, Is there a way to interrupt the current move and action the trigger macro?

    A move can only be terminated by a trigger from the Z probe during a probing move, or an endstop switch trigger during a G1 S1 move, or an emergency stop, or running out of power. If you use 1.20 series firmware then you could instead use M913 Z0 to set the Z motor current to zero when a trigger occurs. However, a normal trigger doesn't have the same priority as a T0 so there might still be a delay in some cases.



  • Thanks for all of the help.
    I'll use T0 and forget the trigger file



  • Thank you all, This has been a good learning post. I wonder if the pause is after the programmed move is finished or after the planner buffer(?) is empty? Meaning that it completes several moves before the pause takes place?



  • @appjaws,
    Paul. Off topic I know but another tip in case you don't already do it, is to lower the motor currents at the start of homing. You'll need to play around to find the right value but you are looking to find the minimum that you can home reliably at. Then if the worse happens and every switch fails, a head crash won''t do too much damage. (Don't forget to put the motor currents back up again at the end of homing).
    Also, I added extra micro switches to X and Y and Z axes maxima and wired them all in series with the Z min so if any one triggers, it'll initiate an emergency stop. This is just for when I'm playing around and attempt to move beyond the axes limits before I've homed the printer. Oh and finally, I added big red emergency stop button and wired that to another estop. It's not a true emergency stop because it doesn't cut power, so wouldn't be much use in the event of a fire. But have an RCD conveniently placed that I can easily trip in that eventuality.

    @timcurtis
    Tim. I wasn't ignoring you - just don't know the answer to your question šŸ™‚ My guess would be just the current move buy David will confirm or otherwise.


  • administrators

    @timcurtis67:

    Thank you all, This has been a good learning post. I wonder if the pause is after the programmed move is finished or after the planner buffer(?) is empty? Meaning that it completes several moves before the pause takes place?

    The trigger file starts running asynchronously with respect to commands already being executed, with a few caveats:

    • If multiple trigger events other than T0 are pending, only one can be executed at a time. So you might have to wait until the previous trigger macro completes.
    • There might be another process accessing the SD card at the time.
    • If the trigger macro commands any movement or uses any command that affects movement (other than M906 and M913 in firmware 1.20 and later), all the moves already in the movement queue are completed first.


  • Thank you for the clarification David.
    My goal is to rig up a simple filament out switch with the pause command. At least until the filament monitors are ready for sale.


  • administrators

    See the description of M591 in the GCode wiki.


Locked
 

Looks like your connection to Duet3D was lost, please wait while we try to reconnect.