sensors.endstops[4].triggered not set until macro exit
-
@danzaywer
when you try once without the iterations:while !sensors.endstops[4].triggered && iterations<6 .... change to while !sensors.endstops[4].triggered ....
-
@cosmowave without iteration it loop until
if iterations = 5 M291 R"ATTENTION" P"Try last time" S3
and if a clic "ok" it loop forever....
-
after other tests I found that the trigger is not set to true even at the end of the macro, in my macro I set the physical endstop which was active again, so the problem is on sensors.endstops [4] .triggered which remains false
-
@danzaywer in the first post you wrote that the endstop is triggered after the macro. Now you write that it remains false!?
What's the case now? -
@cosmowave at the end of my macro I had
"M574 V2 S1 p"! ZSTOP ""
so it was triggered because it is a physical sensor that is physically reached, I apologize, my mistake! the problem of the loop however remains, if you use the stalldetection the endstop is not triggered. -
@danzaywer I'm not sure if i understand you correctly...
But the loop can't end without triggering the endstop. -
@cosmowave My initial macro is:
M574 V2 S3 while !sensors.endstops[4].triggered && iterations<6 echo iterations if iterations = 5 M291 R"ATTENTION" P"Try last time" S3 G1 V-20 F5000 ; retract a little filament M400 ; wait for move to finish before changing current M915 V0 S18 ; set stall sensitivity M913 V30 M83 ; relative extrusion G1 H1 V800 F9000 ; feed up to 800mm until stall echo "feed done" M400 M913 V100 G92 V0 ...... M574 V2 S1 p"! ZSTOP"
so at the exit the endstop is triggered.
During the "while", becouse of "M574 V2 S3", the endstop is not triggered, I think it's not really managed.
Pending clarification I found an alternative that works, quite elegant:G92 V0 ;set V to 0 to ensure while execution M574 V2 S3 while move.axes[4].machinePosition<move.axes[4].max && iterations<6 echo iterations G92 V0 ;set V to 0 if come from a previus iteration if iterations = 5 M291 R"ATTENTION" P"Try last time" S3 G1 V-20 F5000 ; retract a little filament M400 ; wait for move to finish before changing current M915 V0 S18 ; set stall sensitivity M913 V30 M83 ; relative extrusion G1 H1 V800 F9000 ; feed up to 800mm until stall echo "feed done" M400
MAX limit of V is 100000, G1 H1 set it to this value if stalling occur
-
@danzaywer There may be an issue with how long a endstop that is a stall detection remains triggered. I simplified the macro to this:
while !sensors.endstops[2].triggered && iterations<6 echo iterations echo sensors.endstops[2].triggered G4 S1 echo sensors.endstops[2].triggered
Where endstop 2 for me is a simple switch.
Running this macro and pressing the switch part way through gave the expected result: -
@t3p3tony
The macro with a switch works perfectly, my intent is to remove the physical switch and iterate the feed until the stall occurred. The control over the position and the maximum value gives me the desired result, at this point I am curious to understand the behavior of the virtual sensor when setting the stall detection. -
@danzaywer I understand, my point is when you go through the while loop its unlikely to actually ever match the condition during the brief point that the stall occurs.
-
@t3p3tony said in sensors.endstops[4].triggered not set until macro exit:
I understand, my point is when you go through the while loop its unlikely to actually ever match the condition during the brief point that the stall occurs
Thanks! at this point, checking the position seems to be the only way to verify that the stall has occurred