Issue with while loop

More
03 Dec 2024 22:43 #315922 by swepeter
Issue with while loop was created 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:
# 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
 
(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)
 
(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)
 
(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
(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
Attachments:

Please Log in or Create an account to join the conversation.

More
04 Dec 2024 05:48 #315933 by MaHa
Replied by MaHa on topic Issue with while loop
You can try M66 Pn Ln, then check #5399
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 or Create an account to join the conversation.

More
04 Dec 2024 07:46 #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 or Create an account to join the conversation.

More
04 Dec 2024 08:35 #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 or Create an account to join the conversation.

More
04 Dec 2024 10:01 #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 or Create an account to join the conversation.

Time to create page: 0.062 seconds
Powered by Kunena Forum