@phaedrux said in stop movement when endstop is triggered:
@fcwilt said in stop movement when endstop is triggered:
the trigger code didn't execute until the movement completed.
This may be improved by increasing the segmentation of long moves using M669 S T
https://duet3d.dozuki.com/Wiki/Gcode?revisionid=HEAD#Section_Parameters_for_Cartesian_CoreXY_CoreXZ_CoreXYU_CoreXYUV_MarkForged_kinematics_RRF_2_03_and_later_only
I will try that.
It may be that my memory is faulty regards triggers and moves and my past testing - that would not be the first time - getting old is not fun.
I just tested a trigger under 3.3 and it does fire while the move is underway.
However I could not find any way to abort the move. M0 and M1 finish any moves in the buffer so that doesn't work.
I tried having a trigger set a global variable exit_loop. I installed a sensor on the X axis to fire the trigger. Then I created this macro
G90
G1 X0 ; just moving to a start position
G91
while iterations < 10
G1 X10
if {global.exit_loop} = 1
break
G90
The problem there, of course, is the loop quickly does all 10 iterations, putting all 10 moves in the buffer, and the loop is finished long before the trigger is ever fired.
I added a G4 command at the bottom of the loop, which worked in the sense that the loop was still going by the time the trigger fired and was able to terminate the loop but the result was move, wait, move, wait, etc which is likey not going to be acceptable.
I'm glad to test any ideas you might have.
Frederick