Issue with while loop

More
1 year 10 months ago #315922 by swepeter
Hi all, hope you can help.

Having a issue when trying to use a while loop. I am using lcnc 2.9.3 & gmoccapy 3.4.8
But lcnc just freezes or really slows down the system when the comp turns true, see below 2 examples that work and two that dont.
the only change is that it should go in to the while loop
I am trying to use imputsignals:
Code:
# ATC input signals net ATC_tool_in hm2_7i96.0.gpio.007.in => motion.digital-in-01 net ATC_tool_open hm2_7i96.0.gpio.008.in => motion.digital-in-02
 
Code:
(msg, Start) (debug, Tool state #<_hal[motion.digital-in-01]>) o110 while [#<_hal[motion.digital-in-01]> EQ 1] (debug, greater ) G4 P2 o110 continue o110 endwhile (debug, after )

output: Start tool state 0.000000 after (edited)
 
Code:
(msg, Start) (debug, Tool state #<_hal[motion.digital-in-01]>) o110 do (debug, greater ) G4 P2 o110 continue o110 while [#<_hal[motion.digital-in-01]> EQ 1] (debug, after )

output: Start tool state 0.000000 greater after (edited)
 
Code:
(msg, Start) (debug, Tool state #<_hal[motion.digital-in-01]>) o110 do (debug, greater ) G4 P2 o110 continue o110 while [#<_hal[motion.digital-in-01]> EQ 0] (debug, after )

output = nothing, not even start
Code:
(msg, Start) (debug, Tool state #<_hal[motion.digital-in-01]>) o110 while [#<_hal[motion.digital-in-01]> EQ 0] (debug, greater ) G4 P2 o110 continue o110 endwhile (debug, after )

output = nothing, not even start

Please Log in to join the conversation.

More
1 year 10 months ago #315933 by MaHa
Replied by MaHa on topic Issue with while loop
You can try M66 Pn Ln, then check #5399
Code:
o100 do          M66 P1 L0 o100 while [#5399 GE 1]


linuxcnc.org/docs/2.9/html/gcode/m-code.html#mcode:m66

Please Log in to join the conversation.

More
1 year 10 months ago #315934 by swepeter
Replied by swepeter on topic Issue with while loop
Brilliante thanks.

Will try when I get back home from work.

Please Log in to join the conversation.

More
1 year 10 months ago #315936 by MaHa
Replied by MaHa on topic Issue with while loop
Maybe the loop is not even needed.  It should be possible, to just work with wait mode type Ln  and if conditional to check value of #5399, depending on what you want to do

Please Log in to join the conversation.

More
1 year 10 months ago #315939 by swepeter
Replied by swepeter on topic Issue with while loop
In this case I need it to retry a thing if it done succeed the first time so L0 seams great for now.
but so many possibilities when started to understand this! haha

Please Log in to join the conversation.

Time to create page: 0.103 seconds
Powered by Kunena Forum